--assume-cache no-ops on Nix 2.30+ — output_paths returns bare (unprefixed) store paths #24

Closed
opened 2026-07-08 22:22:10 +03:00 by issuer-agent · 1 comment

graph.output_paths(drv) claims to return full /nix/store/… output paths, but under the versioned derivation schema (Nix 2.30+, observed schema v4) the per-output path field is BARE — e.g. 3pcn0admdqrrd0k405y9hyad4579wgb3-hello-2.12.3 with no /nix/store/ prefix (same bare-key change that affected inputDrvs). Consequences for --assume-cache (#22): substitutable_paths passes these bare paths to nix path-info --json --store <cache>, which needs full store paths, so the query returns nothing; and _parse_path_info returns full-path keys while filter_upstream_substitutable compares against the bare output_paths, so even a working query wouldn't match. Net effect: --assume-cache silently drops nothing and prints the "offline / old nix / flag mismatch" no-op warning on a fully-online, modern Nix (reproduced on the emmett NixOS closure, schema v4). The legacy schema already has full paths, so this is versioned-schema-only.

Fix: normalize output paths to full /nix/store/<basename> in output_paths (prepend the store prefix when the path is bare / doesn't start with /), so queries and set-membership are consistent. Add a regression test: output_paths on a versioned-schema drv (bare path) returns the /nix/store/…-prefixed form; and an end-to-end filter_upstream_substitutable test with bare-path outputs + a monkeypatched query that keys by full path drops the right drvs. Minor: nix path-info --json now warns "--json without --json-format is deprecated" — harmless (stdout still JSON) but worth pinning --json-format 1/2 handling later.

Discovered validating #22 on emmett.

`graph.output_paths(drv)` claims to return full `/nix/store/…` output paths, but under the versioned derivation schema (Nix 2.30+, observed schema v4) the per-output `path` field is BARE — e.g. `3pcn0admdqrrd0k405y9hyad4579wgb3-hello-2.12.3` with no `/nix/store/` prefix (same bare-key change that affected inputDrvs). Consequences for `--assume-cache` (#22): `substitutable_paths` passes these bare paths to `nix path-info --json --store <cache>`, which needs full store paths, so the query returns nothing; and `_parse_path_info` returns full-path keys while `filter_upstream_substitutable` compares against the bare `output_paths`, so even a working query wouldn't match. Net effect: `--assume-cache` silently drops nothing and prints the "offline / old nix / flag mismatch" no-op warning on a fully-online, modern Nix (reproduced on the emmett NixOS closure, schema v4). The legacy schema already has full paths, so this is versioned-schema-only. **Fix**: normalize output paths to full `/nix/store/<basename>` in `output_paths` (prepend the store prefix when the path is bare / doesn't start with `/`), so queries and set-membership are consistent. Add a regression test: `output_paths` on a versioned-schema drv (bare `path`) returns the `/nix/store/…`-prefixed form; and an end-to-end `filter_upstream_substitutable` test with bare-path outputs + a monkeypatched query that keys by full path drops the right drvs. Minor: `nix path-info --json` now warns "--json without --json-format is deprecated" — harmless (stdout still JSON) but worth pinning `--json-format 1`/2 handling later. Discovered validating #22 on emmett.
admin added the bug label 2026-07-08 22:22:53 +03:00
Owner

the versioned derivation schema (Nix 2.30+, schema v4) stores output paths bare (no /nix/store/ prefix); output_paths now normalizes them to full store paths so --assume-cache actually queries the cache and matches results. Regression tests added for bare-path normalization and end-to-end filtering. This was what made --assume-cache a no-op on modern Nix.

the versioned derivation schema (Nix 2.30+, schema v4) stores output paths bare (no /nix/store/ prefix); output_paths now normalizes them to full store paths so --assume-cache actually queries the cache and matches results. Regression tests added for bare-path normalization and end-to-end filtering. This was what made --assume-cache a no-op on modern Nix.
oleks closed this issue 2026-07-08 22:45:28 +03:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/nix-estimator#24