Repository navigation
fix(feature-flags): preserve valid org flags when stored flags contain invalid values (#5058) - #5070
Conversation
|
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @MilindChatrabhuji, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
| const { valid } = parseStoredOrgFlags(orgFeatureFlags); | ||
| return { ...globalFlags, ...valid }; |
There was a problem hiding this comment.
🟡 Customer-facing flag fix lacks release note
When mergeOrgFeatureFlags restores valid overrides, customers regain dashboard features such as Logs access. This server-only fix lacks the required customer-facing release note.
Learn more
The server changes policy requires a .server-changes/ entry for a customer-visible server-only fix. OrganizationsPresenter supplies these merged flags to the dashboard, and the side menu uses them to show customer features. The PR changes only webapp files and does not include that release entry.
Example: An org has hasLogsPageAccess: true alongside an invalid realtimeBackend. After this fix, its users regain the Logs link; the release notes do not mention the change.
Recommended fix: Add a .server-changes/ Markdown file with area: webapp, type: fix, and one user-facing sentence describing the restored org feature access.
Was this helpful? React with 👍 or 👎 to provide feedback.
| @@ -1,3 +1,4 @@ | |||
| import { mergeOrgFeatureFlags } from "~/v3/featureFlags.server"; | |||
There was a problem hiding this comment.
Overview
Fixes #5058
Problem
apps/webapp/app/v3/featureFlags.server.ts,mergeOrgFeatureFlagsvalidated the entireorgFeatureFlagsJSON blob at once withvalidatePartialFeatureFlags(orgFeatureFlags as Record<string, unknown>). If an organization had even one invalid or obsolete stored flag value inOrganization.featureFlags(which admin saves intentionally preserve), the whole validation failed and dropped all of the organization's valid flag overrides, falling back entirely to global defaults.FeatureFlagsDialog.tsx:unsetFlag(key)deleted onlynext[key]without clearingderivedFlagsClearedWith(key), leaving derived grace-stamp flags likerunOpsMintKindPrevandrunOpsMintKindFlippedAtdangling in overrides.effect === "derived"grace-stamp rows into editable inputs even though they are server-computed.Solution
mergeOrgFeatureFlags, readparseStoredOrgFlags(orgFeatureFlags).validinstead of failing the entire object when an invalid flag is present.FeatureFlagsDialog.tsx:derivedFlagsClearedWith(key)insideunsetFlag.effect === "derived"flags locked (read-only) even whenunlockedis true.apps/webapp/test/storedOrgFlags.test.tsverifying that valid org feature flag overrides are preserved when an invalid flag is present in stored organization data.@algora-pbc /claim #5058