rented carrier: enroll-copy pushes the full 688-path closure over ssh-ng — let the target substitute stock nixpkgs from its own cache (follow-on to #698) #699

Closed
opened 2026-08-23 09:16:59 +00:00 by matou-build-agent · 2 comments

Symptom

The rented (and own-VPS) enroll-copy leg pushes the FULL toplevel closure — ~688 store paths for a fresh gateway — from the enrolling host to the target over nix copy --to ssh-ng (internal/clan/enrollment.go:838). On a cold box with no warm IDSS guest store (a bare DO NixOS rental has none — ADR 0133's primed closure lands on own-VPS/local-guest, not a broker rental), this is a real over-the-network transfer of the whole closure. Drive 20260823T085132Z measured ~0.21 paths/s, extrapolating to ~55m for all 688 paths — the fault behind #698, which had to widen the e2e enroll-copy ceiling to 90m to fit it.

Cause

copy() runs nix copy --no-check-sigs --to ssh-ng://<target> <toplevel> with NO --substitute-on-destination. Every path is sent from THIS host — including the hundreds of stock nixpkgs paths (glibc, php, nextcloud, kanidm, …) the target could fetch itself from cache.nixos.org, signed, in parallel, on its own bandwidth. Only the custom paths (the vendored pkgs.caddy.withPlugins derivation renderCaddy builds — internal/clan/frontdoor.go:294 — and the community's own config/vars) genuinely have to come from here, because cache.nixos.org never carries them (the --no-check-sigs case).

Proposed fix

Add --substitute-on-destination to the nix copy invocation (internal/clan/enrollment.go:838). The destination substitutes every path it can from its own substituters (signed, so no trust widening — the --no-check-sigs flag still covers only the unsigned custom paths that must push from here), cutting the ssh-ng transfer from ~688 paths to the handful of custom ones — minutes instead of ~55m.

Seam / test

Unit-test the invocation args at the same seam as the existing copy tests (internal/clan/enrollment_test.go, store_count_test.go): assert copy() emits --substitute-on-destination alongside --no-check-sigs. Real speedup is provable only by a rented/own-VPS drive reaching enroll-copy — the same reproduction constraint as #698.

Payoff

Lets #698's precautionary 90m enroll-copy ceilings (app/tests/e2e/journey.rented.spec.ts, journey.droplet.spec.ts) TIGHTEN sharply once a green drive confirms the smaller transfer.

Provenance

Found while ruling #698 (rented enroll-copy budget). The budget widen there is the stopgap; this is the real efficiency fix. Not protected-path work — internal/clan/ is app code.

## Symptom The rented (and own-VPS) enroll-copy leg pushes the FULL toplevel closure — ~688 store paths for a fresh gateway — from the enrolling host to the target over `nix copy --to ssh-ng` (`internal/clan/enrollment.go:838`). On a cold box with no warm IDSS guest store (a bare DO NixOS rental has none — ADR 0133's primed closure lands on own-VPS/local-guest, not a broker rental), this is a real over-the-network transfer of the whole closure. Drive `20260823T085132Z` measured ~0.21 paths/s, extrapolating to ~55m for all 688 paths — the fault behind #698, which had to widen the e2e enroll-copy ceiling to 90m to fit it. ## Cause `copy()` runs `nix copy --no-check-sigs --to ssh-ng://<target> <toplevel>` with NO `--substitute-on-destination`. Every path is sent from THIS host — including the hundreds of stock nixpkgs paths (glibc, php, nextcloud, kanidm, …) the target could fetch itself from cache.nixos.org, signed, in parallel, on its own bandwidth. Only the custom paths (the vendored `pkgs.caddy.withPlugins` derivation `renderCaddy` builds — `internal/clan/frontdoor.go:294` — and the community's own config/vars) genuinely have to come from here, because cache.nixos.org never carries them (the `--no-check-sigs` case). ## Proposed fix Add `--substitute-on-destination` to the `nix copy` invocation (`internal/clan/enrollment.go:838`). The destination substitutes every path it can from its own substituters (signed, so no trust widening — the `--no-check-sigs` flag still covers only the unsigned custom paths that must push from here), cutting the ssh-ng transfer from ~688 paths to the handful of custom ones — minutes instead of ~55m. ## Seam / test Unit-test the invocation args at the same seam as the existing copy tests (`internal/clan/enrollment_test.go`, `store_count_test.go`): assert `copy()` emits `--substitute-on-destination` alongside `--no-check-sigs`. Real speedup is provable only by a rented/own-VPS drive reaching enroll-copy — the same reproduction constraint as #698. ## Payoff Lets #698's precautionary 90m enroll-copy ceilings (`app/tests/e2e/journey.rented.spec.ts`, `journey.droplet.spec.ts`) TIGHTEN sharply once a green drive confirms the smaller transfer. ## Provenance Found while ruling #698 (rented enroll-copy budget). The budget widen there is the stopgap; this is the real efficiency fix. Not protected-path work — `internal/clan/` is app code.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=9217
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=9217 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #699 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 699,
  "status": "success",
  "commits": [
    "da21ec14e3d4de05ebd249c4c472e0601255286e"
  ],
  "changed_files": [
    "internal/clan/enrollment.go",
    "internal/clan/enrollment_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ -run TestEnroll",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/clan/enrollment.go internal/clan/enrollment_test.go",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "copy() emits --substitute-on-destination alongside --no-check-sigs": "internal/clan/enrollment.go:838 now passes both flags; asserted by TestEnroll_VMModeCopyLetsTheTargetSubstituteWhatItCan (enrollment_test.go), which fails on a revert dropping the flag",
    "unit-tested at the existing copy seam (enrollment_test.go/store_count_test.go)": "new test sits beside TestEnroll_VMModeCopyTrustsSignaturelessLocalBuild, driving the same enrollCLI double and inspecting the emitted copy Args"
  },
  "summary": "enroll-copy now passes --substitute-on-destination so the target fetches signed stock-nixpkgs paths from its own cache instead of pushing the whole ~688-path closure over ssh-ng.",
  "blockers": []
}
**close-report** for #699 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 699, "status": "success", "commits": [ "da21ec14e3d4de05ebd249c4c472e0601255286e" ], "changed_files": [ "internal/clan/enrollment.go", "internal/clan/enrollment_test.go" ], "tests": [ { "command": "go test ./internal/clan/ -run TestEnroll", "exit_code": 0 }, { "command": "gofmt -l internal/clan/enrollment.go internal/clan/enrollment_test.go", "exit_code": 0 }, { "command": "go vet ./internal/clan/", "exit_code": 0 } ], "criteria": { "copy() emits --substitute-on-destination alongside --no-check-sigs": "internal/clan/enrollment.go:838 now passes both flags; asserted by TestEnroll_VMModeCopyLetsTheTargetSubstituteWhatItCan (enrollment_test.go), which fails on a revert dropping the flag", "unit-tested at the existing copy seam (enrollment_test.go/store_count_test.go)": "new test sits beside TestEnroll_VMModeCopyTrustsSignaturelessLocalBuild, driving the same enrollCLI double and inspecting the emitted copy Args" }, "summary": "enroll-copy now passes --substitute-on-destination so the target fetches signed stock-nixpkgs paths from its own cache instead of pushing the whole ~688-path closure over ssh-ng.", "blockers": [] } ``` </details>
Sign in to join this conversation.
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#699
No description provided.