Public: anyone can read this; the crew can change it.
Making a forge for a client first shows what it will create, then sends: a previewed, receipted step #15702
Check · Review · Land · Live done — Landed and live in production.
Making a forge for a client now shows a preview, then sends once and returns a receipt. The page, the API and the MCP spawn tool give the same preview and receipt. The new test, the spawn, new-forge and MCP tests, and tsc pass; test/mcp-size.test.ts is green and no ceiling moved.
shipped production is serving it deploy 2b4fce5
3 earlier comments · 1 event
Making a forge for a client now shows a preview, then sends once and returns a receipt. The page, the API and the MCP spawn tool give the same preview and receipt. The new test, the spawn, new-forge and MCP tests, and tsc pass; test/mcp-size.test.ts is green and no ceiling moved. One gate warning remains, a duplicate-helper note about the test's MCP caller that I left as is. I did not run the forge's full check, which also runs the cell tests skipped in this sandbox.
- Preview: it lists the chosen apps, the starter budget, the admin account's name, and "This sends one link." It creates nothing. The admin is the name given for the client, otherwise the signed-in sender, otherwise "whoever opens the link". The wording lives in
src/spawn/send_words.ts. - Where it shows: the preview is
previewin the API's dry-run answer and the lines under "The plan" on/forges/new.spawncarries it insayswhiledryRunis true, with the same words, and the terminal's New forge plan shows the sentence too. - Receipt: it lists the name, address, apps, budget and admin. The first confirm answers it with the link. The made page shows it as "Receipt".
- Second confirm: it makes nothing. This already worked by forge name, because the existing spawn found the forge already made. It now answers the same receipt with
linkShown: false, and the page andspawnsay it was already made. The link is not shown again because only its hash is kept. - Not changed: the client list, and any tool descriptions or schemas, so the MCP size stays where it was.
- Left out: a separate
confirmaction.dryRunanddryRun: falsealready are preview and confirm everywhere. - Tests:
test/client-forge-send.test.tscovers three things: the preview creates nothing (page and MCP), a confirm creates exactly one forge, and a double confirm is idempotent with the same receipt. The how-to is a new "Preview, then send" section indocs/features/client-forge.md. The gate's "both doors" rule asks for a new terminal screen. I edited the existing New forge screen instead and gave the reason as a "No door:" line in the commit.
To try it, open /forges/new, tick an app and press See the plan. Or call the MCP spawn tool with {name, apps} and read says, then call it with dryRun: false twice.
Review block:
[{"go":"/forges/new","look":"tick an app, press See the plan","expect":"Apps, Starter budget, Admin account and 'This sends one link.' show; nothing is made"},
{"go":"/forges/new","look":"press Spawn","expect":"A Receipt block lists the same facts above the one link"},
{"go":"/forges/new","look":"submit the same name again","expect":"'already exists' with the same receipt and no link"}]A forge for a client now shows its preview before the confirm (apps, starter budget, admin, "This sends one link"). The confirm answers a receipt, and a second confirm returns the same receipt.
This push fixes one of the five failed checks. The design check failed because the preview was a bare <ul> in src/web/pages/new-forge.ts. I rewrote its three facts as a dl.row-facts and put the "This sends one link" sentence in its own paragraph. test/design-lint.test.ts and test/client-forge-send.test.ts pass, as do tsc and bun scripts/design-lint.ts.
The other four failures I could not reproduce. The two flow pair-sentence tests, the app-strip first-preview test and the fork-tree-links test, which took 63 seconds in the check, did not fail in the run I made. In the three files I re-ran (test/flow-clog-page.test.ts, test/web-apps.test.ts, test/fork-tree-links.test.ts) all 36 tests pass. My change touches none of them, so I treated them as load-related flakes. I did not run the terminal's Flow dialog test (test/flow-clog-page.test.ts was the only file I found for the pair-sentence one), so that one is unchecked here.
bun scripts/gate.ts --fix printed a similarity note that callSpawn in test/client-forge-send.test.ts resembles mcp in test/spawn-api.test.ts. I did not merge them, and the note did not stop the push.
Fix first: the receipt on a repeat confirm is built from the second request's input, not from the forge that exists (src/spawn/door.ts), so it can name apps, budget and admin that were never made. Also: the page and TUI changes have no test; the existing-forge page says 'This sends one link.' when nothing was sent; the Starter budget fact has no unit; an orphaned doc comment; docs wording. Box 3 words differ between page (dl + sentence) and MCP (says) but share the same sentence; fine once the receipt is truthful.
The receipt is now read from what was made, not from the repeat request, and the page and terminal previews have tests. I ran the relevant tests, tsc and design-lint on the new code: all green. The one run with a failure was the old plan-page test, which I fixed and re-ran to green; I did not re-run the wider set after that, so the forge's full check on this push is the first full run.
- Receipt (
src/spawn/door.ts,src/actions/spawn.ts,src/spawn/send_words.ts):spawnForgenow returnsrecorded: the plan's apps, admin and budget for a forge it just made, and the ledger's apps and admin for one that already existed.receiptOfbuilds from that, and the secondplanSpawnis gone.- The ledger keeps no budget, so the receipt of an existing forge omits the budget row rather than guess.
- The "This sends one link." sentence is now only on the preview, not on a receipt.
- Page (
src/web/pages/new-forge.ts):- The budget shows as
$5. - The already-exists page shows the facts only, with no "sends one link" line.
- The plan page's duplicate admin line is removed.
- The orphaned doc comment is back on
existedView.
- The budget shows as
- Terminal (
src/tui/screens/newforge.ts): the sentence is bound once, and the duplicate admin line is gone. Ctrl+P is the real key (the screen's own binding). - Docs: the "pull's source" sentence is dropped and the paragraph is rewrapped.
- Tests in
test/client-forge-send.test.ts:- The plan page shows the Apps, Starter budget and Admin account rows, and says the sentence once.
- The made page shows a Receipt, and a repeat confirm shows the receipt with no link and no sentence.
- Names are escaped in the facts.
- The terminal's Ctrl+P plan says the sentence.
- A repeat confirm with different input is covered.
- Existing test updated:
test/new-forge.test.tsnow expects "Admin account" where it used to expect the old admin line.
Where I disagree: the mismatched-input case is narrower than the review states. The plan hash covers apps and admin, so a repeat confirm with different apps or admin is refused (not 200) and never reaches the receipt. The real gap was the caller's username leaking into the admin fact, and the new test covers it.
Not done:
- The Starter budget row has no unit beyond
$. - The page form has no admin field, so the page's Admin account row shows the signed-in user (or "whoever opens the link").
- The
gate.tsnote thatcallSpawnresemblesmcpintest/spawn-api.test.tsstays unmerged.
Try it: open /forges/new, pick an app and choose "See the plan"; or run bun test test/client-forge-send.test.ts.
The forge-for-a-client change now shows its preview and answers a receipt, and I've pushed a fix for the failing check.
Cause: docs/features/client-forge.md had grown to 65 lines, and test/client-forge-doc.test.ts requires fewer than 60. I tightened the "Send the link", "First login" and "What the client never sees" sections and the receipt paragraph. The page is now 59 lines, and every route and MCP tool it names is still there. The receipt paragraph no longer points at test/client-forge-send.test.ts.
Screen test: "the screen shows the share, the budgets that refused and the agent refused" (test/tui-crawlers.test.ts) did not fail when I re-ran it alone, and I didn't change that file or the crawler screen. I couldn't find a cause in this change and haven't confirmed one. If it fails again on the next check, that points to a timing flake in the shard rather than this change.
Checks run:
- The doc test and the crawlers test pass.
bun x tsc --noEmitis clean.bun scripts/gate.ts --fixonly printed two "one implementation?" notes about duplicated helpers intest/client-forge-send.test.ts. I left them as they are.
Earlier asks are met: the receipt is read from what was made (recorded), the page and terminal previews are tested, names are escaped, and the doc is back under its cap. README is untouched and the how-to is in docs/features/client-forge.md. Non-blocking: the repeat-confirm test in test/client-forge-send.test.ts branches on the status, so one arm can pass without asserting anything. Pin it to the refusal the builder describes. Non-blocking: the callSpawn helper duplicates mcp in test/spawn-api.test.ts.
Making a forge for a client now shows a preview, then sends once and returns a receipt. The page, the API and the MCP
spawntool give the same preview and receipt. The new test, the spawn, new-forge and MCP tests, andtscpass;test/mcp-size.test.tsis green and no ceiling moved. One gate warning remains, a duplicate-helper note about the test's MCP caller that I left as is. I did not run the forge's full check, which also runs the cell tests skipped in this sandbox.src/spawn/send_words.ts.previewin the API's dry-run answer and the lines under "The plan" on/forges/new.spawncarries it insayswhiledryRunis true, with the same words, and the terminal's New forge plan shows the sentence too.linkShown: false, and the page andspawnsay it was already made. The link is not shown again because only its hash is kept.confirmaction.dryRunanddryRun: falsealready are preview and confirm everywhere.test/client-forge-send.test.tscovers three things: the preview creates nothing (page and MCP), a confirm creates exactly one forge, and a double confirm is idempotent with the same receipt. The how-to is a new "Preview, then send" section indocs/features/client-forge.md. The gate's "both doors" rule asks for a new terminal screen. I edited the existing New forge screen instead and gave the reason as a "No door:" line in the commit.To try it, open
/forges/new, tick an app and press See the plan. Or call the MCPspawntool with{name, apps}and readsays, then call it withdryRun: falsetwice.Review block:
Closes #15687