Repository navigation
fix(tools): validate placement inputs and preserve named CLI errors - #659
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: bursts accepts an explicitly empty placement and reports a successful host-only replay.
Must fix
1. Send an empty --n-l through placement validation
tools/ref/router-coverage.py:471 bursts <valid-set> --window 4 --n-l "" passes an empty string to bursts. Both truthiness checks skip placement validation, build empty card sets, and return 0 with the same report as omitting the option. Direct parse_n_l("", layers, n_expert) rejects it with a named error. This is a reachable kind A failure in the placement-validation path this fix PR changes.
Fixing both checks now closes the bypass while the placement-validation tests are being added.
Replace the assignment at line 466 with:
wu = window_union() if spec is not None else NoneReplace the condition at line 471 with:
if spec is not None:Add this entry to cases in window-union.py's existing CLI refusal test:
("router-coverage.py", ["bursts", cli, "--window", "4", "--n-l", ""], "--n-l"),Checked
Duplicates: no new functions, types, or constants; no duplicate finding.
Complexity: placement-validation and CLI-refusal branches; no engine hot path changes.
Silent failure: followed the empty placement from CLI parsing through card construction to the successful report.
Tests: the CLI entry point with in-memory trace files reproduces the bypass. Both replacements compile and make empty input return 1 naming --n-l; omitted and valid-placement reports remain identical. All three bursts options still reject repetition. The added refusal cases omit empty input.
Gates: no thresholds or pins moved; the upper-count refusal assertion moved to the parser.
Escape catalog: C1–C4 do not match the diff.
Notes
Dryer and crapper did not run because no Rust file changed. Full self-tests were not rerun during validation.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
Addressed the current MUST_FIX in Both placement-admission checks now distinguish omission ( FAIL-first: the added regression failed because the command returned 0 with a host-only report. After the fix, the actual command exits 1 naming |
There was a problem hiding this comment.
Since the last review: must-fix 1 is fixed at tools/ref/router-coverage.py:471. Explicitly empty --n-l reaches placement validation and returns a named error. The new CLI case covers it.
Verdict: CLEAN: The empty-placement bypass is fixed, and the incremental diff introduces no proven defect.
Checked
Duplicates: 0 new functions, types, or constants; no duplicate finding.
Complexity: two guard substitutions; no added branches or engine hot-path changes.
Silent failure: both placement guards traced. Empty input reaches parse_n_l; its named error is translated to the CLI's SetError and returns 1 before printing a report.
Tests: the added CLI case asserts exit 1, a named --n-l error, and no traceback. Restoring the first old guard would produce a traceback; restoring the second would return a successful report. Either mutation fails the new assertions.
Gates: no gates removed, thresholds changed, or pins moved.
Escape catalog: C1–C4 do not match.
Notes
Dryer and crapper did not run because no Rust file changed. Validation used source inspection; full self-tests were not rerun.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
@Burntgogi Thanks for the contribution. The review is done, so I'm merging this. |
Change
Refs #637; resolves its malformed/repeated placement-input item and its
burststraceback item. MTP draft-store correctness and remote narrow-scan cancellation are not part of this PR.parse_n_lis the single placement-admission owner: counts in0..n_expert, no repeated/overlapping explicit layer ranges, and a nonnegative spread total no larger than eligible capacity. All callers pass the trace's expert count;card_setsonly materializes the admitted id prefixes.window-union --kalso rejects duplicate window sizes rather than duplicating report rows.burststranslates the path-loaded module'sSetErrorat the reader boundary to its ownSetError, preserving the named CLI refusal without global module-cache mutation or catching unrelated errors.Verification
Base
69b66367; head7cfab04.burstscases exited 1 with Python tracebacks. After: all 8 scenarios exit 1 with the named option and no traceback.window-union.py --self-testandrouter-coverage.py --self-testpass, including the existing static/strata numerical checks and seven retained real-CLI refusal cases.fmt,check-arch,check-comments, andcheck-leverspassed. As in fix(recipes): retain includes and literals inside multiline attributes #658, the initial concurrent worktree runs interfered with the process-global CPU-guard fixture. After serializing those checks, full check-recipes passed at2498a35ain 137 s. No skipped units, threshold changes or timeout increases were used.Current-head review correction at
7cfab04The empty-placement MUST_FIX is addressed: both
burstsadmission checks usespec is not None, so an explicitly empty--n-lis validated and refused instead of silently becoming an omitted placement. The added real-CLI regression failed before the correction and passes after it. Actual CLI execution now exits 1 naming--n-l, without a traceback; omitted, zero-card and partial-card reports remain byte-for-byte unchanged. Both full replay self-tests pass.The final owning run at committed
7cfab049passed 5 / 5 (fmt,check-arch,check-comments,check-levers, fullcheck-recipes), wall 159 s. Check-recipes took 138 s; all original bounds and units remain in place. The omitted/empty distinction is documented.