Repository navigation
tests: sj-vs-clef's own data directory, gate-bound's FIFO self-test and executable fixtures written in a child, so main's PR check passes - #557
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix defect remains in the fixture and self-test changes.
Non-blocking
⚠ Retain the fixture-race reproducer: crates/placement/src/placement/need_hook.rs:245.
The body describes a concurrent writer probe, but the diff does not retain it. Keep the probe under tools/ while it is available, so future ETXTBSY failures can be reproduced without rebuilding the GPU crates.
Checked
Duplicates: the new self-test wrapper delegates to the existing owner. Dryer reported 0 pairs in the scanned crates. The short fixture writers span separate crates; sharing them adds elements.
Complexity: crapper flagged no function. Added branches select self-test failure injection; no hot path changes.
Silent failure: writer and setup failures reach assertions or named exits. Reader output assertions cover the ignored reader status.
Tests, by inspection: dropping the retry at tools/gate-bound.sh:259 breaks the retry assertions. Changing -ge to -gt at tools/gate-bound.sh:264 lets the give-up case run its command and breaks its assertions. Dropping the command invocation at tools/gate-bound.sh:215 breaks the output/started assertions.
Tests, by inspection: removing the export at tools/ref/sj-vs-clef.sh:714 exposes the poisoned reference files to the run-status assertions. The video writer preserves raw path bytes and its warm-up run; all three writers check the child's status.
Gates: no bound or threshold moved. The FIFO case replacement carries a dated PIN and platform-specific failure evidence.
Escape catalog: C1–C4 checked; no matching failure path. The wrapper calls the renamed original, without recursion.
Notes
Dryer did not scan crates/gpu-gates; its changed helper was checked by Grep.
Validator checks were static; no test runs were repeated. The PR reports host fixture runs but no GPU-gate output.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_serve_start.rs and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 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. |
main의 PR check(contrib-check t0)를 빨갛게 만들던 테스트 결함 세 가지를 함께 고칩니다. sj-vs-clef self-test는 자기 빈 데이터 디렉터리를 쓰고, gate-bound의 FIFO self-test는 실제 신호 시험과 재시도 정책 시험을 따로 보며, 실행 스크립트를 만드는 테스트 fixture는 자식 프로세스가 스크립트를 씁니다.
What and why
The PR check,
contrib-check t0, fails on upstream main because of three test defects, and this PR fixes all three. Two are self-tests insidecheck-recipes: run 39454031746 on6661aad8ends withcheck-recipes: rc 1. The third is a race in three Rust test fixtures that write a shell script and then run it. On main,need_hook's tests failed 269 of 500 parallel runs with "Text file busy".The three fixes ship together because each one alone leaves t0 red. With only the self-test fixes (
8a30632e),check-recipespasses buttest-bloomery-placementstill fails with rc 101. With only the fixture fix,check-recipesstill fails. The change touches tests, self-tests and test fixtures only. Product code paths and every time bound stay as they are.1. sj-vs-clef's stub tests read the caller's data (
60a999d2)tools/ref/sj-vs-clef.sh --self-testreads reference rows for its stub tables from the default data path (/root/bloomery-data). On Python 3.12, a runner that cannot read that path raisesPermissionError, and 11 of the 116 checks fail. With Python 3.14.4 the same self-test passes even without the fix, so the failure depends on the runner's Python.tools/ref/sj-vs-clef.sh: the self-test exportsBLOOMERY_DATAas an emptydatadirectory inside its own temp directory, so the stub tables never read the caller's rows.tools/ref/card-tests/run.sh: the existing self-test call now inherits aBLOOMERY_DATAwhose reference files hold invalid JSON. The file names come from the existinge2e.SUITESlist. If the isolation is removed, the self-test fails andcheck-recipesreports it.Before and after, Python 3.12.12: 11 of 116 checks FAILED, then 116 checks ok.
2. gate-bound's FIFO cases assumed a signal breaks the open (
8a30632e)The
fifo-eintrandfifo-giveupcases intools/gate-bound.sh --self-testassumed that a trapped USR1 always makes the blocking open of a FIFO's write end fail. With Bash 5.3.9 on Linux it does not. When a reader comes, the first open goes on and the command runs, so no retry happens (fifo-eintr-retried: got [0]). With no reader, the open keeps waiting until the case's own 10 s bound ends it with rc 143 instead of 74. The retry and rc 74 branches inboundedare correct; the test could not reach them on this platform.The self-test now checks two things separately:
fifo-signalkeeps the real case. A USR1 goes to the runner while its open waits, then the reader starts. The case checks that the trap ran, the reader got the command's output, the command ran and the status is 0.fifo-eintrandfifo-giveuptest the retry policy. Inside the test runner only, a wrapper around the existing__bounded_runreturns a failed open (noBOUNDED_RANmark) a set number of times and then calls the real function. The test holds both ends of the FIFO open, so the result no longer depends on how the platform blocks. The existing checks stay: one retry and then the command runs, the give-up named with rc 74 and nothing started, and a bad try count refused with 64.No product code gained a test mark or branch. The comment above the case carries
PIN(2026-10-21):with the reason.Before and after, Bash 5.3.9:
gate-bound self-test: FAIL (4 failures), thengate-bound self-test: ok (0 failures).3. Executable fixtures race with concurrent spawns (
88a09ba2)Three fixtures write a shell script from the test process and then run it:
tests::stubincrates/placement/src/placement/need_hook.rs,tests::fake_toolincrates/serve/src/video.rsandhook_scriptincrates/gpu-gates/src/bin/gate_serve_start.rs. If another thread spawns a child while the script is open for writing, the child inherits the write descriptor and holds it until its own exec. Meanwhile the kernel refuses to exec the script with ETXTBSY ("Text file busy").O_CLOEXECdoes not prevent this, because the inherited copy closes only at the child's exec, and closing the descriptor in the parent leaves that copy open.In
gate_serve_start, the normal path joins its hashing thread before the hook step. Whenimages()returns an error, though,hf()returns before the join andguarded()goes on to the next clause, so the thread'ssha256sumspawn can overlap the hook script write.Each fixture now has a short
/bin/shchild write the script and exit, so the test process never holds a write descriptor on it. The parent waits for the child, checks its exit status and then sets the mode.need_hook.rs: the helper asserts on the writer's spawn and exit status.video.rs: the child creates the file withmktemp, which makes it exclusively with mode 0600, writes it and prints the path. The parent reads the path back as raw Unix bytes, so it does not assume UTF-8. This removes the parent's write, the PID and counter file name and the loop that retried the warm-up run up to 500 times on ETXTBSY. Mode 0700, theTempFilecleanup and the single warm-up run stay.gate_serve_start.rs: a spawn error or a writer that exits nonzero comes back as aGateError. The hook text and mode 0755 are unchanged.The fix adds no retry, sleep or test serialization.
Before and after, 500 runs with 16 test threads each:
need_hook269 of 500 failed, then 0 of 500 failed. The gate writer went from 312 of 500 failed to 0 of 500 failed, and the video writer with its retry turned off failed 496 of 500 before the fix.Release notes: Under the hood: the sj-vs-clef and gate-bound self-tests pass on Python 3.12 and Bash 5.3 on Linux, and test fixtures no longer fail at random with "Text file busy" when they run a script they just wrote
Code shape
e2e.SUITES, the retry wrapper reuses__bounded_runthroughdeclare -f, and the FIFO helper is the existingeintr_case. The three fixture writers follow one pattern but stay in their own crates. The workspace has no test utility crate, and each caller returns a different type (PathBufwith a panic,TempFile,GateError), so a shared helper would add a cross-crate dependency only for fixtures.PIN(2026-10-21):line for the replaced platform assumption, as the template asks for a re-pin. The fixture comment states that only the writer child opens the script for writing.cargo fmtwith the pinned rustfmt andgit diff --checkare clean on the fixture commit. I did not runcargo clippy.Duplication found or removed (
path:line), or "none": the three fixture writers (need_hook.rs:241,video.rs:1324,gate_serve_start.rs:325), kept separate for the reason in the first box.What I ran
Unless a line says otherwise, the runs used a Linux x86_64 host.
sj-vs-clef
On the PR check, run 39454031746 on upstream main
6661aad8failscheck-recipeswith both self-test causes:sj-vs-clef.sh self-test: 11 of 116 checks FAILEDand fourgate-boundFIFO failures.With Python 3.12.12 and
BLOOMERY_DATAunset. Before, on upstream main564083ea:The failure comes from
PermissionError: [Errno 13] Permission denied: '/root/bloomery-data/clef/flash/ref/reference.jsonl'.After, with the first commit tested as
ea41a779on that base (the same diff as60a999d2):gate-bound
With
GNU bash, version 5.3.9(1)-release (x86_64-pc-linux-gnu). Before, on60a999d2, whosetools/gate-bound.shis the same file as main's:To show that the new cases still catch a broken retry policy, I ran the FIFO cases against two temporary copies of
tools/gate-bound.shat8a30632e. One copy never retries (breakin place of theBOUNDED_RANtest). The other gives up one try late (-gtin place of-ge). Both fail:After, on
8a30632e, the full recipe check on two Linux hosts:The full t0 on
8a30632e, on the second Linux host, ends withcheck-recipes rc=0andtest-bloomery-placement rc=101fromneed_hook::tests::only_a_refusal_is_kept_for_the_exit, which is the race the fixture commit removes.BLOOMERY_DATAunset564083eaBLOOMERY_DATAunsetea41a779bash tools/gate-bound.sh --self-test, Bash 5.3.960a999d28a30632ejust check-recipes, first Linux host8a30632ejust check-recipes, second Linux host8a30632eExecutable fixtures
The fixture commit was tested as
f0182b3con main6661aad8; it is the same patch as88a09ba2here.need_hook.rsatec05696dandgate_serve_start.rsataba47bd5are identical to the same files atf0182b3c, so those runs cover the final code. Atec05696d, the video and gate writers were still the ones on main.The need-hook rows repeat
cargo test -p bloomery-placement need_hook500 times with the thread count shown. The last row is one full placement run.6661aad8(main)ExecutableFileBusy, "Text file busy"6661aad8(main)ec05696dcargo test -p bloomery-placement -- --test-threads=16ec05696dTo repeat the video and gate writers without building the GPU crates, a probe extracts each writer function from the source at the tested revision, compiles it with
rustc --testand runs 16 copies of the fixture in parallel. One run is one such binary, and each row is 500 runs, or 8,000 writer calls. The original video writer hides the failure behind its retry loop, so the probe also runs a copy with only that retry turned off:ec05696dec05696dExecutableFileBusyec05696dExecutableFileBusyaba47bd5f0182b3ccargo test -p bloomery-serve --lib video::tests -- --test-threads=16f0182b3cThe gate probe also checks that the hook records its stdin, prints its line, ends with exit 75 and has mode 0755.
Failing under 16 threads and never under 1 thread fits the inherited write descriptor described above. 500 clean runs do not prove that every schedule is safe. The fix holds because the test process no longer has a write descriptor for a child to inherit.
Reproduce:
GPU evidence
The repeated fixture runs above ran on a host with this card:
just gate-gpu-serve-start-glmandjust gate-gpu-serve-start-ds41were not run here: both recipes setBLOOMERY_CARD=both(two cards in view), and this host has one card.The
hook_scriptwriter those gates call is the one exercised 500 times in the table above.Hardware (if the change is for a machine)
Not for a machine. The runs used a Linux x86_64 host with Bash 5.3.9 and the card under GPU evidence. The
just check-recipesand t0 runs at8a30632ealso used a second Linux host.What I ran into
This does not block the PR.
crates/gpu-gates/tests/sentence_prompts.rs:95-96also writes a script from the test process, and I left it as is. Its test binary has one test, and it waits on each child with a blockingoutput()before it rewrites the script, so no spawn can overlap the write. A search of the tree for other script writers (shebangs,set_permissions,chmod, mode literals) found only sequential setup steps in the shell and Python tools.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.