Title: bug: mergeOrgFeatureFlags drops all valid org feature flags when one stored flag is invalid · Issue #5058 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: bug: mergeOrgFeatureFlags drops all valid org feature flags when one stored flag is invalid · Issue #5058 · triggerdotdev/trigger.dev
X Title: bug: mergeOrgFeatureFlags drops all valid org feature flags when one stored flag is invalid · Issue #5058 · triggerdotdev/trigger.dev
Description: Provide environment information System: OS: Linux 6.8 Ubuntu Binaries: Node: 22.14.0 pnpm: 9.15.0 Describe the bug In a7f0f90e ("show stored org values for locked flags in the admin flags dialog"), the v1 and v2 admin org feature-flag ro...
Open Graph Description: Provide environment information System: OS: Linux 6.8 Ubuntu Binaries: Node: 22.14.0 pnpm: 9.15.0 Describe the bug In a7f0f90e ("show stored org values for locked flags in the admin flags dialog"),...
X Description: Provide environment information System: OS: Linux 6.8 Ubuntu Binaries: Node: 22.14.0 pnpm: 9.15.0 Describe the bug In a7f0f90e ("show stored org values for locked flags in the admin flags dial...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/issues/5058
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: mergeOrgFeatureFlags drops all valid org feature flags when one stored flag is invalid","articleBody":"### Provide environment information\n\nSystem:\n OS: Linux 6.8 Ubuntu\nBinaries:\n Node: 22.14.0\n pnpm: 9.15.0\n\n### Describe the bug\n\nIn `a7f0f90e` (\"show stored org values for locked flags in the admin flags dialog\"), the v1 and v2 admin org feature-flag routes were updated to read stored flags key-by-key via `parseStoredOrgFlags(organization.featureFlags).valid`, and saves now intentionally keep untouched invalid values and unknown keys from newer releases in `Organization.featureFlags`.\n\nHowever, `mergeOrgFeatureFlags` in `apps/webapp/app/v3/featureFlags.server.ts` (used by `resolveOrganizationFeatureFlags`) still validates the entire `orgFeatureFlags` object at once with `validatePartialFeatureFlags(orgFeatureFlags)`:\n\n```ts\nexport function mergeOrgFeatureFlags(\n globalFlags: Partial\u003cFeatureFlagCatalog>,\n orgFeatureFlags: unknown\n) {\n const parsed = orgFeatureFlags\n ? validatePartialFeatureFlags(orgFeatureFlags as Record\u003cstring, unknown>)\n : ({ success: false } as const);\n return { ...globalFlags, ...(parsed.success ? parsed.data : {}) };\n}\n```\n\nIf an org has one invalid stored flag value in `Organization.featureFlags` (which admin saves now keep), `validatePartialFeatureFlags` fails for the whole blob and `mergeOrgFeatureFlags` drops all of the org's valid overrides (`hasWebhooksAccess`, `hasQueryAccess`, `hasLogsPageAccess`, `hasAiAccess`, etc.), even though the admin flags dialog and `/admin/api/v1/orgs/:orgId/feature-flags` show them as active.\n\nTwo small related issues in `FeatureFlagsDialog.tsx`:\n- `unsetFlag(key)` only deletes `next[key]` without clearing `derivedFlagsClearedWith(key)`, so unsetting `runOpsMintKind` leaves `runOpsMintKindPrev` and `runOpsMintKindFlippedAt` shown as set in the dialog list and JSON preview.\n- Checking \"Unlock read-only flags\" unlocks `effect === \"derived\"` grace-stamp rows (`runOpsMintKindPrev`, `runOpsMintKindFlippedAt`, `runOpsMintShardSetPrev`, `runOpsMintShardSetFlippedAt`) into editable controls, even though the server strips and recomputes them on save.\n\n### Reproduction repo\n\nhttps://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/app/v3/featureFlags.server.ts#L307-L314\n\n### To reproduce\n\n1. Call `mergeOrgFeatureFlags({ hasLogsPageAccess: false }, { hasLogsPageAccess: true, realtimeBackend: \"not-a-backend\" })` (or save a valid flag via `/admin/api/v2/orgs/:organizationId/feature-flags` on an org that has an existing invalid flag).\n2. `mergeOrgFeatureFlags` returns `{ hasLogsPageAccess: false }` instead of `{ hasLogsPageAccess: true }` because `validatePartialFeatureFlags` fails on `realtimeBackend`.\n\n### Suggested fix\n\nUse `parseStoredOrgFlags(orgFeatureFlags).valid` in `mergeOrgFeatureFlags`, and in `FeatureFlagsDialog.tsx` clear `derivedFlagsClearedWith(key)` in `unsetFlag` and keep `effect === \"derived\"` flags read-only when unlocked.\n\n### Additional information\n\n_No response_\n\n\u003cimg width=\"960\" height=\"440\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/420343d9-97da-4b6c-925b-5bfdf0c7fc1a\" />","author":{"url":"https://github.com/shafiktanbir","@type":"Person","name":"shafiktanbir"},"datePublished":"2026-10-24T11:46:40Z","url":"https://github.com/triggerdotdev/trigger.dev/issues/5058"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:685d32c9-a3e1-abd5-fdb1-3a6ea1416f52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8916:268853:5F52787:7E9B2FC:6AFAD885 |
| html-safe-nonce | 1dd50ec9aa12dcda89b42e22f0f85a32ba5b6ce0a6d5b4e093e6870a2ab6b004 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTE2OjI2ODg1Mzo1RjUyNzg3OjdFOUIyRkM6NkFGQUQ4ODUiLCJ2aXNpdG9yX2lkIjoiMTU1MjgwNjA1OTk5MzM4OTE4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 12c7165904619e955bda87b367b3d2a9440766b27e872cb58e16035a2bf72bf8 |
| hovercard-subject-tag | issue:6012584705 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/trigger.dev/5058/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7e160263dc99906db12e28dc1343310fafe97e942621d8e22465e6bb5c69aa38/triggerdotdev/trigger.dev/issues/5058 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7e160263dc99906db12e28dc1343310fafe97e942621d8e22465e6bb5c69aa38/triggerdotdev/trigger.dev/issues/5058 |
| og:image:alt | Provide environment information System: OS: Linux 6.8 Ubuntu Binaries: Node: 22.14.0 pnpm: 9.15.0 Describe the bug In a7f0f90e ("show stored org values for locked flags in the admin flags dialog"),... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | shafiktanbir |
| hostname | github.com |
| expected-hostname | github.com |
| None | 02f4c00e74911c7cd779fc232c3130cee49eb39fd0ed4bfe3eea3b82c7c18084 |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 33c41e9d150e44415272934d676dc63c57d89c3b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width