Extract the duplicated built_project/project_lock test fixture into a shared tests/common module #223
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
built_project()andproject_lock()are now byte-identical in three aura-clitest binaries —
crates/aura-cli/tests/cli_run.rs,tests/research_docs.rs, and(a near-copy,
built_fixture)tests/project_load.rs. The #218 cycle duplicatedrather than shared them, deliberately, to keep that bug fix's blast radius inside
cli_run.rs(a shared extraction would have touched two currently-green files).Rule-of-three is now tripped.
Two coupled facts make the shared extraction the right follow-up:
crates/aura-cli/tests/fixtures/demo-project/runs.cli_run.rsandresearch_docs.rsserialize their own threads via a per-binaryproject_lockMutex;
project_load.rstouchesruns/with NO lock.cross-process serialization, so a process-per-test runner (cargo-nextest) would
race the three binaries on the shared store. Under the project's
cargo test(sequential test binaries) this is dormant; it is a scaling break point.
Direction (not prescriptive)
Extract
built_project/project_lock(and theScratchGuard/ store-resethelpers) into a shared
crates/aura-cli/tests/common/mod.rsused by all threebinaries, giving the shared
runsstore one serialization home — folding therule-of-three and closing the cross-process race in one move. Consider instead
giving each binary an isolated per-binary fixture store to remove the coupling
entirely.
context: architect drift review at the #218 cycle close (dissolved-verb project
gate), 2026-07-09; classified [medium/debt] + [medium/latent].
Decision (2026-07-11, autonomous run): the shared
crates/aura-cli/tests/common/mod.rsextraction — with one correction to the framing in the issue body.Correction: the body claims the shared extraction gives the store "one serialization home — folding the rule-of-three and closing the cross-process race in one move". The second half is wrong: a
tests/commonmodule compiles into each test binary separately, so itsstatic Mutexis still per-process — three binaries under a process-per-test runner would still race on the sharedtests/fixtures/demo-project/runsstore. The extraction folds the duplication; the cross-process race stays a documented, dormant limitation (the project'scargo test --workspaceruns test binaries sequentially).Chosen: extract
built_project/project_lock/ScratchPath/ScratchGuardintotests/common/mod.rs, consumed by all three binaries;project_load.rs's near-copybuilt_fixtureunifies ontobuilt_project. The module doc states plainly that the lock serializes threads within one process only.Rejected (for now): per-binary isolated fixture stores — true cross-process isolation, but each binary would need its own copy of the demo-project crate (three fixture
cargo builds) or a test-only runs-root override on the CLI surface; that cost buys insurance against a runner the project does not use. If a process-per-test runner (cargo-nextest) is ever adopted, per-binary stores become the real fix and this issue's analysis is the starting point.Fresh evidence (2026-07-11) that the latent race is real under process-parallel runs: during an automated implementation pass on this tree, two concurrent
cargo test -p aura-cli --test cli_runprocesses (an implementer and a tree-check agent overlapping) produced flaky failures in real-data-gated tests (walkforward_dissolves_through_the_campaign_path,mc_dissolves_through_the_campaign_path,generalize_distinct_invocations_persist_distinct_campaign_documents— a different subset per run), while every sequential run of the same suite on the same tree passes. Consistent with the per-processproject_lockgiving no cross-process serialization on the sharedtests/fixtures/demo-project/runsstore.Note the boundary: per-binary isolated stores would NOT fix this variant (same binary, two processes); only per-process scratch stores or not running two
cargo testprocesses concurrently on one tree does. The shared-module extraction decided in the decision comment stands — it folds the duplication and documents the lock's per-process scope; concurrent-process execution on one tree remains out of contract.