Public: anyone can read this; the crew can change it.
A new pinned machine fetches only its pinned commit, not the whole repository… #16518
Check · Review · Land · Live done — Landed and live in production.
The pinned boot now fetches only its pinned commit at depth 1, instead of cloning the whole repository. I haven't seen it on a real deploy, so the "edge log shows seconds" part of the proof is still open. Tests and tsc --noEmit passed locally, and I ran gate.ts --fix first.
shipped production is serving it deploy 3256dd5
The pinned boot now fetches only its pinned commit at depth 1, instead of cloning the whole repository. I haven't seen it on a real deploy, so the "edge log shows seconds" part of the proof is still open.
Tests and tsc --noEmit passed locally, and I ran gate.ts --fix first. I did not run the full suite or the design lint.
What changed
src/cloud/machine.ts: the boot now runsgit init, thengit fetch -q --depth 1 <source> <version>(same 5 tries, 15 s apart), thengit checkout -q --detach FETCH_HEAD.test/pinned-harden.test.tshas a new test that the boot fetches depth 1 by commit and never runsgit clone.test/pinned-forge.test.ts,test/pinned-hetzner.test.tsandtest/own-forge.test.tswere asserting the oldcheckout --detach <sha>/git clonestrings, so I updated them to the new commands.- The ordering check in
test/own-forge.test.tsused to compare against a string that was never found, so it passed vacuously. It now compares against the real checkout command. - New
test/fetch-by-id.test.tsruns the realadvertiseRefsandserviceRpcbehindBun.serve. It checks that a depth-1 fetch of a non-tip commit by id works over protocol v0 and v2, and that an id the repository doesn't hold is refused.
Where the issue didn't match the code
- The forge's upload-pack already serves commits by id.
src/git/smart-http.tssetsuploadpack.allowAnySHA1InWant=true, which is broader thanallowReachableSHA1InWant, and I left it. Partial clones fetch blobs by id, and the fork-boundary checks inown_refs.tsrely on it (test/boundary-fork-objects.test.ts). - The "not our ref" refusal comes from a plain
git upload-packwith no-cflags. I reproduced that locally; it doesn't come from the forge's served path. - Because any id the repository holds is served, a present-but-unreachable object is not refused. My refusal test therefore covers an id the repository doesn't have.
- If you want only reachable commits served, that is a separate change and would break v0 blob fetches.
Pack pacing
- I did not exempt pinned machines from pacing. They aren't identifiable at the git door today, and the exemption that exists is only for loopback fetches (
wasInternal). - A depth-1 fetch should send a few MB instead of about 50 MB, so even at roughly 120 KiB/s that is tens of seconds rather than seven minutes. I haven't measured it.
- If it is still slow on a real boot, exempt the pinned machines' source address from
pacer.pace.
To try it: bun test test/fetch-by-id.test.ts test/pinned-harden.test.ts. To confirm the speed, boot a pinned machine and look for its git-upload-pack line in the edge log. I did not post a comment on the issue, so the pacing decision above needs to be copied there.
🤖 Generated with Claude Code
Clean. The boot interpolates only values already validated in core/pinned.ts (a 40-hex id or vN.N.N tag), so no new injection surface. A tag fetches by name at depth 1 and FETCH_HEAD peels on checkout. The retry loop wipes the checkout before each try. The tests would fail without the change, and the own-forge ordering assertion that used to pass vacuously is now real. No secrets, no new dependency, no page or terminal surface. Not seen on a real deploy: the speed proof and the pacing decision stay open, as the description says.
The pinned boot now fetches only its pinned commit at depth 1, instead of cloning the whole repository. I haven't seen it on a real deploy, so the "edge log shows seconds" part of the proof is still open.
Tests and
tsc --noEmitpassed locally, and I rangate.ts --fixfirst. I did not run the full suite or the design lint.What changed
src/cloud/machine.ts: the boot now runsgit init, thengit fetch -q --depth 1 <source> <version>(same 5 tries, 15 s apart), thengit checkout -q --detach FETCH_HEAD.test/pinned-harden.test.tshas a new test that the boot fetches depth 1 by commit and never runsgit clone.test/pinned-forge.test.ts,test/pinned-hetzner.test.tsandtest/own-forge.test.tswere asserting the oldcheckout --detach <sha>/git clonestrings, so I updated them to the new commands.test/own-forge.test.tsused to compare against a string that was never found, so it passed vacuously. It now compares against the real checkout command.test/fetch-by-id.test.tsruns the realadvertiseRefsandserviceRpcbehindBun.serve. It checks that a depth-1 fetch of a non-tip commit by id works over protocol v0 and v2, and that an id the repository doesn't hold is refused.Where the issue didn't match the code
src/git/smart-http.tssetsuploadpack.allowAnySHA1InWant=true, which is broader thanallowReachableSHA1InWant, and I left it. Partial clones fetch blobs by id, and the fork-boundary checks inown_refs.tsrely on it (test/boundary-fork-objects.test.ts).git upload-packwith no-cflags. I reproduced that locally; it doesn't come from the forge's served path.Pack pacing
wasInternal).pacer.pace.To try it:
bun test test/fetch-by-id.test.ts test/pinned-harden.test.ts. To confirm the speed, boot a pinned machine and look for itsgit-upload-packline in the edge log. I did not post a comment on the issue, so the pacing decision above needs to be copied there.🤖 Generated with Claude Code
Closes #16355