Skip to content

Wait for pending derivations before checking validity - #61

Open
jacobmichels wants to merge 1 commit into
mainfrom
jacob/tecnix-provenance-write-race
Open

Wait for pending derivations before checking validity#61
jacobmichels wants to merge 1 commit into
mainfrom
jacob/tecnix-provenance-write-race

Conversation

@jacobmichels

@jacobmichels jacobmichels commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Why

macOS CI on main fails in flakes / provenance after the test clears its store and restores a package from a binary cache. The provenance check, which checks how the package was built, reports that it cannot recreate the package's .drv file (its build recipe).

A validity lookup can race with an asynchronous recipe write. The write clears the cached metadata, but an earlier lookup can finish afterward and cache a stale “missing” result. Waiting only before the final validity check is too late.

Change

Wait for any queued write in AttrCursor::forceDerivation() before the first validity lookup. Keep the existing regeneration path for recipes that are genuinely absent.

Add a deterministic regression test that completes a write between a missing-path lookup and the caching of its result. It uses a temporary local store and a controlled write schedule, without threads or sleeps. The test reproduces the same error before the fix and passes afterward.

Checks

  • nix develop -c meson compile -C build
  • nix develop -c meson test -C build --no-rebuild --print-errorlogs nix-expr-tests eval-cache provenance
  • nix develop -c ./maintainers/format.sh

Local checks run on Linux. macOS confirmation remains with CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant