Repository navigation
tools: resolve replay lists before entering arm directories - #725
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The supported finding is a non-blocking gap in cleanup-test coverage.
Non-blocking
⚠ Test the final output-owner cleanup: tools/nightly/selftest.sh:62 extracts only the allocation block and its initial EXIT trap.
The final tools/gate-batch.sh:6433 trap is never executed by these tests; removing its output_dir_drop call cannot affect their results.
Exercise that trap on normal completion and teardown failure. Match the PR body's 20/20 claim to the resulting run; the current output-only suite contains 18 checks.
Checked
Duplicates: gate-batch and batch-replay share output_dir_take/output_dir_drop in tools/nightly/units.sh.
Complexity: no Rust code changed.
Silent failure: allocation errors return nonzero; replay verdicts consume private arm receipts.
Tests: static inspection confirms that the final cleanup mutant leaves the extracted test fragments unchanged. Tests were not rerun during validation.
Gates: no existing pins, thresholds or cases moved or removed.
Escape catalog: no C1–C4 match in the reviewed changes.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
출력 폴더를 두 실행이 동시에 쓰면 로그와 결과가 서로 덮어써지고 실패한 검사가 통과로 보일 수 있어서, 폴더마다 소유자를 한 명만 두도록 도구를 고쳤습니다.
Part of #565. Tracked in #699.
What and why
Three tools write their results into an output directory that two runs could end up sharing, and one of them also loses its input list. This PR gives each run its own output directory and keeps each run's result out of reach of other runs.
tools/contrib-check.shnamed its log directory after the second it started in. Two runs in the same second shared oneplan.tsv, so a run that asked for a deliberately failing unit (CONTRIB_INJECT_FAIL=1) could have its plan replaced by the other run and report success. The directory now comes frommktemp -d, so it istarget/contrib-check/<time>.<unique>/.tools/gate-batch.shonly refused an--outdirectory oncerun.logexisted. Two batches started together could both get past that check before either wrote the file, then overwrite each other's logs and claims. The default directory has the same race when two batches start in one second, so it also comes frommktemp -dnow. An explicit--outis reserved through a newoutput_dir_takeandoutput_dir_droppair intools/nightly/units.sh, which takes the directory with an atomicmkdirof.run-ownerand releases it on exit. A leftover marker from a killed run is refused, not guessed stale.tools/batch-replay.shjudged each arm by reading$OUT/<arm>.rc, a public file in a directory another invocation could write to. If its own arm had ended badly, a successrcfile from another run could make it report success. It now keeps its verdict in its private work directory and only copies the receipts to--outfor the reader. It also reserves--outthrough the same owner pair and refuses an output that already holds an arm, a log or a receipt, including a dangling symlink.tools/batch-replay.shaccepted a relativeLISTpath, checked it, then changed into each arm's work directory, where the same relative path points somewhere else or nowhere. The list is now made absolute right after it is checked. The usage line and header comment now list--out DIR, which the script already accepted.docs/contrib/local-check.mdand the header comments describe the new log directory names.The output owner lives in one place,
tools/nightly/units.sh, and bothgate-batch.shandbatch-replay.shcall it.tools/ref/lease.shkeeps its own temporary directory because that one only captures output and is not an output namespace.Release notes: Fixed:
contrib-check,gate-batchandbatch-replayno longer share output directories between concurrent runs, andbatch-replayaccepts a relative list path.Code shape
tools/nightly/units.sh, called by both runners.<time>-only directory and the public.rcverdict path are removed.cargo fmtandcargo clippyare clean on what I touched: not applicable, the diff has no Rust files.bash -nand ShellCheck results are below.Duplication found or removed (
path:line), or "none": none.What I ran
Environment: an x86_64 Linux host, bash, python3. The change is host shell tooling with no GPU, model or kernel path, so no GPU gate applies.
tools/nightly/selftest.shgained a--output-onlymode that runs the real directory-allocation and receipt blocks from the three scripts and exercises them with two concurrent runs, an existing output, a dangling symlink and an arm that ended badly beside foreignrcfiles.Before the fix, on the base tree:
Nine of them fail there: the same-second
contrib-checkrequested failure, the automaticgate-batchdirectory, the single owner forgate-batchand forbatch-replay, both existing-output refusals, both dangling-symlink refusals, the arm that ended badly next to foreignrcfiles, and the relative list path.After the fix, on this head:
The same self-test also covers the gaps the touched scripts already had: an injected failure in the
gate-batchteardown must reach the exit code, andbatch-replaymust keep its resource table and its budget detection for both a current and an older base. Each guard is also tested against a copy with that branch removed, and the test catches the removal.ShellCheck 0.11.0 reports five warnings (SC2163, SC1010 twice, SC2034 twice) on the base tree and the same five on this head. Compared by file, source line, caret, code and message, ignoring line numbers in the headers, this PR adds none.
I did not run the full
contrib-checkor the workspace cargo checks, because the diff touches no Rust.Hardware (if the change is for a machine)
Not applicable. The change is host shell tooling only.
What I ran into
This does not block the PR. The five ShellCheck warnings above exist on main already and are unchanged here.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.