Skip to content

feat: Re-land local flag overrides using dev server, with filter reset fix - #851

Open
nieblara wants to merge 2 commits into
mainfrom
cursor/reland-local-flag-overrides-9ca3
Open

nieblara wants to merge 2 commits into
mainfrom
cursor/reland-local-flag-overrides-9ca3

Conversation

@nieblara

@nieblara nieblara commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

This PR re-lands #837 and fixes the UI bug that caused its revert in #850.

Commits

  1. A revert of the revert commit 9197f92 from fix: Add local flag overrides using dev server (#837) #850. This brings back the full change from feat: Add local flag overrides using dev server #837: local flag overrides, the "local" chip, the "Only show local flags" filter, and the greyed out overrides filter.
  2. A fix for the UI bug.

The bug

#837 removed the useEffect that reset the filter state in internal/dev_server/ui/src/Flags.tsx. The checkboxes showed onlyShowOverrides && overridesPresent, but the stored state never reset. Only "Remove all overrides" cleared it.

Steps to see the bug:

  1. Tick "Only show flags with overrides".
  2. Remove the last override with "Remove override".
  3. Add a new override.

The filter turned on again and hid other flags. "Only show local flags" had the same problem.

The fix

Two effects in Flags.tsx reset each filter when it no longer applies:

  • onlyShowOverrides resets when no overrides exist.
  • onlyShowLocal resets when no local flags exist. The effect skips this reset while flags is not loaded yet.

The effects watch the data, not one handler. They cover removeOverride, "Remove all overrides", and any other change to overrides, such as an update from outside the component.

Tests

src/__tests__/Flags.test.tsx has four new tests. They use a stateful wrapper and a mocked fetch.

  • Overrides filter: remove the last override with the button, then add one by toggling a flag. The filter stays off and all flags show.
  • Overrides filter: clear the overrides from outside the component, then add one.
  • Local filter: remove the last local flag with the button, then add a new local override.
  • Local filter: clear the overrides from outside the component, then add a local override.

I ran the tests without the fix. All four new tests failed because the other flags were hidden. With the fix, all 13 tests pass.

What I ran

  • go build ./...: passed.
  • go test ./internal/dev_server/...: passed.
  • In internal/dev_server/ui: npm ci, npm test -- --run (13 passed), npm run lint, npx tsc -b, and npm run build all passed.
  • internal/dev_server/ui/dist/index.html is rebuilt and committed.

I did not change anything outside this re-land and fix.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 5, 2026 21:08
The filter state stayed set after the last override went away. A new
override then turned the filter on again and hid other flags. Two
effects now reset each filter when its condition is false.

Add tests for both filters.

Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>
@nieblara
nieblara marked this pull request as ready for review October 6, 2026 03:37
@nieblara
nieblara requested a review from a team as a code owner October 6, 2026 03:37
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.

2 participants