3. Snapshot
3. Snapshot¶
Result: works, exactly. A throwaway-index snapshot of a Transpire worktree captured the tracked edit and the untracked file, left out the ignored file, left the user's state byte-for-byte unchanged, and reached smaug as 4 objects (3.67 KiB) with an identical tree hash.
Setup (2026-11-22)¶
- Code:
spike/snapshot.py. Copy the real index to a temp file, then withGIT_INDEX_FILEpointing at it:git add --all,git write-tree,git commit-tree <tree> -p HEAD. - A disposable
git worktree add --detachof Transpire atorigin/main(ea646ec6b), with three changes: README.mdedited (tracked)allmyram-probe.txtcreated (untracked).venv/allmyram-ignored.txtcreated (ignored, confirmed withgit check-ignore)- Before/after record: SHA-1 of the worktree's index file,
HEAD,git status --porcelain, stash count. - Remote: a bare repo on smaug, reached with
git send-packover the experiment 1 path (tailcat forward + certificate SSH). - Verification on smaug:
rev-parse refs/jobs/exp3^{tree}, thengit archive | tar -xinto a fresh directory.
Raw results¶
| Measure | Value |
|---|---|
| Snapshot time (3,023-entry tree) | 0.19 s |
| User state before vs after | identical (diff empty) |
git diff --stat HEAD <snapshot> |
README.md, allmyram-probe.txt only |
| Ignored file in snapshot | absent |
One-time seed of origin/main (full history) |
47,709 objects, 91.5 MiB, 3.96 s |
| Snapshot push | 4 objects, 3.67 KiB, 0.08 s |
| Tree hash laptop vs smaug | 4eef9b2f… both |
| Checkout on smaug | 3,014 regular files + 9 symlinks = tree |
What we learned¶
- The snapshot method is sound and cheap. Copying the real index first means unchanged files aren't re-hashed, so 3,000 files snapshot in 0.19 s. Its only side effect is new loose objects in the repo's store.
- After a one-time seed, jobs cost kilobytes. The seed is the expensive part (91.5 MiB with full history); a runner should keep its clone between jobs, and a shallow seed is worth testing to cut that first cost.
- Git LFS breaks plain
git pushto a runner. Transpire has LFS objects in its history (468 across all commits, none in the current tree).git pushruns git-lfs's pre-push hook, which tried to upload 101 objects to the runner's (non-existent) LFS endpoint and failed the push. The spike usedgit send-pack, the plumbing undergit push, which runs no push hooks. That sidesteps the hook deliberately; it is not a fix: - For repos with LFS files in the current tree, a runner checkout would contain pointer files, not content. Tests would see wrong data.
- The product has to choose: the client ships LFS content for the snapshot's tree, or the runner fetches it from the repo's LFS server (which needs credentials the runner shouldn't hold). Either way it must detect LFS and fail loudly rather than run tests against pointers.
- zsh trap:
$VAR:rin zsh is a modifier, not a literal colon. Use${VAR}:refs/.... Cost one failed run.
What it changes¶
- The design gains an LFS section: detect LFS-tracked paths in the snapshot tree, and refuse to run (visibly) until there's a way to supply content.
- Transport for snapshots is
send-pack(or a bundle), not porcelaingit push, so user-configured push hooks don't fire against runners.