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

A forge made for a client can be sent again: a fresh link replaces the old one and the old one stops working #13181

opened this

Merged 21d 4h ago, live in production

A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (/forges/:name/claim-link, reissueClaimFor, MCP claimlink, the dead-link page), so I added the preview step and the receipt around it.

Notes

opened this

A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (/forges/:name/claim-link, reissueClaimFor, MCP claim_link, the dead-link page), so I added the preview step and the receipt around it.

What changed

  • Preview: previewReissue in src/actions/spawn.ts is read-only. It says who the link is for and that the earlier link stops at once. A claimed forge is refused, and it uses the same who-may-send gate as the reissue.
  • Client list: the row button is now Send a new link and opens the preview page. Only confirming there issues the link. Before, the row posted straight away.
  • API and MCP: POST /api/v1/forges/:name/claim-link with { "dryRun": true } returns the preview. MCP claim_link without reveal returns it too, so no new tool and no action value was added. The mcp-size test passes.
  • Receipt: the forge.claim_reissued event now also names whom the link was for and what it replaced.
  • Tests: test/forge-link-reissue.test.ts covers the preview changing nothing, the old link answering the dead-link sentence, the receipt row, API and MCP reissue, and a cross-origin post being refused. test/client-states.test.ts pins the row button as a link.
  • Docs: docs/features/forge-link-states.md describes the new flow.

Not done

  • No new access_link.ts change: it holds the personal sign-in links for a person's account, not forge claim links. A forge's link is one claim row inside the child forge, and minting a new one replaces the old in one write.
  • Old-link expiry sentence unchanged: it was already in place and tested, so I left it.
  • Terminal screen: claim_link.ts still reissues directly with no preview.

Checks and push

  • Passed: bun scripts/gate.ts, bun x tsc --noEmit, bun scripts/design-lint.ts, and the tests covering this change.
  • Pre-push hook: it asked for a Try: commit, so there is an empty one.
  • No-look line: the gate wanted a Looks: or No look: line for the src/web change. I used No look: because the page change is small.

Try it: open /forges, press Send a new link on an unclaimed forge, read the preview, and confirm. The link is shown once and the earlier one answers "this link does not work any more".

🤖 Generated with Claude Code

Closes #13166

5 earlier comments
commented

A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (/forges/:name/claim-link, reissueClaimFor, MCP claim_link, the dead-link page), so I added the preview step and the receipt around it.

What changed

  • Preview: previewReissue in src/actions/spawn.ts is read-only. It says who the link is for and that the earlier link stops at once. A claimed forge is refused, and it uses the same who-may-send gate as the reissue.
  • Client list: the row button is now Send a new link and opens the preview page. Only confirming there issues the link. Before, the row posted straight away.
  • API and MCP: POST /api/v1/forges/:name/claim-link with { "dryRun": true } returns the preview. MCP claim_link without reveal returns it too, so no new tool and no action value was added. The mcp-size test passes.
  • Receipt: the forge.claim_reissued event now also names whom the link was for and what it replaced.
  • Tests: test/forge-link-reissue.test.ts covers the preview changing nothing, the old link answering the dead-link sentence, the receipt row, API and MCP reissue, and a cross-origin post being refused. test/client-states.test.ts pins the row button as a link.
  • Docs: docs/features/forge-link-states.md describes the new flow.

Not done

  • No new access_link.ts change: it holds the personal sign-in links for a person's account, not forge claim links. A forge's link is one claim row inside the child forge, and minting a new one replaces the old in one write.
  • Old-link expiry sentence unchanged: it was already in place and tested, so I left it.
  • Terminal screen: claim_link.ts still reissues directly with no preview.

Checks and push

  • Passed: bun scripts/gate.ts, bun x tsc --noEmit, bun scripts/design-lint.ts, and the tests covering this change.
  • Pre-push hook: it asked for a Try: commit, so there is an empty one.
  • No-look line: the gate wanted a Looks: or No look: line for the src/web change. I used No look: because the page change is small.

Try it: open /forges, press Send a new link on an unclaimed forge, read the preview, and confirm. The link is shown once and the earlier one answers "this link does not work any more".

🤖 Generated with Claude Code

commented

Fixed the two client-list failures and pushed. The first-view budget test is still failing, and I did not touch it.

  • Cause: The earlier commit on this pull turned the client list's "Send a fresh link" button into a link to the preview page, /forges/<name>/claim-link. Two assertions in test/client-list.test.ts still looked for the old text and the old POST form on the row.
  • Fix: I changed those assertions to expect "Send a new link" and href="/forges/maria/claim-link". The rest of that test still posts to the endpoint, since the preview page's confirm form uses the same POST route.
  • Checked here: test/client-list.test.ts and test/forge-link-reissue.test.ts both pass (16 tests), and bun x tsc --noEmit is clean. I did not run scripts/gate.ts or the rest of the suite; the forge runs the full check on this push.
  • Not fixed: "each page stays inside its first-view budget" lives in test/attention.test.ts. The forge's log reports it red on main too, with the same tests, and not counted against this pull. I did not run it here.
  • Egress lines in the log: The maria--forge.test:443 refusals come from the test children and need no change to forge.json.
commented

The gate's 100-column comment rule failed on the merge of this pull into the newer main, so I merged main into the branch and rewrapped the comments. I pushed that as e05ae7987.

  • Why it was missed: the gate passed on my branch alone and only failed once the new main was merged in.
  • Rewrapped files: bun scripts/gate.ts --fix rewrapped comments in src/actions/spawn.ts, src/http/api/forges.ts, src/spawn/door.ts and src/web/pages/forges.ts. The gate now exits 0.
  • Checked here: bun x tsc --noEmit is clean, and 25 tests pass across test/client-list.test.ts, test/forge-link-reissue.test.ts and test/client-states.test.ts.
  • Not run: the full suite, which the forge runs on the push. test/attention.test.ts was red on main earlier and I left it alone.

The pull is still what the first two commits described. A forge's link can be sent again from the client list: the admin sees who it is for and what stops, confirms, and the new link replaces the old one and is shown once. This push changes only comment wrapping and merges main in.

commented

Sending a forge's link again now works from the terminal as well, with the same preview and confirm as the page, API and MCP. I ran the tests that touch this change and they pass, but not the whole suite. scripts/fast.ts named 2,331 files, about 197 minutes of tests, so I picked the covering ones by hand.

What changed, by review item

  1. Terminal door.
    • src/tui/screens/claim_link.ts has a shared offerNewLink: it runs previewDoor (who it is for, what stops working), then a confirm dialog "Send a new link" / "Keep the old one", and only the confirm calls reissueDoor.
    • Forges you sent has a new n key (admin only), with a picker of forges not yet claimed. The palette entry "A fresh claim link for a forge I sent" now goes through the same preview and confirm, so a forge's own sender can use it too.
    • The gate is the same as the page, because both go through previewDoor/reissueDoor: admin or the account that sent the forge.
  2. Gate tests in test/forge-link-reissue.test.ts:
    • A signed-in person who is neither admin nor sender gets 403 on the preview page, on API dryRun, and on the MCP preview. None of the responses contains the for name.
    • A claimed forge gets the "already claimed" message on the preview page and the API dryRun, and the API send is refused.
    • A terminal test covers pick, preview, confirm, and the old link dying; it also checks the old link still works before the confirm.
    • The MCP preview used to answer "Nothing changed" even when refused; it now returns the real error.
  3. forgeLinkForm: the status ternary is gone, and says is now body.says ?? body.message.
  4. reissueClaim: the constant replaced field is gone. The permission step now reads the child once with childNamed and passes it on, so there is no second read after the write. This also means a sender's ownership check now reads the child rather than the raw ledger.
  5. Docs: the stale-row paragraph in forge-link-states.md now says the button opens the preview, and there is a terminal how-to. I also changed "Send a fresh link" to "Send a new link" in the MCP hint text.
  6. Preview cost: I did not add a rate limit. The ownership check comes before the child database is opened, so a stranger costs one small ledger file read and gets a 403. Only the admin or the sender reaches the open. I left the open as it is: it is the same as the existing send path, and a read-only open of a small SQLite file. If you want it off-thread like childSubscription, that is a follow-up.

Left out: the terminal's n list is admin only, because the Forges you sent screen is admin only. A sender who is not an admin uses the palette entry instead.

To try it: bun test test/forge-link-reissue.test.ts. Or open the Forges you sent screen in the terminal, press n, pick a forge and read the preview.

🤖 Generated with Claude Code

commented

main is merged into the branch and pushed. src/spawn/door.ts was the only conflict, and it was just the import line. I kept both sides: this branch's previewReissue plus forgeNameVerdict and takenReason from main. Nothing else in the merge needed hand-resolving.

  • Gate: the merge brought in a rule against real-timer sleeps in tests, and it flagged test/forge-link-reissue.test.ts:157. I marked that line // real-timer: with the reason. It took a second push to fix because my first attempt annotated the wrong line. bun scripts/gate.ts now passes.
  • Type check: bun x tsc --noEmit is clean.
  • Tests: the diff against main was too broad for scripts/fast.ts to name tests (2696 of 3346 files), so I picked them myself. I ran the three test files this branch changes plus every spawn- and door-named test: 761 tests across 109 files, with 752 passing, 9 skipped and 0 failing. After the gate fix I re-ran only test/forge-link-reissue.test.ts, which passes (6 tests).
  • Sandbox noise: the sandbox denied outbound connections to .forge.test and --localhost hosts during the run. The tests that opened them still passed. The forge's own check runs the full suite on this push.
commented

I fixed the one failure this pull caused and pushed it. I haven't seen the forge's re-run yet.

  • forges you sent in the terminal > o switches a forge's code: this was my doing. The "send a new link" key I added made the key footer on the "Forges you sent" screen too wide. The terminal cut it off before "own code or this forge's". I shortened the labels no test pins in src/tui/screens/forges.ts: "stop one (sleep now)" is now "stop", "remove one" is "remove", "send a new link" is "new link", and "move into a sandbox" is "move". The tui-forges tests now pass (10 of 10).
  • an entry still waiting for its answer stays out of the fold and a writer queues a check: these pass when I run them alone (14 tests in flow-stale-fold and pull-check-again). The failures were not mine, but I don't know the cause. Neither is in a file this pull touches.
  • every tool's doc names each argument its inputSchema takes: the check log says this one is red on main too, so it isn't counted against this pull.

bun x tsc --noEmit and bun scripts/gate.ts --fix came back clean before the push.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs