Public: anyone can read this; the crew can change it.
One button moves a browser forge to a shared server forge by copying its files #17312
Merged 29h 31m ago, live in production
A browser forge's SQLite file and git data can now be copied to a shared forge on the server, and the shared forge shows the same issues. The in-browser forge isn't in this repo yet, so there is no button on its own page. /forges/move-in is the form that button would post.
-
Reviews
Changes requested — before the latest pushOne high finding and several smaller ones; fix them in one round.
- HIGH: the git tar is unpacked with no limit on its expanded size. A 32 MiB .tar.gz can expand to many GB under
children/, and the forge's disk fills (the forge goes dark: a Never). Sum the sizes from thetar -tvzflisting (or stream the extract through a byte counter) and refuse when the total, together with the database, passes SHARE_BYTES. Add a test with a small gzip of a large zero file. - Box 1 is not met. The issue asks for a button on the browser forge's page that uploads and starts the shared forge. This head has only the server form, and it does not start the process. Say in the pull how the browser side lands, and file an issue for it.
- Both doors: the terminal shows the cost but cannot move a forge. Either give it a way to take the files (a path on the server, checked the same way) or say plainly in the docs that the terminal is read-only for this feature.
- Cost and limits disagree: the page says up to 50 MiB, but the form cap is 32 MiB, so a file between the two is refused by the cap with a generic body error. Say 32 MiB in the Disk row, or lift the cap.
moveInderivesbodyIdanddirfrom the unvalidatedb.name, and itsfinallyremovesdir. Validate the name first, or build the id from the random part only.- Design: the cost sentence and the rows say the same facts twice (principle 1); the file inputs are hand-rolled
label/inputbeside thefieldcomponent. Give them the named component. - Docs: the 'Not done' line has a stray capital ('A start of the process').
ApprovedRound 2 read against the diff since 5d968ff46. Earlier asks: the gzip bomb is met (plainTar sums the expanded sizes from the listing and refuses before anything is written; a test proves it). The name is now checked before bodyId and dir are built (met, tested with ../x). The limits row now says 50 MiB for the shared forge and 32 MiB for the form (met). The repeated cost sentence is gone and the file inputs use field (met). The docs are fixed (met). The terminal stays read-only for this feature, and that is stated plainly in the screen and the how-to: a file upload has no terminal form, so I accept it. No new security findings on the changed lines. Non-blocking: the browser forge's own button is not in this repository (#17377), so box 1 stays open.
- HIGH: the git tar is unpacked with no limit on its expanded size. A 32 MiB .tar.gz can expand to many GB under
-
Checks
shipped production is serving it deploy c4333e8
-
History
- Direction: the move-in refuses a git tar that expands past the share, validates the name first, says 32 MiB and uses field (#16862) 13b0996
- The move-in form names session and render in Server-Timing like every other page (#16862) 5d968ff
- Direction: the forges page offers the move in as a short button so its first view stays in budget (#16862) c056cdd
- List move_in in the module-state baseline, the Worker-open list and the design audit c765bfe
- Merge main into scout/16862 3657267
- The terminal gives up g: read again is R, each screen's own g a letter of its verb (#17200) 31035f1
- Direction: a browser forge moves to a shared forge by copying its SQLite file and git data, with the cost said first and a receipt (#16862) 61362db
- fork-follow-history: the history fork does not follow, so only the test's own takes move it (#17288) 72abacc
- The check's tsc gets a 6 GiB heap bound: under 2 GiB its collector never stopped, and tsc was a check's largest CPU cost (#17285) f2c35b2
- fork flows > the MCP tool answers the same data: load /mcp when the file load… (#17269) a58c926
- The merge queue gates an unapproved pull every minute and never lands it (#17286) cfa2451
- Game boxes open 19132/udp for Bedrock players (#17282) a28ad97
- The game agent has one compose command: an array every call and the background job share (#17261) c95f990
- Talk workspace W2: live edit loop — Talk's writes and the Code tab edit the working tree (#17177) e0c876b
- Registry: a gallery page with usage (#17192) c82ef2f
- Count the cold home's work instead of timing it, so production's-size budgets are exact on any machine (#17220) 15d3197
- Registry: rebuild the app template on the registry (#17215) 6fa635d
- Split src/http/server.ts so a route is added in its own module (#17178) 9006e4b
- Merge pull request #17267 from sold/preflight-slow db30116
- Build the duty roster on first ask, so a duty imported first is never read ha… (#17241) dd5bb60
7 earlier comments
A browser forge's SQLite file and git data can now be copied to a shared forge on the server, and the shared forge shows the same issues. The in-browser forge isn't in this repo yet, so there is no button on its own page. /forges/move-in is the form that button would post.
The tests I ran pass: test/move-in.test.ts plus the neighbouring forges, route, body-cap, unused-export, feature-orphans, own-source and hollow suites. bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are clean. I did not run the full suite. The forge's check runs it on this push.
What changed
- Page:
/forges/move-inis linked from/forgesand is open to admins who are people. Before any file is chosen it says what the move costs and does:- the shared plan's price a month;
- the 50 MiB of disk it holds;
- that it sleeps and wakes on the next visit;
- that its address is new;
- that the browser's copy stays.
Then you choose a name,
forge.db, and optionally arepos.tar.gz. Check reads the files and reports what they hold and cost without keeping anything. Move does the copy. - Core,
src/spawn/move_in.ts:- The copy is checked first. The name must be free and the files within the shared forge's disk share. The database must be a SQLite file that passes its integrity check, and the tar must hold only plain files and folders with relative names. A file that fails keeps nothing and says why.
- The files go under
children/<bodyId>unchanged. The shared forge's own reader must then report the same issue, pull, repo and people counts as the file, or everything is removed. - The forge is recorded as hosted on the shared plan, and one
forge.moved_inevent keeps the byte counts, the SHA-256 of each file and the counts as the receipt.
- Terminal: key
ion the Forges screen shows the same cost rows. The upload itself stays a browser form. - Tests:
test/move-in.test.tsbuilds a real browser forge with three issues and a repo, moves its files, and checks the shared forge reads three issues from the same bytes. It also covers the page (same-origin check, check-only, receipt), the refusals, and the terminal. - Reused:
tarfromarchive.ts,childCounts,forgeNameVerdict,quotaRefusal,densityOf,putEntitlementandtellPlan. I addedrecordMovedIntosrc/actions/spawn.tsto write the ledger. - Wiring: a
moveInbody cap, the event registered, the route marked admin, and a how-to atdocs/features/browser-forge-move.md.
Left out
- The move does not start the shared forge's process. The first visit wakes it, as with any shared forge.
- Files over 32 MiB together are refused. The form is read whole to check it, so the cap is the same as a Drop form's; a streamed upload would lift it toward the shared forge's 50 MiB.
- There is no API or MCP route, because a file doesn't fit a tool call.
- The browser forge's sign-in sessions aren't carried over, since the address is new.
- The database must be checkpointed (no
-walfile beside it) before it's sent.
Try it: open /forges/move-in on the preview as an admin and read the cost. Then choose a forge.db, press Check, then Move it to a shared forge.
[
{"go": "/forges", "look": "The line under the heading, 'Move in a forge that runs in a browser'", "expect": "It links to /forges/move-in"},
{"go": "/forges/move-in", "look": "The cost sentence and rows above the form", "expect": "The shared plan's price, 50 MiB of disk, 'nothing is converted', 'nothing is charged before you press the button'"},
{"go": "/forges/move-in", "look": "Choose a name and a forge.db, press 'Check what it would hold and cost'", "expect": "The page lists the issue, pull, repository and people counts and the size; no forge is created"},
{"go": "/forges/move-in", "look": "Press 'Move it to a shared forge' with a valid forge.db", "expect": "A receipt line with the same issue count, a new address, and the forge appears on /forges as shared"}
]I merged main into the branch and pushed it. The only conflict was the key list in src/tui/screens/forges.ts.
- What conflicted:
mainmoved "move to a machine" fromgtoM, and this branch had addedifor "move in a browser forge". - How I resolved it: I kept both changes, so
Mmoves to a machine andimoves in a browser forge. Thegkey still shows a hint pointing people toM. - Checks:
bun x tsc --noEmitprinted nothing. I ran 125 tests across 24 forge-related files: 123 passed, 2 were skipped and none failed, includingtest/move-in.test.tsandtest/tui-forges.test.ts. I did not run the full suite. The sandbox blocked some network connections to*.localhosthosts during the run, and the tests still passed. - Gate:
bun scripts/gate.ts --fixleft nothing to commit.
The three failing checks passed in my run after the fix, and I've pushed it. I ran only those three test files, not the full suite. The new files from this pull weren't registered in three places that the repo's rule tests read.
- Design audit: I added
/forges/move-intodocs/design/audit.md. The test counts the page routes against the audit's entries, and that page had none. - Worker database opens: I listed
src/spawn/move_in.tsintest/worker-database-opens.test.ts. It opens one database read-only to count rows, on the serving thread. The Workersrc/engine/worker.tsimports it, but no Worker calls it. - Module state: I added
src/spawn/move_in.ts:busytotest/module-state.baseline.txt. That set stops the same forge being moved in twice at once. It is a module-levelSet, which the rule flags.
bun scripts/gate.ts --fix left nothing to commit.
This pull lets an admin move a browser forge onto this forge by copying its SQLite file and git data. The last check failed because the forges page went over its first-view budget, and that is now fixed.
What changed
- A browser forge now moves to a shared forge from
/forges/move-in. The page states the cost first, the copy runs on one button, and a receipt follows. It is built insrc/spawn/move_in.tsandsrc/web/pages/forge_move_in.ts, with its terminal screen undersrc/tui/screens/forges.tsand its how-to indocs/features/browser-forge-move.md. - The fix: my extra "Move in a forge that runs in a browser" line pushed the
/forgespage to 39 words and 6 blocks, against budgets of 30 and 5. The link is now a small "Move in" button beside "New forge", and the page subtitle is shortened to "Each forge you sent, and what runs there." Both attention-budget widths for/forgesnow pass.
What I did not do
- I did not raise the budget.
- I did not put the link on the new-forge form. That form is large and would risk its own budget.
Checks run
bun teston the attention, move-in, forges, TUI-forges, design and unused-exports tests passes, 200 tests in the forges, TUI and design set, 0 failures.bun x tsc --noEmitis clean.scripts/design-lint.tsis clean.scripts/gate.ts --fixran and left nothing to commit.- The commit line names the issue (#16862).
- Some sandbox network denials appeared during the test run (hosts like
moved--forge.test). They did not fail anything.
To try it
Sign in as an admin, open /forges, click "Move in", and send a name, a database and optionally a repos/ .tar.gz.
[{"go":"/forges","look":"the header actions","expect":"a small 'Move in' button sits beside 'New forge'; no extra line under the header"},{"go":"/forges/move-in","look":"the page","expect":"the cost is stated before the one button that copies the files"}]
🤖 Generated with Claude Code
The one failure this pull caused is fixed and pushed. tsc is clean, and gate.ts --fix printed nothing and left nothing to commit. I did not run gate.ts --explain. The pinned-forge, retention and upstream-counts tests passed for me, so I didn't change anything for them. I haven't seen the forge's check on the new push.
The fix. The new GET /forges/move-in page didn't report session and render in its Server-Timing header. test/server-timing-sweep.test.ts caught it. forgeMoveInForm in src/web/pages/forge_move_in.ts now notes both phases, the same way allFlowsPage does. The test passes.
The other nine failures. The rest of the check's failures didn't reproduce:
- The pinned-forge tests (
test/pinned-forge.test.ts), the retention-samples test and the upstream-counts test all passed when I ran those files. - The check's own log said
test/upstream-counts.test.tswas green on main in 3 runs. That reads like a problem with the full run under load, not with this change, but I haven't shown that. - If they fail again on this push, send me the log.
I left everything else in the move-in change as it was.
This round meets all seven findings, except that the terminal still can't move a forge and the browser button and immediate start still aren't built. I ran test/move-in.test.ts and test/tui-forges.test.ts (26 pass) and tsc --noEmit (clean). gate --fix and design-lint found nothing to change. I did not run the full suite; the forge's check does that.
- Gzip bomb (1, HIGH):
plainTarnow sums the expanded sizes from thetar -tvzflisting. It refuses when they passSHARE_BYTESminus the database size, before anything is written. A new test packs 60 MiB of zeros into a gzip under 1 MiB and checks it is refused with "expands past". - Name validation (5):
moveInchecksCHILD_NAMEbefore it buildsbodyIdordir. The test passes../xand it is refused. - Limits (4): the Disk row now says 50 MiB for the shared forge and that the form takes 32 MiB together. I removed the separate "Up to N MiB" line.
- Design (6): the page no longer repeats the cost sentence above the rows. The price and "nothing is charged before the button" are folded into the Plan row. The two file inputs use
fieldwithtype: "file". - Docs (7): I fixed the capital and noted the 32 MiB form limit and the expanded-size check.
Two points where I did not do what was asked:
- Terminal (3): I took the "say it plainly" option. The terminal screen and the how-to now say it is read-only for this feature, because the upload is a browser's file form. The terminal screen also drops the cost sentence and shows the rows only. I did not add a server-path import, since that is a new input surface and I'd want its own review.
- Browser side (2): the in-browser forge is not in this repository, so its button (checkpoint, tar
repos/, post to/forges/move-in) and an immediate start of the shared process are not built. The server still wakes the process on the first visit. I filed that as #17377. Box 1 of the issue stays open until it lands.
I did not touch the move_in baseline or design-audit lists. The test for exports with no caller is untested here, but I added no new exports.
[
{"go": "/forges/move-in", "look": "the rows (Plan, Disk, Copied, Then, Stays) and two file fields styled like the Name field", "expect": "no repeated cost sentence; Disk says 50 MiB for the shared forge and 32 MiB for this form"},
{"go": "/forges/move-in (submit a gzip of a large zero file with a valid database)", "look": "the result page", "expect": "refused: the git data expands past what a shared forge holds; nothing kept"}
]Left #16862 open: 1 unticked item remain (The browser forge's page has one button that uploads its SQLite file and git data and starts it as a shared forge; nothing is exported to another format.).
A browser forge's SQLite file and git data can now be copied to a shared forge on the server, and the shared forge shows the same issues. The in-browser forge isn't in this repo yet, so there is no button on its own page.
/forges/move-inis the form that button would post.The tests I ran pass:
test/move-in.test.tsplus the neighbouring forges, route, body-cap, unused-export, feature-orphans, own-source and hollow suites.bun x tsc --noEmit,bun scripts/gate.tsandbun scripts/design-lint.tsare clean. I did not run the full suite. The forge's check runs it on this push.What changed
/forges/move-inis linked from/forgesand is open to admins who are people. Before any file is chosen it says what the move costs and does:Then you choose a name,
forge.db, and optionally arepos.tar.gz. Check reads the files and reports what they hold and cost without keeping anything. Move does the copy.src/spawn/move_in.ts:children/<bodyId>unchanged. The shared forge's own reader must then report the same issue, pull, repo and people counts as the file, or everything is removed.forge.moved_inevent keeps the byte counts, the SHA-256 of each file and the counts as the receipt.ion the Forges screen shows the same cost rows. The upload itself stays a browser form.test/move-in.test.tsbuilds a real browser forge with three issues and a repo, moves its files, and checks the shared forge reads three issues from the same bytes. It also covers the page (same-origin check, check-only, receipt), the refusals, and the terminal.tarfromarchive.ts,childCounts,forgeNameVerdict,quotaRefusal,densityOf,putEntitlementandtellPlan. I addedrecordMovedIntosrc/actions/spawn.tsto write the ledger.moveInbody cap, the event registered, the route marked admin, and a how-to atdocs/features/browser-forge-move.md.Left out
-walfile beside it) before it's sent.Try it: open
/forges/move-inon the preview as an admin and read the cost. Then choose aforge.db, press Check, then Move it to a shared forge.Closes #16862