Skip to content

test(dev-server): make sure that an override set again after a delete is active - #1055

Open
Trenyx wants to merge 1 commit into
launchdarkly:mainfrom
Trenyx:test/override-active-after-delete
Open

Trenyx wants to merge 1 commit into
launchdarkly:mainfrom
Trenyx:test/override-active-after-delete

Conversation

@Trenyx

@Trenyx Trenyx commented Nov 24, 2026 •

Copy link
Copy Markdown

If a change to UpsertOverride keeps the old active value, a developer who deletes an override and then sets the flag again gets the source value from the dev server. The new override does nothing, and no test fails.

This PR adds tests only. It adds one subtest (+25 lines) to TestDBFunctions in internal/dev_server/db/sqlite_test.go. It does not change library code.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

None. This PR adds only a test.

Describe the solution you've provided

The subtest runs after the existing DeactivateOverride subtest, so the override for flag-1 is inactive. It calls UpsertOverride for flag-1 with a new value. Then it makes sure that the returned override and the row from GetOverridesForProject are both active and have the new value.

I ran these checks on main e12bf55 with Go 1.27.4:

  • go test ./internal/dev_server/db/ passes with the new subtest.
  • gofmt -l and go vet report nothing for the package. I did not run golangci-lint.
  • I changed active=excluded.active to active=active in the ON CONFLICT clause of UpsertOverride. Then I ran go test ./.... The new subtest was the only new failure. TestGoldenIndexBytes in internal/symbols/r8index also fails on clean main on my machine.

Describe alternatives you've considered

None.

Additional context

None.

This test was written with Claude Code during a planted-bug run by SK @ Trenyx.


Note

Overview
Adds a subtest to TestDBFunctions in internal/dev_server/db/sqlite_test.go that runs after the existing DeactivateOverride case. It calls UpsertOverride on a previously deactivated override with a new value and asserts the returned row and GetOverridesForProject both show Active: true with the updated value.

No production code changes — this only locks in the expectation that upserting an override after deactivation turns it back on, rather than leaving it inactive so the dev server still serves source flag values.

Reviewed by Cursor Bugbot for commit 64116cc. Bugbot is set up for automated code reviews on this repo. Configure here.

… is active

The dev server deactivates an override when the user deletes it. If the
user sets the flag again, UpsertOverride must make the row active again.
No test covered this case. If the update keeps the old active value, the
dev server serves the source value, and the new override does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Trenyx
Trenyx requested a review from a team as a code owner November 24, 2026 22:31
@Trenyx
Trenyx requested review from wchieng and removed request for a team November 24, 2026 22:31
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.

1 participant