Repository navigation
lds-scan: a failed line count fails the scan - #483
Conversation
The entry count, an entry's PTX body line count and its SASS line count were read with wc pipelines whose status nothing checked: a wc that failed without output left an empty count, and a failed SASS read still printed the row with an empty `sass lines=` and exit 0. Each count now fails the scan by name when its read fails: entries=unread, lines-unread=<entry> or sass-lines-unread=<entry>, with no row. The md5sum and wc stand-ins of tools/ref/read-stubs.sh fail on a text that holds the word fail-md5 or fail-wc, not only on a text that is that word, so the self-test fails the PTX and the SASS count read of a whole entry.
There was a problem hiding this comment.
Verdict: CLEAN: All three line-count reads now report named failures; the remaining test gap is non-blocking.
Non-blocking
⚠ Cover entry-count failure: tools/lds-scan.sh:218.
No self-test injects a failed entry-count read, so removing this guard leaves the cases unchanged. After the PTX/SASS cases, overwrite the existing wc stand-in with one that consumes stdin and exits 1; assert exit 1 and the exact lds-scan bin=target/release/gate_x entries=unread scan=failed banner.
Checked
Duplicates: 0 new functions, types or constants; Grep confirms reuse of the existing read_stubs owner. No dryer pairs were available.
Complexity: no Rust functions changed; the shell self-test adds three independent cases.
Silent failure: 3 production reads followed to their consumers; failed pipelines exit 1 with a named banner before emitting the affected row.
Tests: PTX/SASS failure cases assert exit 1 and exact named banners. Removing the stand-in PATH prefix (:99), PTX guard (:231), or SASS guard (:238) defeats those assertions. Entry-count failure has no regression assertion. The PR reports passing scanner and manifest-writer self-tests; validation here used source inspection.
Gates: no pins, thresholds or cases relaxed or removed. The PR supplies FAIL-first output for the PTX/SASS cases.
Escape catalog: C1 checked; pipefail and guarded assignments preserve wc failures. No C2–C4 matches.
Notes
Dryer and crapper did not run because no Rust file changed.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Filed outside this PR: #484
|
The review is done and the contribution check passed, so I'm merging this. |
What and why
Fixes #452.
tools/lds-scan.shread three line counts withwc -land never checked the status: the entry count, an entry's PTX body lines and its SASS listing lines. When the SASS read failed,slineswas empty and the scan printed a row withsass lines=and exited 0. When the PTX read failed, the next[ "$lines" -gt 0 ]errored and the scan failed asbody=none(<entry>), which names the wrong cause. Each read now callsfailon error, so the scan ends withentries=unread,lines-unread=<entry>orsass-lines-unread=<entry>andscan=failed, and prints no row.Release notes: internal: an LDS scan that cannot count an entry's PTX or SASS lines ends as a failed scan that names the entry, instead of printing a row with an empty count.
Code shape
read_stubsfromtools/ref/read-stubs.shfor itswcstand-in. No new helper.wcreads in the script end in|| fail.pipefailis on, so a failedwcinwc | trcounts.cargo fmtandcargo clippy: no Rust changes (shell only).Duplication found or removed (
path:line), or "none": none.What changed:
tools/lds-scan.sh: the three reads and their failure fields as above.tools/lds-scan.shself-test:scan()takesSCAN_STUBS(puts the stand-ins first on PATH) andSCAN_FIX(another fixture folder). Afix-wccopy of the fixture has afail-wcline at the end ofmod1.ptx(inside theup_downbody) and ofup_mix_4x320.sass. Three new cases:read-stubs-pass(a control scan under the stand-ins that keeps its row),sass-count-unreadandptx-count-unread.tools/ref/read-stubs.sh: the stand-ins now fail when their input holds the wordfail-md5orfail-wc(grep -qw), not only when the whole input is that word. An entry's PTX body or SASS listing always holds more than one word. The existing users (tools/ptx-scan.sh,tools/ref/dump-dequant.sh,crates/tokenizer/tools/oracle.sh) pass the bare word, so they behave as before; their self-tests pass below.The entry count read has no failure case. Its input lines are
<module> <entry>, and an entry name has no-, so it cannot hold the wordfail-wcthat makes the stand-in fail.What I ran
All on an RTX 5090 machine.
d6e4fdeb).bash tools/lds-scan.sh --self-testendedlds-scan: self-test FAIL (10 cases, 2 failed).sass-count-unreadfailed withrc 0 (want 1)and a row reading| sass lines= STL=3, which is the issue's symptom.ptx-count-unreadfailed withbody=none(up_down) scan=failed. The control caseread-stubs-passpassed.lds-scan: self-test ok (10 cases, 0 failed),ptx-scan: self-test ok (30 cases, 0 failed),dump-dequant self-test: ok (0 failures),oracle self-test: ok (0 failures)andptx-spill-check: self-test ok.LC_ALL=C just contrib-check --tier t0with the fix:DONE tier=t0 total=94 red=0 wall=285s. Itscheck-recipesunit runs these self-tests (check-recipes rc=0 101s).The checks with the fix ran on
77503e59, this same commit on main7b31f231. The PR head169b1a75is that commit onf9b38060; the main commits between the two bases change only the 0.3.5 version strings, andgit range-diffshows the commit unchanged.I did not run
just lds-scanagainst a real gate binary, since that needs a full GPU build. The existing fixture cases run the success path with the realwc, and the row format is unchanged.What I ran into
None of this blocks the PR.
tools/lds-scan.sh:196readsNMOD=$(grep -c ...)without checking its status. A failure there already fails the scan, but asmodules=0, which names the wrong cause. This PR leaves it alone.Hardware (if the change is for a machine)
Not a hardware change.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.