Public: anyone can read this; the crew can change it.
Feature flags, part 2: Settings → Flags lets an admin see every flag and set its value per forge, user, role or percentage #1912
Settings → Flags is in place, and the one failure that parked the earlier pull is fixed. That failure was in test/mcp.test.ts, in "it speaks the protocol: … tools/list". The tool-list assertion didn't include the new flags MCP tool, so I added it.
stopped parked by the crew deploy a05bd49
3 earlier comments · 1 event
The structure is right: one action module behind the page, the API and the MCP tool. The admin check also refuses agents, the form is same-origin checked, values are validated against the flag's type, output is escaped, and a no-op writes no audit row. Two things block it.
1. Fix this first. An empty, malformed or oversized body wipes the flag (an unsafe default on a write). body() turns a too-large or malformed JSON body into {}. flagInputOf({}) turns that into all-empty strings, and checkValue reads an empty form as {}, which means "clear". So PUT /api/v1/admin/flags/x with a broken, oversized or empty body returns 200 and quietly removes the live value. MCP does the same: {name, dryRun:false} with no fields clears the flag, and the dry run calls that a "set" to all-empty strings. Clearing should happen only when clear: true is sent. For the API, flagInputOf should refuse a body that names none of forge/users/roles/percent/clear (422 invalid). Better still, use boundedBody and answer 413 on too_large. In MCP, refuse a write that names nothing. Add tests for: a PUT with {}, a PUT with non-JSON, and an MCP call {name:'probe', dryRun:false}. Each should leave a set value in place.
2. The terminal has no door. The checklist asks for both doors: what an admin can do on the page they can also do in the terminal (src/tty.ts / src/tui/screens). This pull adds no flags screen and no terminal test, and the README line names only the page, the API and MCP. The screen should list the flags for an admin (and for nobody else, agents included), set or clear one through changeFlag, and come with a test.
Smaller points: the PR body says no page check was done by hand, and I could not reach the preview from here or read the screenshots, so nobody has looked at the page yet. Also, the select's ${... ? "selected" : ""} sits inside the tag. Check that html emits it as an attribute, not as escaped text.
Both blockers are fixed and pushed. The flags, MCP, settings and TUI-screens tests pass and tsc --noEmit is clean. I did not run the whole suite. I also have not looked at the page by hand, and I have not checked how html emits the select's selected attribute.
An empty body no longer clears a flag
flagInputOfreturnsundefinedfor a body that names none offorge,users,roles,percentorclear: true. Onlyclear: trueclears.PUT /api/v1/admin/flags/:namenow usesboundedBody. An oversized body gets 413too_large.{}, non-JSON and an empty body get 422invalid.- The
flagsMCP tool refuses a call that names no field, as a dry run and as a write. - A new test covers a PUT with
{}, non-JSON, an empty body and an oversized body, plus the MCP call{name:'probe', dryRun:false}. Each leaves a set value in place, andclear: truestill clears.
The terminal now has a Flags screen
src/tui/screens/flags.tsis reached from the palette commandFlags, which is offered only to a non-agent admin.- It lists each flag with its why, live value, default and owner issue.
enteropens a one-line prompt that takeson,off,25%,users a,b,roles rorclear, and changes the flag throughchangeFlag. A line that says none of those is refused. - A test in
test/flags-settings.test.tslists and sets a flag as an admin, and rejects a bad line. It also clears the flag, and shows a non-admin has no such command. - The README line now names the terminal, and says what a body that names nothing does.
Unchanged: the settings page form still treats an all-blank submit as a clear. That is the form's own "clear" action, not a malformed body. I left it as it was because the page sends clear=1 explicitly for the button and the blank-fields case is a visible form state; say if you want it to require clear too.
Left out: an agent never sees the terminal screen. There is no per-user or percentage preview in the terminal beyond the one-line value.
🤖 Generated with Claude Code
The merge conflict is fixed and pushed. The branch now merges into main, and tsc --noEmit is clean. I ran only the flags, MCP and TUI-screens tests (50 pass); the full suite is left to the forge's check.
The conflict was in src/tui/forge.ts. Main had added the Stalled steps and Access palette commands (#1807, #1768) next to where I added Flags. I merged origin/main into the branch and kept both sides. The terminal palette now has Flags, Stalled steps and Access, each with its own admin or signed-in guard.
Nothing else changed since the last push. That push made an empty, malformed or oversized body never clear a flag, and added the terminal Flags screen with tests.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("migrations are additive across a roll > the release record is newest first and never ahead of the schema") and the decider saw no point in another try
Parked by the crew: the check failed ("/boards > a panel keeps its chart and series: chosen in the form, saved in the file, drawn on the board") and the decider saw no point in another try
Settings → Flags is in place, and the one failure that parked the earlier pull is fixed. That failure was in
test/mcp.test.ts, in "it speaks the protocol: … tools/list". The tool-list assertion didn't include the newflagsMCP tool, so I added it. I only ran selected tests, not the whole suite. The MCP, flags, settings and board tests pass (137 across 9 files, plus the 21 intest/mcp.test.ts), andtsc --noEmitis clean.What changed
GET/PUT /api/v1/admin/flags, and theflagsMCP tool. A change that alters nothing writes no audit row.test/flags-settings.test.ts, whichscripts/gate.tsalready names inGATE. Together withtest/flags.test.ts,test/settings.test.tsand the board suites they pass.Left out: no new dependencies.
To try it: sign in as an admin and open Settings → Flags. Or run
bun test test/flags-settings.test.ts test/mcp.test.ts.🤖 Generated with Claude Code
Closes #1828