clan: the locked-input prefetch runs ON the box — --store ssh-ng:// fetched on the operator's machine and pushed anyway (GOTCHAS #343) #1865

Merged
ben merged 1 commit from session/prefetch-on-the-box into main 2026-09-25 04:31:18 +00:00
Owner

Fire 5 (drive 20260925T040123Z, #1855) was the first live run of #1862. I sampled bens-mac-04's traffic during enroll-copy, and it shows the prefetch never ran on the box:

While running Mac download Mac upload
nix flake prefetch --store ssh-ng://root@<box> https://releases.nixos.org/…/nixexprs.tar.xz?narHash=… ~1.5 MB/s ~60 kB/s
immediately after ~0.5 MB/s ~380 kB/s, pushing the unpacked 196 MiB source

Cause. --store names where the result lands. Nix's fetchers run in the client process. So #1803's github prefetch, and #1862's tarball extension of it, only moved the push. They never removed it.

Fix.

  • prefetchInputsOnTarget runs ssh ssh://<box> nix … flake prefetch '<ref>' through the adapter's existing sshRun seam. The ref is single-quoted for the remote shell. It uses the same host-key posture and keepalives as the ssh-ng copy.
  • It is opt-in through a new WithOnTargetPrefetch() option, which the operator app's wiring_prod.go sets. Seam tests that don't opt in never shell out, which mirrors WithRemoteResolverWarmup.
  • Verified by hand on fire 5's box. A github ref and a tarball ?narHash= ref each realised the lock's exact /nix/store/…-source.

Tests.

  • TestPrefetch_RunsOnTheBoxOverItsOwnSSHDoor and TestPrefetch_OffUnlessWiredOn failed before the fix and pass after it.
  • The build-on-target test now asserts the on-box prefetch runs before the apply.
  • The two superseded operator-side prefetch tests are retired. The lock-reading tests stay.
  • internal/... and app/helper are green, and vet and golangci-lint are clean.

This adds GOTCHAS #343 and a STATUS entry. Fire 6 proves it live.

Refs #1855

🤖 Generated with Claude Code

https://claude.ai/code/session_013h5C35beyRQMAA1QjxZGk7

Fire 5 (drive `20260925T040123Z`, #1855) was the first live run of #1862. I sampled bens-mac-04's traffic during `enroll-copy`, and it shows the prefetch never ran on the box: | While running | Mac download | Mac upload | |---|---|---| | `nix flake prefetch --store ssh-ng://root@<box> https://releases.nixos.org/…/nixexprs.tar.xz?narHash=…` | ~1.5 MB/s | ~60 kB/s | | immediately after | ~0.5 MB/s | ~380 kB/s, pushing the unpacked 196 MiB source | **Cause.** `--store` names where the result lands. Nix's fetchers run in the client process. So #1803's github prefetch, and #1862's tarball extension of it, only moved the push. They never removed it. **Fix.** - `prefetchInputsOnTarget` runs `ssh ssh://<box> nix … flake prefetch '<ref>'` through the adapter's existing `sshRun` seam. The ref is single-quoted for the remote shell. It uses the same host-key posture and keepalives as the ssh-ng copy. - It is opt-in through a new `WithOnTargetPrefetch()` option, which the operator app's `wiring_prod.go` sets. Seam tests that don't opt in never shell out, which mirrors `WithRemoteResolverWarmup`. - **Verified by hand on fire 5's box.** A github ref and a tarball `?narHash=` ref each realised the lock's exact `/nix/store/…-source`. **Tests.** - `TestPrefetch_RunsOnTheBoxOverItsOwnSSHDoor` and `TestPrefetch_OffUnlessWiredOn` failed before the fix and pass after it. - The build-on-target test now asserts the on-box prefetch runs before the apply. - The two superseded operator-side prefetch tests are retired. The lock-reading tests stay. - `internal/...` and `app/helper` are green, and vet and golangci-lint are clean. This adds GOTCHAS #343 and a STATUS entry. Fire 6 proves it live. Refs #1855 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013h5C35beyRQMAA1QjxZGk7
clan: the locked-input prefetch runs ON the box — --store ssh-ng:// fetched on the operator's machine and pushed anyway (GOTCHAS #343)
All checks were successful
ci / seam (pull_request) Successful in 10m37s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been skipped
1f2440fb36
Fire 5 (20260925T040123Z) sampled bens-mac-04 during #1862's prefetch:
the nixpkgs tarball downloaded here at ~1.5 MB/s, then the 196 MiB source
pushed at ~380 kB/s. `nix flake prefetch --store ssh-ng://<box>` names
where the result lands; the fetcher runs on the client.

prefetchInputsOnTarget now runs `nix flake prefetch '<ref>'` on the box via
sshRun, behind WithOnTargetPrefetch (set in the operator app's wiring so
seam tests never shell out). Verified by hand on fire 5's box for a github
ref and a tarball ?narHash= ref.

Refs #1855

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013h5C35beyRQMAA1QjxZGk7
ben merged commit 91743cf6a8 into main 2026-09-25 04:31:18 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss!1865
No description provided.