forge: verify Q93 selftest_sweep contract-grading + unified run_verdict refactor (44 cells, ALL GREEN)

This commit is contained in:
forge committed 2026-10-28 01:14:28 +00:00
1 parent 5ea8b04797
commit bc5f3e9e1c
2 files changed
+64

No files matched your search

@@ -0,0 +1,38 @@
# Q93 selftest_sweep refactor -- verification (forge: Refactor lane)
## Work
Commit `9878f12` ("forge: Q93 contract-grading + unified run_verdict in
selftest_sweep (44 cells, 0 fatal)") refactored `tools/selftest_sweep.py`:
* `judge_malformed(rc, out, err, expect_rc, need)` -- the 5-arg CONTRACT form.
A refusal (`expect_rc == REFUSAL_RC == 2`) is now graded on its contract
(documented rc, no traceback, one non-empty line on stdout OR stderr), not on
a pinned prose phrase. `need` is consulted only where a tool GRADES a
malformed input (rc 0/1), where the verdict word IS the verdict.
* `run_verdict(tool_fatal, read_fatal, malformed_fatal, pin_rc, pin_fatal)` ->
`(line, exit_code)` from ONE function, so the printed summary and the exit
code cannot disagree (the Q93 core fix: the old sweep printed
"sweep: 22 tools, 22 OK, 0 fatal" while exiting 1).
* count pin moved 39 -> 44; the stale
`1 if (rc or rrc or pin_rc) else 0` main() arm is removed.
## Evidence
The committed verifier reproduces the green run against the on-disk tree:
```
$ python3 wizard-work/forge/verify_selftest_sweep_q93_refactor.py
[ok ] py_compile
[ok ] static marker: def run_verdict(...)
... (18 checks) ...
[ok ] judge_malformed has 5-arg (rc,out,err,expect_rc,need) signature
verify_selftest_sweep_q93_refactor: ALL GREEN (0 failed, all checks) rc=0
```
Full captured stdout/stderr is in `Q93_REFACTOR_VERIFICATION_EVIDENCE.txt`.
## Gate
`tools/selftest_sweep.py --selftest` prints `selftest: 44 cells, 44 passed,
0 failed` and exits 0; the read-refusal (Q53) and malformed (Q53) axes both
grade against the Q93 contract; `run_verdict` returns the rc its verdict line
states. No regressions vs. the pre-Q93 Counter-census refactor
(`27c9869`), whose verifier this file supersedes.
@@ -0,0 +1,26 @@
[ok ] py_compile
[ok ] static marker: def run_verdict(tool_fatal, read_fatal, malforme
[ok ] static marker: def judge_malformed(rc, out, err, expect_rc, nee
[ok ] static marker: if expect_rc == REFUSAL_RC:
[ok ] static marker: "verdict": "OK", "rc": rc, "contract": "refusal"
[ok ] static marker: return (1 if fatal else 0), bad_by_axis[0], bad_
[ok ] static marker: rrc, read_fatal, malformed_fatal = report_read(a
[ok ] static marker: line, run_rc = run_verdict(fatal, read_fatal, ma
[ok ] static marker: print(line)
[ok ] static marker: return run_rc
[ok ] static marker: selftest: 44 cells
[ok ] static marker: 1, "EMPTY")
[ok ] obsolete main() return removed
[ok ] selftest 44 cells 0 failed
[ok ] IMPORT_OK (side-effect-free)
[ok ] run_verdict line states the rc it returns
[ok ] refusal rc2 + message -> OK (contract)
[ok ] rc0 where contract says 2 -> RC_WRONG (fatal)
[ok ] rc2 + whitespace only -> SILENT
[ok ] traceback -> TRACEBACK even at rc 2
[ok ] graded rc1 + needed word -> OK (contract=grade)
[ok ] graded rc1 + missing word -> UNEXPLAINED
[ok ] refusal on stderr stream is OK (either stream)
[ok ] judge_malformed has 5-arg (rc,out,err,expect_rc,need) signature
verify_selftest_sweep_q93_refactor: ALL GREEN (0 failed, all checks)