Repository navigation
Tags
Tags
fix(helm): add unit tests, extraEnv schema validation, and minor fixes ( twentyhq#18836) ## Summary Follow-up to twentyhq#18157. Cherry-picks the useful parts from twentyhq#18481 (by @dnplkndll), adapted to align with the current state of `main`: - **Helm unit tests** for Redis external authentication (secret-based + plaintext password, both server and worker) - **Helm unit tests** for `extraEnv` injection (plain values and `valueFrom` on both server and worker) - **JSON schema validation** for `server.extraEnv` and `worker.extraEnv` in `values.schema.json` - **Fix** `server_url_test.yaml` to use JSONPath filters (`@.name=="SERVER_URL"`) instead of brittle `env[0]` index selectors - **Fix** worker `storageEnv` whitespace (missing `-` in `{{- $storageEnv | nindent 12 }}`) Stale tests from twentyhq#18481 (for `disableDbMigrations`, `server.env` pass-through, and `run-migrations` init container) were dropped since those features were removed during the twentyhq#18157 cleanup. ## Test plan - [ ] `helm lint` passes - [ ] `helm template` renders cleanly - [ ] Unit tests pass with `helm unittest` (requires the plugin) Made with [Cursor](https://cursor.com)
fix: restore original migration timestamp for messaging infrastructure ( twentyhq#18810) ## Summary - Restores the original migration timestamp (`1773945207801`) that was accidentally changed to `1774005903909` during PR twentyhq#18787 - Keeps the content improvements (default column values) from that PR intact ## Test plan - [ ] Verify migration runs correctly with `npx nx run twenty-server:database:migrate:prod` Made with [Cursor](https://cursor.com)
fix: restore ViewFilter value stringification lost in converter remov… …al (twentyhq#18745) ## Summary - **Restores `convertViewFilterValueToString()` calls** that were lost when the converter layer was removed in twentyhq#18667. The GraphQL `ViewFilter.value` is typed as `JSON` (can be a string, array, or object), but the frontend type system expects a `string`. Without stringification, SELECT/MULTI_SELECT filter values (e.g. `['LOST']`) reach `arrayOfStringsOrVariablesSchema` as raw arrays, causing a `ZodError: expected string, received array`. - **Fixes applied at two data boundary points**: `splitViewWithRelated` (primary entry from metadata store) and `mapViewFiltersToFilters` (which also accepts `GqlViewFilter[]` directly). Fixes a production regression introduced by twentyhq#18667. ## Test plan - [ ] Apply a SELECT filter (e.g. filter Opportunities by Stage = "Lost") — should no longer throw ZodError - [ ] Apply a MULTI_SELECT filter — should work correctly - [ ] Verify filters with multiple selected values work (e.g. Stage is "Lost" or "Won") - [ ] Verify empty filters and "is not" operands still work - [ ] Verify filters loaded from saved views still work after page refresh Made with [Cursor](https://cursor.com)
fix: navigation menu item type backfill and frontend loading (twentyh… …q#18730) ## Summary - Move `BackfillNavigationMenuItemTypeCommand` from the 1-19 to the 1-20 upgrade path and split the DB transaction into two phases (data backfill, then schema changes) to avoid the PostgreSQL error "cannot ALTER TABLE because it has pending trigger events." - Fix backfill logic to prefer `OBJECT` over `VIEW` for navigation menu items that have `targetObjectMetadataId`, and correct already mis-typed items. Tighten the `CHECK` constraint to enforce `viewId IS NULL` for `OBJECT` type items. - On the frontend, force `navigationMenuItems` into `staleEntityKeys` when the server's `minimalMetadata` response omits the collection hash (happens when the Redis cache hasn't been warmed after an upgrade), ensuring the sidebar loads navigation items. ## Test plan - [ ] Upgrade from 1.18 or 1.19 to 1.20 and verify the migration completes without errors - [ ] Verify navigation menu items of type `OBJECT` do not have a `viewId` set in the database - [ ] Sign out and sign in — confirm navigation menu items appear in the sidebar on first load - [ ] Verify `VIEW`-typed items also appear correctly in the sidebar Made with [Cursor](https://cursor.com)
fix: split tsvector migration, add configurable DB timeout, reorder 1… ….19 commands (twentyhq#18614) ## Summary - **Split tsvector migration into individual per-field transactions**: each tsvector field now runs in its own `workspaceMigrationRunnerService.run()` call (its own DB transaction). Since STORED generated columns trigger full table rewrites, a timeout on one large table (e.g. `timelineActivity`) no longer rolls back the others. Each field has its own idempotency check, so the migration is fully resumable. - **Add configurable `DATABASE_STATEMENT_TIMEOUT_MS` env var** (default 15000ms): controls the `query_timeout` on the core datasource globally, allowing operators to raise it for long-running upgrade commands without code changes. - **Reorder 1.19 upgrade commands**: move `fixRoleAndAgentUniversalIdentifiersCommand` first so that subsequent commands see corrected universal identifiers.
Fix participant matching failing due to updating all columns instead … …of only changed fields (twentyhq#18105) The updateMany in matchParticipants was spreading the entire participant object into the SET clause, which included generated columns (searchVector) and composite field columns (createdBySource) that can't be written to. Narrowed the update to only set personId and workspaceMemberId. ``` [1] query failed: UPDATE "workspace_3ixj3i1a5avy16ptijtb3lae3"."calendarEventParticipant" SET "id" = $1, "createdAt" = $2, "updatedAt" = $3, "deletedAt" = $4, "createdBySource" = $5, "createdByWorkspaceMemberId" = $6, "createdByName" = $7, "createdByContext" = $8, "updatedBySource" = $9, "updatedByWorkspaceMemberId" = $10, "updatedByName" = $11, "updatedByContext" = $12, "position" = $13, "searchVector" = $14, "handle" = $15, "displayName" = $16, "isOrganizer" = $17, "responseStatus" = $18, "calendarEventId" = $19, "personId" = $20, "workspaceMemberId" = $21 WHERE "id" = $22 RETURNING * -- PARAMETERS: ["f1526103-451a-429f-9743-3a81c3a3e3aa","2026-02-19T22:23:32.354Z","2026-02-19T22:23:32.354Z",null,"MANUAL",null,"System",null,"MANUAL",null,"System",null,0,"'test@test.com':1","test@test.com","",false,"NEEDS_ACTION","fb1892a8-6daf-435b-a43b-e8fe8693eb99","60bf9e82-f1b7-4bed-a1af-7039fb9c32f5",null,"f1526103-451a-429f-9743-3a81c3a3e3aa"] [1] error: error: column "searchVector" can only be updated to DEFAULT [1] Exception Captured [1] undefined [1] [ [1] PostgresException [Error]: Data validation error. [1] at computeTwentyORMException (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/engine/twenty-orm/error-handling/compute-twenty-orm-exception.js:35:19) [1] at WorkspaceUpdateQueryBuilder.executeMany (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/engine/twenty-orm/repository/workspace-update-query-builder.js:269:82) [1] at process.processTicksAndRejections (node:internal/process/task_queues:105:5) [1] at async WorkspaceRepository.updateMany (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/engine/twenty-orm/repository/workspace.repository.js:234:25) [1] at async MatchParticipantService.matchParticipants (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/modules/match-participant/match-participant.service.js:93:13) [1] at async /Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/modules/match-participant/match-participant.service.js:160:13 [1] at async MatchParticipantService.matchParticipantsForPeople (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/modules/match-participant/match-participant.service.js:130:9) [1] at async CalendarEventParticipantMatchParticipantJob.handle (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-match-participant.job.js:45:13) [1] at async MessageQueueExplorer.invokeProcessMethods (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/engine/core-modules/message-queue/message-queue.explorer.js:113:17) [1] at async MessageQueueExplorer.handleProcessor (/Users/huzef/Documents/bounties/twenty/packages/twenty-server/dist/engine/core-modules/message-queue/message-queue.explorer.js:104:13) { [1] code: '428C9' [1] } [1] ] ```
Fix commands order for v1.17.0 (twentyhq#17839) Order should be 1. We delete all the file records (from core.file table) 2. We add the foreign key file / applicationId (pg constraint) 3. We further update the table structure: fullPath is deleted; path is created; unicity constraint between workspaceId/applicationId/path is created (pg constraint) 4. we migrate the workflow steps (this will create files in core.file) 5. we backfill the application package (same) --------- Co-authored-by: Charles Bochet <charles@twenty.com>
fix: add command to fix morph relation field name mismatches (twentyh… …q#17757) ## Summary When a custom object is renamed after creation, the relation fields on `noteTarget`, `taskTarget`, `attachment`, and `timelineActivity` keep their old names but point to the renamed object. For example: - User creates custom object `solution` - System creates field `solution` on NoteTarget → pointing to Solution - User renames object from `solution` to `productCatalog` - Field name stays as `solution` but points to `productCatalog` - Migration runs: `solution` → `targetSolution` - Now `targetSolution` points to `productCatalog` ❌ This causes the morph name computation to fail: - `getMorphNameFromMorphFieldMetadataName("targetSolution", "productCatalog")` - Tries to remove `ProductCatalog` from `targetSolution` → no match - Name stays as `targetSolution` instead of becoming `target` - Frontend computes: `targetSolution` + `Company` = `targetSolutionCompany` 💥 ## The Fix This command finds and fixes all such mismatches by: 1. Finding MORPH_RELATION fields where `field.name != target${capitalize(targetObject.nameSingular)}` 2. Renaming the column in the workspace schema 3. Updating the field metadata (name + joinColumnName in settings) 4. Invalidating the cache ## Usage **Dry run (to see what would be fixed):** ```bash npx nx run twenty-server:command upgrade:1-17:fix-morph-relation-field-names -- --workspace-id <id> --dry-run ``` **Fix a specific workspace:** ```bash npx nx run twenty-server:command upgrade:1-17:fix-morph-relation-field-names -- --workspace-id <id> ``` **Fix all workspaces:** ```bash npx nx run twenty-server:command upgrade:1-17:fix-morph-relation-field-names ``` ## SQL to find affected workspaces ```sql SELECT fm."workspaceId", COUNT(*) AS mismatched_fields FROM core."fieldMetadata" fm JOIN core."objectMetadata" target_om ON fm."relationTargetObjectMetadataId" = target_om.id JOIN core."objectMetadata" source_om ON fm."objectMetadataId" = source_om.id WHERE fm.type = 'MORPH_RELATION' AND fm.name LIKE 'target%' AND source_om."nameSingular" IN ('noteTarget', 'taskTarget', 'attachment', 'timelineActivity') GROUP BY fm."workspaceId" HAVING COUNT(*) FILTER ( WHERE fm.name != 'target' || initcap(replace(target_om."nameSingular", '_', '')) ) > 0; ```