Skip to content

fix(webapp): read valid stored org flags key-by-key in mergeOrgFeatureFlags - #5059

Closed
shafiktanbir wants to merge 1 commit into
triggerdotdev:mainfrom
shafiktanbir:fix/org-feature-flags-merge
Closed

shafiktanbir wants to merge 1 commit into
triggerdotdev:mainfrom
shafiktanbir:fix/org-feature-flags-merge

Conversation

@shafiktanbir

@shafiktanbir shafiktanbir commented Oct 24, 2026 •

Copy link
Copy Markdown

Closes #5058

Follow-up to a7f0f90e (#5052): mergeOrgFeatureFlags in apps/webapp/app/v3/featureFlags.server.ts was still calling validatePartialFeatureFlags(orgFeatureFlags), so if an org had one invalid stored flag value (which the admin save routes now preserve when untouched), the whole parse failed and all valid org overrides were dropped for resolveOrganizationFeatureFlags callers.

Switched mergeOrgFeatureFlags to use parseStoredOrgFlags(orgFeatureFlags).valid so valid overrides still apply key-by-key. Also updated FeatureFlagsDialog so derived grace-stamp flags stay locked when "Unlock read-only flags" is checked, unsetFlag clears derivedFlagsClearedWith(key) in the draft preview, and unlocked resets when reopening the dialog.

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Added unit tests for mergeOrgFeatureFlags in apps/webapp/test/storedOrgFlags.test.ts covering mixed valid/invalid/unknown org flags and non-object inputs.


Changelog

Parse stored org feature flags key-by-key in mergeOrgFeatureFlags and keep derived grace-stamp flags locked in FeatureFlagsDialog.

Image

@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: aa67ce2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @shafiktanbir, 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.

@github-actions github-actions Bot closed this Oct 24, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

? validatePartialFeatureFlags(orgFeatureFlags as Record<string, unknown>)
: ({ success: false } as const);
return { ...globalFlags, ...(parsed.success ? parsed.data : {}) };
return { ...globalFlags, ...parseStoredOrgFlags(orgFeatureFlags).valid };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 User-visible flag fix lacks release note

When mergeOrgFeatureFlags restores valid overrides, members see different navigation and sidebar options. This server-only user-facing fix has no required release note.

Learn more

Organization flags feed the member-facing navigation and account sidebar. This fix changes those views for organizations whose stored flags contain both valid and invalid values. The server changes policy requires a release note for a user-facing, server-only bug fix.

Example: An organization stores hasLogsPageAccess: true alongside an invalid realtimeBackend. Members regain the Logs navigation entry after this change, but receive no release note describing the fix.

Recommended fix: Add a .server-changes/ Markdown file with area: webapp, type: fix, and a one-line user-facing description of restored organization flag behavior.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: mergeOrgFeatureFlags drops all valid org feature flags when one stored flag is invalid

1 participant