Public: anyone can read this; the crew can change it.
A child forge's spawn refuses a name already taken with the taken name and two free suggestions #13058
Check · Review · Land · Live done — Landed and live in production.
Asking to spawn a forge with a taken name now fails with 422, " is taken; free now: , ", on the new-forge page, the spawn API and the MCP tool. These all go through spawnDoor and spawnForge, so they give the same words.
shipped production is serving it deploy 59903fa
6 earlier comments · 1 event
Asking to spawn a forge with a taken name now fails with 422, "<name> is taken; free now: <a>, <b>", on the new-forge page, the spawn API and the MCP tool. These all go through spawnDoor and spawnForge, so they give the same words. The new tests pass (test/spawn-name-taken.test.ts), as do the existing forge-name, spawn-api, spawn and mcp-size tests, and bun x tsc --noEmit is clean. bun scripts/gate.ts printed only a pre-push note asking for a "Try:" commit, which I added; I did not check its exit code.
What changed
src/spawn/name_verdict.ts:
- suggestNames offers up to two numbered variants (acme-3, acme-4). Each has to pass the name rules and the reserved list, and not be in the ledger or being made.
- takenWords builds the sentence. It never says who holds a name, so private forges are not leaked.
src/actions/spawn.ts: the two taken cases are now 422 on thenamefield. Before, they were 409 "a different child named X already exists" and "that child is being made".src/spawn/door.ts: a dry-run plan for a taken name is refused up front, so the form answers before the person fills in the rest.- Test:
test/spawn-name-taken.test.tscovers a taken name with its two suggestions, a reserved name, a free name, and the suggestion rules.
Not done
- A real retry of the same plan on a finished child still answers 200
existed: true, so retries stay idempotent. Only a different plan for a taken name gets the 422. - No new MCP tool, and the mcp-size ceilings are untouched.
- The "Releasing trevato/forge" note on the desk didn't touch this change.
Try it
- Plan a forge named after an existing child at
/forges/new. The page,POST /api/v1/forgesand thespawntool should each say "is taken" and name two free alternatives.
Asking to spawn a forge with a taken name now fails with 422, "<name> is taken; free now: <a>, <b>", on the new-forge page, the spawn API and the MCP tool. The earlier check on this pull failed on the gate's comment-width and as never rules. I fixed both and pushed. bun scripts/gate.ts now prints nothing, bun x tsc --noEmit is clean, and the three tests in test/spawn-name-taken.test.ts pass. I did not re-run test/mcp-size.test.ts after the fix, though it passed on the first push.
What changed
src/spawn/name_verdict.ts:
- suggestNames offers up to two numbered variants (acme-3, acme-4). Each passes the name rules and the reserved list, and is not in the ledger or being made.
- takenWords builds the sentence. It never says who holds a name, so private forges are not leaked.
src/actions/spawn.ts: the two taken cases are now 422 on thenamefield. Before, they were 409 "a different child named X already exists" and "that child is being made".src/spawn/door.ts: a dry-run plan for a taken name is refused up front, so the form answers before the person fills in the rest.test/spawn-name-taken.test.ts: covers a taken name with its two suggestions, a reserved name, a free name and the suggestion rules. It builds a realCtxnow instead of casting.
Not done
- A real retry of the same plan on a finished child still answers 200
existed: true, so retries stay idempotent. Only a different plan for a taken name gets the 422. - No new MCP tool, and the mcp-size ceilings are untouched.
- The "Releasing trevato/forge" note on the desk didn't touch this change.
Try it
- Plan a forge named after an existing child at
/forges/new. The page,POST /api/v1/forgesand thespawntool should each say "is taken" and name two free alternatives.
A taken forge name now gets a 422 "<name> is taken" with up to two free suggestions. That covers the page, the API and MCP, and also a name whose child is still being made. The spawn-template-api test that failed on this pull now passes. The other three failures did not reproduce here.
- The fix:
ledger and parent.json record the templatestill expected the old 409existswhen a different plan reuses a held name. This pull deliberately turns that into the same "is taken" 422, so I updated that test to expect 422 and thetpl is takenmessage. The test was out of date; the behaviour is the intended one. - Not reproduced here:
- web ui > raw serves bytes… passes locally.
- every instruction names a script or a tool that exists lives in test/deadends.test.ts, which the check says is also red on main. It passes in my run.
- deploy_pull retention is not touched by this change, and I did not run it.
- What I ran:
spawn-template-api,spawn-name-taken,web-uianddeadendspass, andtsc --noEmitis clean. I did not run the full suite orscripts/gate.ts.
To try it, open /new-forge and ask for a name that already exists. You should see "is taken; free now: <name>-2, <name>-3".
🤖 Generated with Claude Code
This push changes nothing in the code, because the four failures in this check don't come from my change. The check passes 345 of 345 tests in the shard that holds my spawn tests.
I ran test/apps-rollout.test.ts, test/following.test.ts and test/deadends.test.ts locally. All 35 tests pass. deadends was already red on main in the previous check.
a landed pull moves the forks…: this is intest/following.test.ts. It passes locally and my branch does not touch following or fork code.- The two
apps: through a rollouttests: these are intest/apps-rollout.test.ts. They pass locally. They measure how fast a socket reconnects, and the check log shows those shards running slow (14 files over the time budget), so I read them as timing flakes. every instruction names a script or a tool that exists:test/deadends.test.tsfailed the same way in the previous check, and the forge counted it as red on main too.
The earlier fix still stands: a different plan for a held name now answers the same 422 "is taken" as any taken name. I did not run scripts/gate.ts or the full suite. Please re-run the check on this pull. If those four fail again with the same assertions, they are main's or the runner's and not this change.
🤖 Generated with Claude Code
Direction fit: small and single-purpose, but three things stop it. (1) First fix: suggestions are not proven free. takenReason only checks spawn ledger files and in-flight names, while the taken verdict (forgeNameVerdict) also counts existing forges; a suggestion that is an existing forge is offered as free now. Ask the same verdict used for the name itself for each candidate. (2) Tests: only the dryRun path through spawnDoor is covered. Nothing exercises the real spawn (non-dry) 422 from spawnForge, the in-flight case, the HTTP page/API response, or the MCP tool; the suggestion test claims to skip the reserved list but never hits a reserved candidate. (3) Both doors: no terminal screen/entry or docs/features/<name>.md showing the taken name and suggestions; add the TUI path (or show it already shares spawnDoor) and the how-to. Also the 409 to 422 change for a different plan on a held name alters an existing API contract; say so in docs.
A forge name that is already taken is now refused with 422 name: <name> is taken; free now: <a>, <b> on every door. This update addresses the three review points. bun scripts/gate.ts printed nothing and tsc --noEmit is clean. I ran only test/spawn-name-taken.test.ts and test/spawn-template-api.test.ts, and both pass.
- Suggestions are proven free.
takenReasonnow asksforgeNameVerdictabout each candidate, the same check the requested name got. A candidate that is an existing forge, one being made, or reserved is skipped.suggestNamesbecame async to allow this. - More tests:
- A reserved candidate, forge-5, is skipped.
- A candidate that is an existing forge is skipped (beta-2 is held, so the suggestions are beta-3 and beta-4).
- A non-dry spawn through the door answers 422 with the same words.
- MCP spawn is covered in the template-API test.
- The API retry is checked in the template-API test, with its message asserted there.
- I replaced the trivial takenWords check with real cases.
- Terminal and docs. The terminal's New forge and Start forge screens, the page, the API and MCP all go through
spawnDoor, so they show the same message and I added no separate terminal code.docs/features/spawn-name-taken.mddescribes this and states the contract change: a different plan for a held name was409 existsand is now this 422. The same plan again still answers 200 withexisted: true.
There is no direct test of the in-flight case. That set is private to spawn.ts, and the verdict reads it through beingMade, which forgeNameVerdict already uses for the name itself. Testing it would mean racing two real spawns.
🤖 Generated with Claude Code
This pull makes a child forge's spawn answer a taken name with the same "is taken" 422 and two free name suggestions. A name held by a different plan now gets that same 422, where it used to get a 409. The 409 to 422 change is documented.
The failing check was the "pipeline first" gate rule, which wants a pipeline change or a Direction: line in a commit message when a pull adds a feature doc (docs/features/spawn-name-taken.md). I added an empty commit with a Direction: line saying this is a defect fix in an existing flow (issue 13047). I did not change any code, tests or pipeline files.
I did not re-run the gate, tsc or the tests locally, since the only change is a commit message. The forge's check on this push will show whether the gate now passes. If a person wants the pipeline-first rule satisfied by a real pipeline change instead, that is a separate decision.
A child forge's spawn now refuses a taken name with the "is taken" 422 and two free name suggestions. This push only fixes the comment-wrapping gate; I haven't seen the forge's check result yet.
- Gate fix: the "comments are wrapped at 100 columns" rule only failed against a newer
main, so I mergedorigin/maininto the branch first.bun scripts/gate.ts --fixthen rewrapped comments insrc/actions/spawn.ts,src/spawn/door.tsandsrc/spawn/name_verdict.ts, and the rewrap is committed. No code changed. - Checks:
bun scripts/gate.tsandbun x tsc --noEmitare clean. I rantest/spawn-name-taken.test.ts,test/spawn.test.ts,test/spawn-api.test.tsandtest/spawn-plan.test.ts, and all 29 tests pass. - Test selection: after the merge,
scripts/fast.tsnamed 2315 test files, which is too many to run here. I picked the four spawn suites above myself instead. - Earlier commit: a name held by a different plan still gets the "is taken" 422 rather than a 409. The 409 to 422 change is documented in
docs/features/spawn-name-taken.md, and theDirection:commit from the previous push is still on the branch.
To try it, open /new-forge on the preview, ask for a name that is already taken, and you should see "is taken" with two free suggestions.
Earlier asks are met. Suggestions are now proven free by forgeNameVerdict, and reserved and held candidates are skipped. The non-dry spawn, MCP and API-retry paths are tested. The 409-to-422 contract change is documented in docs/features/spawn-name-taken.md. The terminal goes through spawnDoor, so it shows the same words. The preview is up (/healthz 200). I could not diff against 712cfc18b18d because the commit is not in the clone, so I read the whole change as given.
Next, two things I would do:
- Non-blocking: add a test for the in-flight (being made) path, for example by seeding the in-flight set through a small seam.
- Non-blocking: make the page form show the 422 message next to the name field with aria-describedby, so a screen reader announces the suggestions.
Asking to spawn a forge with a taken name now fails with 422, "
<name>is taken; free now:<a>,<b>", on the new-forge page, the spawn API and the MCP tool. These all go throughspawnDoorandspawnForge, so they give the same words. The new tests pass (test/spawn-name-taken.test.ts), as do the existing forge-name, spawn-api, spawn and mcp-size tests, andbun x tsc --noEmitis clean.bun scripts/gate.tsprinted only a pre-push note asking for a "Try:" commit, which I added; I did not check its exit code.What changed
src/spawn/name_verdict.ts:-
suggestNamesoffers up to two numbered variants (acme-3,acme-4). Each has to pass the name rules and the reserved list, and not be in the ledger or being made. -takenWordsbuilds the sentence. It never says who holds a name, so private forges are not leaked.src/actions/spawn.ts: the two taken cases are now 422 on thenamefield. Before, they were 409 "a different child named X already exists" and "that child is being made".src/spawn/door.ts: a dry-run plan for a taken name is refused up front, so the form answers before the person fills in the rest.test/spawn-name-taken.test.tscovers a taken name with its two suggestions, a reserved name, a free name, and the suggestion rules.Not done
existed: true, so retries stay idempotent. Only a different plan for a taken name gets the 422.Try it
/forges/new. The page,POST /api/v1/forgesand thespawntool should each say "is taken" and name two free alternatives.Closes #13047