Skip to content

chore(apr-cli): untrack the generated 28 MB test.apr — and fix the race fix it was hiding - #3059

Merged
noahgift merged 2 commits into
mainfrom
chore/untrack-generated-test-apr
Sep 9, 2026
Merged

chore(apr-cli): untrack the generated 28 MB test.apr — and fix the race fix it was hiding#3059
noahgift merged 2 commits into
mainfrom
chore/untrack-generated-test-apr

Conversation

@noahgift

@noahgift noahgift commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What

crates/apr-cli/playbooks/snapshots/test.apr is generated on demand by pixel_regression.rs::test_apr_file(), which creates it only when it is missing. #3053 tracked it via git add -A crates/apr-cli. That is 28 MB of git history for a file the tests write themselves — and, worse, a present fixture means the creation path is never taken, so #3051's atomic-publish race fix was dead code.

The measurement

tree state publish_atomically result
fixture tracked + present panic!() injected at top 5 passed — the fix cannot be reached
fixture untracked + absent same panic!() 5 failed, all five reaching it — this is the #3051 race
fixture untracked + absent code as shipped 4 of 5 FAILED, rename ENOENT

The third row is a real defect that shipped green because of the second.

Root cause

The temp name was apr.tmp.{process::id()} — unique per process. #3051 was written against nextest, which gives each test its own process. Plain cargo test --test pixel_regression runs the five as threads in one process, so they shared one temp path: the first thread renamed it away and the rest died on rename with ENOENT.

Fixed with a monotonic counter beside the pid — the pid separates processes, the counter separates threads.

Gate

publish_atomically_is_unique_per_call_not_per_process gates it directly: 8 threads publish concurrently, the result must be one complete file with no temp left behind. Reverting to the pid-only name turns it RED (verified).

pixel_regression was also absent from ci.yml's --test line, so this target has never run in CI and the new gate would have been born dark. Added.

Cargo exclude already kept the fixture out of the published package, so this costs nothing at publish time and removes 28 MB from the repo.

Verification

  • cargo test -p apr-cli --test pixel_regression — 6 passed / 0 failed with the fixture absent
  • cargo fmt --all -- --check clean
  • mutation RED→GREEN proven in both directions (table above)

Refs #3051, #3053

🤖 Generated with Claude Code

https://claude.ai/code/session_018RouwmUL7vFfJyCx9qLEoH

…ce fix it was hiding

`crates/apr-cli/playbooks/snapshots/test.apr` is generated on demand by
pixel_regression.rs::test_apr_file(), which creates it only when it is missing.
#3053 tracked it via `git add -A crates/apr-cli`. 28 MB of git history for a file
the tests write themselves — and, worse, a present fixture means the creation
path is NEVER taken, so #3051's atomic-publish race fix was dead code.

Measured, on this tree:

  fixture tracked+present, `panic!()` at the top of publish_atomically
      -> 5 passed. The fix cannot be reached; any bug in it is invisible.
  fixture untracked+absent, same panic
      -> 5 failed, all five reaching publish_atomically. That is the #3051 race.
  fixture untracked+absent, panic removed (the code as shipped)
      -> 4 of 5 FAILED: rename ENOENT.

The third line is a real defect that shipped green because of the second. The
temp name was `apr.tmp.{process::id()}` — unique per PROCESS. #3051 was written
against nextest, which gives each test its own process; plain
`cargo test --test pixel_regression` runs the five as THREADS in one process, so
they shared one temp path, the first thread renamed it away, and the rest died on
`rename` with ENOENT. Fixed with a monotonic counter beside the pid: the pid
separates processes, the counter separates threads.

`publish_atomically_is_unique_per_call_not_per_process` gates it directly — 8
threads publish concurrently, the result must be one complete file with no temp
left behind. Reverting to the pid-only name turns it RED (verified).

pixel_regression was also absent from ci.yml's `--test` line, so this whole
target has never run in CI and the gate above would have been born dark. Added.

Cargo `exclude` already kept the fixture out of the published package, so this
costs nothing at publish time and removes 28 MB from the repo.

Verified: `cargo test -p apr-cli --test pixel_regression` 6 passed / 0 failed
with the fixture absent; cargo fmt clean.

Refs #3051, #3053

Pmat-Ticket: PMAT-1095
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

§13.11 rung 1 — quorum shadow verdict

S13-SHADOW pr=3059 head=d5047572c5c5aba5736add3e00aeca4b5f31acf3 verdict=REFUSE class=Q1 arm_rc=1

Shadow mode: this records a verdict and merges nothing. A refusal
to arm is not a block (§13 adds zero rows to §7) — the pull request is
exactly as green as it was.

…ion into ci.yml

scripts/tree_reader_tests.txt is DERIVED from ci.yml's `--test` line, so adding
`cargo test -p apr-cli --test pixel_regression` to it made the registry stale and
ci_test_tier.sh refused (exit 2, naming its own remedy). Regenerated with
`check_tree_reader_tests.sh --update`: 41 targets, 38 unwired.

The tier decision now resolves for this PR's diff:
  tier=quick, targets include apr-cli:--test:pixel_regression

which is the point -- without it the new race gate would run nowhere.

Pmat-Ticket: PMAT-1095
@noahgift
noahgift added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit ebc9e9d Sep 9, 2026
15 of 17 checks passed
@noahgift
noahgift deleted the chore/untrack-generated-test-apr branch September 9, 2026 08:08
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