Public: anyone can read this; the crew can change it.

"Flags are set by a forge admin." lives in one place, read by the flag action, the web page and the terminal #5609

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The sentence "Flags are set by a forge admin." is now written in one place. `src/core/flags.ts` exports it as `FLAGS_ADMIN_ONLY`, right after `mayManageFlags`. I added a new constant because no existing module held words like it.

shipped production is serving it deploy 9afb56b

opened this

The sentence "Flags are set by a forge admin." is now written in one place. src/core/flags.ts exports it as FLAGS_ADMIN_ONLY, right after mayManageFlags. I added a new constant because no existing module held words like it.

  • src/actions/flag_winner.ts, src/web/pages/flags.ts and src/tui/screens/flags.ts each import FLAGS_ADMIN_ONLY in place of the typed-out sentence. Only the import and the line with the sentence changed in each file, and the wording is the same.
  • grep -rn "Flags are set by a forge admin" src/ now finds only src/core/flags.ts.
  • The new test/flags-words.test.ts checks that the sentence is not empty. It also reads each of the three files as text and checks that it names FLAGS_ADMIN_ONLY and does not contain the sentence itself, so it fails if a copy is typed back.

Checks run: bun x tsc --noEmit is clean and bun scripts/design-lint.ts passes. bun test on test/flags.test.ts, test/flags-settings.test.ts, test/flags-timing.test.ts, test/flags-words.test.ts and test/tui-flags.test.ts passed: 24 tests across the 5 files. I did not run the full suite.

🤖 Generated with Claude Code

Closes #5593

commented

The sentence "Flags are set by a forge admin." is now written in one place. src/core/flags.ts exports it as FLAGS_ADMIN_ONLY, right after mayManageFlags. I added a new constant because no existing module held words like it.

  • src/actions/flag_winner.ts, src/web/pages/flags.ts and src/tui/screens/flags.ts each import FLAGS_ADMIN_ONLY in place of the typed-out sentence. Only the import and the line with the sentence changed in each file, and the wording is the same.
  • grep -rn "Flags are set by a forge admin" src/ now finds only src/core/flags.ts.
  • The new test/flags-words.test.ts checks that the sentence is not empty. It also reads each of the three files as text and checks that it names FLAGS_ADMIN_ONLY and does not contain the sentence itself, so it fails if a copy is typed back.

Checks run: bun x tsc --noEmit is clean and bun scripts/design-lint.ts passes. bun test on test/flags.test.ts, test/flags-settings.test.ts, test/flags-timing.test.ts, test/flags-words.test.ts and test/tui-flags.test.ts passed: 24 tests across the 5 files. I did not run the full suite.

🤖 Generated with Claude Code

Approved

Behaviour-neutral: the sentence now lives in FLAGS_ADMIN_ONLY (src/core/flags.ts) and the action, the web page and the terminal import it. The wording is unchanged, so nothing a person sees changes: the denied page and the terminal hint read the same, and there is no markup, CSS or token change. The guard test fails if a copy is typed back. The preview boots; a guest on /settings/flags gets a 303 to sign in, and I did not see the admin-only text there as a guest. Security, both doors and the design system are untouched.

Two things I would do next: (1) the test reads source as text, which is brittle to a quote-style or wrapping change, so a unit test that calls makeWinnerDefault as a non-admin and asserts message === FLAGS_ADMIN_ONLY would guard behaviour rather than spelling; (2) this is a pure tidy while the direction puts arm stability first (#4496, #4486, #3319, #4482), so keep the next pulls on those.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs