re-measure whether ADR 0133's warm gateway closure still buys anything once the destination substitutes #1772

Closed
opened 2026-09-23 15:09:32 +00:00 by ben · 4 comments
Owner

Per ADR 0272 (docs/adr/0272-the-target-fetches-its-own-bytes-the-installer-carries-only-the-pre-gateway-bootstrap.md, landed 180b4975), "What this does not decide".

ADR 0133 carried the release's gateway closure (gateway-cache/ + gateway-warm.toplevel, ~330 MiB) because a 2026-08-07 measurement found a cold store cost "490 paths will be fetched (328.9 MiB download, 779.4 MiB unpacked)" plus 49 derivations built, and none of it was per-community.

The 2026-09-23 founding measured something that casts doubt on the remaining value: of the 347-path delta the deploy pushed, 255 paths / 4.15 GB were signed and substitutable from cache.nixos.org, and only 6 MB was genuinely local. If the destination substitutes, most of what Tier 1 warms may be reachable from the public cache anyway.

Ask

Measure, don't argue. For the current release's gateway closure:

  1. How many paths and how many bytes are substitutable from cache.nixos.org versus must be built? (nix path-info --json over the closure, splitting on signatures, is what produced the 255/92 split above; nix build --dry-run gives the build-vs-fetch line directly.)
  2. Of the must-build set, how much is expensive — anything in the class of the installer base's static CPython — versus cheap config-derived leaves?
  3. On that evidence: does Tier 1 (warming the operator's own store, internal/toolchain/prime.go:318-325, internal/founding/toolchain.go:166-190) still earn its ~330 MiB, now that it only helps the private path where the operator's machine is the builder? Does Tier 2 (the closure baked into the guest image, system.extraDependencies)?

Report the numbers on this ticket. If the answer is that it no longer earns its place, say so and file the removal; if it does, say which parts and why, so ADR 0133 can be amended precisely rather than wholesale.

No production access needed — this is a local measurement against the flake.

Per ADR 0272 (`docs/adr/0272-the-target-fetches-its-own-bytes-the-installer-carries-only-the-pre-gateway-bootstrap.md`, landed `180b4975`), "What this does not decide". ADR 0133 carried the release's gateway closure (`gateway-cache/` + `gateway-warm.toplevel`, **~330 MiB**) because a 2026-08-07 measurement found a cold store cost *"490 paths will be fetched (328.9 MiB download, 779.4 MiB unpacked)"* plus 49 derivations built, and none of it was per-community. The 2026-09-23 founding measured something that casts doubt on the remaining value: of the 347-path delta the deploy pushed, **255 paths / 4.15 GB were signed and substitutable from cache.nixos.org**, and only 6 MB was genuinely local. If the destination substitutes, most of what Tier 1 warms may be reachable from the public cache anyway. ## Ask Measure, don't argue. For the current release's gateway closure: 1. How many paths and how many bytes are **substitutable from cache.nixos.org** versus **must be built**? (`nix path-info --json` over the closure, splitting on `signatures`, is what produced the 255/92 split above; `nix build --dry-run` gives the build-vs-fetch line directly.) 2. Of the must-build set, how much is expensive — anything in the class of the installer base's static CPython — versus cheap config-derived leaves? 3. On that evidence: does Tier 1 (warming the **operator's own** store, `internal/toolchain/prime.go:318-325`, `internal/founding/toolchain.go:166-190`) still earn its ~330 MiB, now that it only helps the private path where the operator's machine is the builder? Does Tier 2 (the closure baked into the guest image, `system.extraDependencies`)? Report the numbers on this ticket. If the answer is that it no longer earns its place, say so and file the removal; if it does, say which parts and why, so ADR 0133 can be amended precisely rather than wholesale. No production access needed — this is a local measurement against the flake.

swarm-claim host=matou-dev-server-01 run=30959
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=30959 (automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=31006
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=31006 (automated multi-host claim — lowest live claim id works this ticket)

Measurement — ADR 0133's warm gateway closure vs destination substitution

Local measurement against the flake, 2026-09-23, no production access. Method:
rendered the release's warm community repo (go run ./cmd/warm-repo, node
gateway, the same renderer scripts/build-gateway-warm.sh uses), built its
system.build.toplevel, then queried cache.nixos.org narinfo for every one
of the 653 closure paths
(the definitive substitutability test — see the note
on the signature method below).

Toplevel measured: nixos-system-gateway-26.11.20260612.173d0ad
(/nix/store/9zdig1z7vidh9xhn0gs8szndd7qgn6f2-…), built in 2m03s on a
partly-warm store.

Q1 — substitutable from cache.nixos.org vs must-build

paths nar size
Total closure 653 1483.2 MiB
Substitutable from cache.nixos.org (narinfo 200) 598 (91.6%) 1255.2 MiB (84.6%)
Must build (narinfo 404) 55 (8.4%) 228.0 MiB

(nix build --dry-run on the same partly-warm store agreed on the direction:
290 paths will be fetched (337.1 MiB), 281 derivations will be built — but a
dry-run only reports the delta from the current store, so the per-path
narinfo query above is the store-independent truth.)

Caveat on the signature method the ticket suggested: splitting the closure
on signatures gave 249 "unsigned" paths, not 55. That count is an artefact
of this measurement re-building 281 derivations locally — a locally-built path
carries no cache.nixos.org signature even when the exact same path is
served by the public cache. The 2026-09-23 founding's 255/92 split was measured
the same way on a machine that had just built the delta, so it over-counts
"local" for the same reason. The narinfo query above is not fooled by it.

Q2 — of the 55 must-build paths, expensive vs cheap

Top must-build paths by nar size:

nar size path what it is
196.02 MiB …-source the nixpkgs source tree (469 MB on disk — has pkgs/, nixos/, lib/). Not a build; a source copy.
26.78 MiB initrd-linux-6.18.35 cpio+zstd assembly — seconds, not a compile
4.79 MiB system-path symlink-union — seconds
0.19 MiB nixos-system-gateway-… the toplevel activation script
< 0.5 MiB total the other 51 paths NixOS activation config leaves: unit-*.service, etc-*, firewall-start, users-groups.json, hosts, nix.conf, system-units, tmpfiles.d, …

There is no expensive build in the must-build set — nothing in the class of
the installer base's static CPython (46 CPU-min LTO).
The single largest
must-build entry, the 196 MiB nixpkgs source, is not a build at all, and it is
already handled: #1803 (65ac06e2, "the target prefetches the pinned flake
sources itself so the 205 MB nixpkgs source stops pushing from the operator's
laptop") moved exactly this off the wire. Excluding it, the genuine local build
is 54 paths / 32 MiB — the initrd assembly, system-path, and cheap
config-derived leaves that build in seconds regardless of any warm cache.

Q3 — does Tier 1 / Tier 2 still earn its ~330 MiB?

ADR 0133 (2026-08-07) justified the ~330 MiB carriage on two things: "~330 MiB
of downloads AND 49 derivations built"
being the bulk of the stand-up's wall
clock, none of it per-community. Both halves have since evaporated:

  • The build half is gone. What was "49 derivations built" is now 54 paths /
    32 MiB of cheap assembly + config leaves, none expensive. The warm cache
    spares the operator no meaningful compute.
  • The download half is served by cache.nixos.org. 598/653 paths (84.6% of
    the bytes) substitute directly from the public cache. Tier 1 pre-seeds into
    the operator's store a closure that the operator's own nix build will
    substitute from cache.nixos.org anyway — over the same link the 330 MiB
    payload was itself downloaded over. On bytes it is roughly a wash; on compute
    it now saves nothing.

Tier 1 (internal/toolchain Primer; internal/founding/toolchain.go) —
per ADR 0272 it now helps only the private path where the operator's machine is
the builder. On that path it pre-seeds ~1255 MiB the operator would otherwise
fetch once from cache.nixos.org, and spares ~32 MiB of seconds-long assembly.
It no longer earns ~330 MiB of installer.

Tier 2 (system.extraDependencies baked into the guest image) — ADR 0272
gave the deploy leg --substitute-on-destination, so the guest fetches stock
nixpkgs from cache.nixos.org itself at datacentre speed. Baking the closure into
the image pre-seeds paths the guest now substitutes directly; only the ~32 MiB
of genuine local builds ever needed to cross from the operator. Tier 2's
premise — "push only the per-community delta because the guest is warm" — is
superseded by the guest substituting the delta's stock-nixpkgs 84.6% itself.

Verdict

Neither Tier 1 nor Tier 2 earns its ~330 MiB any longer. The expensive-build
justification is gone entirely (must-build is 32 MiB of cheap leaves once
#1803's nixpkgs source is excluded); the download justification is answered by
cache.nixos.org substitution (598/653 paths) on the operator's store and, at the
destination, by ADR 0272's --substitute-on-destination. This confirms ADR
0272's "What this does not decide" suspicion with hard numbers.

Filed the removal as #1804 (Tier 1 + Tier 2 plumbing + a precise ADR 0133 amendment), per the ask. This ticket is the measurement;
the removal is its own slice so ADR 0133 is amended precisely rather than
wholesale.

## Measurement — ADR 0133's warm gateway closure vs destination substitution Local measurement against the flake, 2026-09-23, no production access. Method: rendered the release's warm community repo (`go run ./cmd/warm-repo`, node `gateway`, the same renderer `scripts/build-gateway-warm.sh` uses), built its `system.build.toplevel`, then queried **cache.nixos.org narinfo for every one of the 653 closure paths** (the definitive substitutability test — see the note on the signature method below). Toplevel measured: `nixos-system-gateway-26.11.20260612.173d0ad` (`/nix/store/9zdig1z7vidh9xhn0gs8szndd7qgn6f2-…`), built in **2m03s** on a partly-warm store. ### Q1 — substitutable from cache.nixos.org vs must-build | | paths | nar size | |---|---:|---:| | **Total closure** | 653 | 1483.2 MiB | | **Substitutable from cache.nixos.org** (narinfo 200) | **598 (91.6%)** | **1255.2 MiB (84.6%)** | | **Must build** (narinfo 404) | **55 (8.4%)** | 228.0 MiB | (`nix build --dry-run` on the same partly-warm store agreed on the direction: `290 paths will be fetched (337.1 MiB), 281 derivations will be built` — but a dry-run only reports the delta from the current store, so the per-path narinfo query above is the store-independent truth.) **Caveat on the signature method** the ticket suggested: splitting the closure on `signatures` gave 249 "unsigned" paths, *not* 55. That count is an artefact of this measurement re-building 281 derivations locally — a locally-built path carries no `cache.nixos.org` signature even when the exact same path **is** served by the public cache. The 2026-09-23 founding's 255/92 split was measured the same way on a machine that had just built the delta, so it over-counts "local" for the same reason. The narinfo query above is not fooled by it. ### Q2 — of the 55 must-build paths, expensive vs cheap Top must-build paths by nar size: | nar size | path | what it is | |---:|---|---| | **196.02 MiB** | `…-source` | **the nixpkgs source tree** (469 MB on disk — has `pkgs/`, `nixos/`, `lib/`). Not a build; a source copy. | | 26.78 MiB | `initrd-linux-6.18.35` | cpio+zstd **assembly** — seconds, not a compile | | 4.79 MiB | `system-path` | symlink-union — seconds | | 0.19 MiB | `nixos-system-gateway-…` | the toplevel activation script | | < 0.5 MiB total | the other 51 paths | NixOS activation config leaves: `unit-*.service`, `etc-*`, `firewall-start`, `users-groups.json`, `hosts`, `nix.conf`, `system-units`, `tmpfiles.d`, … | **There is no expensive build in the must-build set — nothing in the class of the installer base's static CPython (46 CPU-min LTO).** The single largest must-build entry, the 196 MiB nixpkgs `source`, is not a build at all, and it is **already handled**: #1803 (`65ac06e2`, "the target prefetches the pinned flake sources itself so the 205 MB nixpkgs `source` stops pushing from the operator's laptop") moved exactly this off the wire. Excluding it, the genuine local build is **54 paths / 32 MiB** — the initrd assembly, `system-path`, and cheap config-derived leaves that build in seconds regardless of any warm cache. ### Q3 — does Tier 1 / Tier 2 still earn its ~330 MiB? ADR 0133 (2026-08-07) justified the ~330 MiB carriage on two things: *"~330 MiB of downloads AND 49 derivations built"* being the bulk of the stand-up's wall clock, none of it per-community. **Both halves have since evaporated:** - **The build half is gone.** What was "49 derivations built" is now 54 paths / 32 MiB of cheap assembly + config leaves, none expensive. The warm cache spares the operator *no meaningful compute*. - **The download half is served by cache.nixos.org.** 598/653 paths (84.6% of the bytes) substitute directly from the public cache. Tier 1 pre-seeds into the operator's store a closure that the operator's own `nix build` will substitute from cache.nixos.org anyway — over the same link the 330 MiB payload was itself downloaded over. On bytes it is roughly a wash; on compute it now saves nothing. **Tier 1** (`internal/toolchain` Primer; `internal/founding/toolchain.go`) — per ADR 0272 it now helps only the private path where the operator's machine is the builder. On that path it pre-seeds ~1255 MiB the operator would otherwise fetch once from cache.nixos.org, and spares ~32 MiB of seconds-long assembly. **It no longer earns ~330 MiB of installer.** **Tier 2** (`system.extraDependencies` baked into the guest image) — ADR 0272 gave the deploy leg `--substitute-on-destination`, so the guest fetches stock nixpkgs from cache.nixos.org itself at datacentre speed. Baking the closure into the image pre-seeds paths the guest now substitutes directly; only the ~32 MiB of genuine local builds ever needed to cross from the operator. **Tier 2's premise — "push only the per-community delta because the guest is warm" — is superseded by the guest substituting the delta's stock-nixpkgs 84.6% itself.** ### Verdict Neither Tier 1 nor Tier 2 earns its ~330 MiB any longer. The expensive-build justification is gone entirely (must-build is 32 MiB of cheap leaves once #1803's nixpkgs `source` is excluded); the download justification is answered by cache.nixos.org substitution (598/653 paths) on the operator's store and, at the destination, by ADR 0272's `--substitute-on-destination`. This confirms ADR 0272's "What this does not decide" suspicion with hard numbers. Filed the removal as **#1804** (Tier 1 + Tier 2 plumbing + a precise ADR 0133 amendment), per the ask. This ticket is the measurement; the removal is its own slice so ADR 0133 is amended precisely rather than wholesale.

close-report for #1772 — status success

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

envelope
{
  "issue": 1772,
  "status": "success",
  "commits": [],
  "changed_files": [],
  "tests": [
    {
      "command": "nix build .#warm-gateway-toplevel (rendered warm repo) then nix path-info -r --json + cache.nixos.org narinfo per path",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Q1 substitutable vs must-build (paths + bytes)": "comment on #1772: 653 paths/1483 MiB total; 598 paths/1255 MiB (84.6%) substitutable from cache.nixos.org narinfo; 55 paths/228 MiB must-build. Signature-method caveat recorded.",
    "Q2 must-build expensive vs cheap": "comment on #1772: zero expensive builds; 196 MiB is the nixpkgs `source` tree (#1803 already handles it), remainder is 26.78 MiB initrd assembly + 4.79 MiB system-path + <0.5 MiB config leaves = ~32 MiB cheap once source excluded.",
    "Q3 verdict on Tier 1 / Tier 2 + file removal or amend precisely": "comment on #1772 concludes neither tier earns ~330 MiB (build half trivial, download half served by cache.nixos.org + ADR 0272 --substitute-on-destination); removal filed as #1804."
  },
  "summary": "Measured the release's warm gateway closure: 598/653 paths (84.6% of bytes) substitute from cache.nixos.org and the must-build set is ~32 MiB of cheap leaves with zero expensive compiles, so ADR 0133 Tier 1/Tier 2 no longer earn their ~330 MiB; reported the numbers on #1772 and filed the removal as #1804.",
  "reason": "Measurement/spike ticket: deliverable is the findings report (posted to #1772) plus the filed removal (#1804); no code change to main was in scope.",
  "blockers": [],
  "no_code_change": "This is a local-measurement spike (ADR 0272 'What this does not decide'). The ask was to report numbers on the ticket and file the removal if warranted; both done — findings comment on #1772, removal issue #1804. The removal itself is deliberately a separate slice so ADR 0133 is amended precisely rather than wholesale."
}
**close-report** for #1772 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1772, "status": "success", "commits": [], "changed_files": [], "tests": [ { "command": "nix build .#warm-gateway-toplevel (rendered warm repo) then nix path-info -r --json + cache.nixos.org narinfo per path", "exit_code": 0 } ], "criteria": { "Q1 substitutable vs must-build (paths + bytes)": "comment on #1772: 653 paths/1483 MiB total; 598 paths/1255 MiB (84.6%) substitutable from cache.nixos.org narinfo; 55 paths/228 MiB must-build. Signature-method caveat recorded.", "Q2 must-build expensive vs cheap": "comment on #1772: zero expensive builds; 196 MiB is the nixpkgs `source` tree (#1803 already handles it), remainder is 26.78 MiB initrd assembly + 4.79 MiB system-path + <0.5 MiB config leaves = ~32 MiB cheap once source excluded.", "Q3 verdict on Tier 1 / Tier 2 + file removal or amend precisely": "comment on #1772 concludes neither tier earns ~330 MiB (build half trivial, download half served by cache.nixos.org + ADR 0272 --substitute-on-destination); removal filed as #1804." }, "summary": "Measured the release's warm gateway closure: 598/653 paths (84.6% of bytes) substitute from cache.nixos.org and the must-build set is ~32 MiB of cheap leaves with zero expensive compiles, so ADR 0133 Tier 1/Tier 2 no longer earn their ~330 MiB; reported the numbers on #1772 and filed the removal as #1804.", "reason": "Measurement/spike ticket: deliverable is the findings report (posted to #1772) plus the filed removal (#1804); no code change to main was in scope.", "blockers": [], "no_code_change": "This is a local-measurement spike (ADR 0272 'What this does not decide'). The ask was to report numbers on the ticket and file the removal if warranted; both done — findings comment on #1772, removal issue #1804. The removal itself is deliberately a separate slice so ADR 0133 is amended precisely rather than wholesale." } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1772
No description provided.