Repository navigation
test(ratchet): the mavis CLI ratchet could not say no — fix 3 defects load-bearingly - #3427
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 2db10ab3b0b3 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0aaba68cb6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code Review Roast 🔥Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. Incremental verification (round 7, d39b11c..64fc604): the two round-7 findings are closed at the source, not just answered:
📊 Overall: Round 7 reviews round 6's fix and finds… the holes already patched, with mutation kills proving the tests bite. Like reviewing a firewall patch and finding the fire already out — suspiciously competent. Files Reviewed (4 files)
Carried findings resolved: both previous threads ( Gaps: no code execution in this sandbox (read-only), so findings are verified by reading the changed lines against the loop and tests that consume them; the author's measured outputs (38 passed, both mutations killed, anchor ratchet 445/445) are taken as reported evidence. Sub-agent count: 0 (4 files, 238 added lines, doc-dominant, reviewed in full directly). Previous Review Summaries (7 snapshots, latest commit d39b11c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit d39b11c)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: Round 6's core fix is genuinely good — two pure budget functions, a config-driven allowance with a required reason, a negative-control test proving the budgets fall back to exactly 120s/60s without an entry, and wiring tests proving the widened timeout reaches the subprocess AND the isolation pass. Oh wait, budget models with negative controls — I need to sit down. 💀 Worst part: The new allowance raised the per-file ceiling above the static pass budget that bounds the isolation loop. Two budgets in the same function, one updated and one not — the classic sequel to exactly the defect this PR fixes, now living one loop iteration away. 📊 Overall: Like buying a bigger bathtub and keeping the same tiny water heater — the file now can run long, but the pass-level budget can still cut the lights on it mid-run. Fix these issues in Kilo Cloud Files Reviewed (incremental since aac9570, 7 files)
Incremental-mode notes: the diff Gaps: no Python interpreter execution in this sandbox (execution prohibited), so the budget-model findings are verified by reading the changed lines and the loop they sit in, not by a live run. Sub-agent count: 0 (round-6 delta is code-reviewed in full; the rebase introduced no new PR-diff content). Existing inline comments reconciled via paginated fetch: all threads carry Previous review (commit aac9570)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: Round 6's core fix is genuinely good — two pure budget functions, a config-driven allowance with a required reason, a negative-control test proving the budgets fall back to exactly 120s/60s without an entry, and wiring tests proving the widened timeout reaches the subprocess AND the isolation pass. Oh wait, budget models with negative controls — I need to sit down. 💀 Worst part: The new allowance raised the per-file ceiling above the static pass budget that bounds the isolation loop. Two budgets in the same function, one updated and one not — the classic sequel to exactly the defect this PR fixes, now living one loop iteration away. 📊 Overall: Like buying a bigger bathtub and keeping the same tiny water heater — the file now can run long, but the pass-level budget can still cut the lights on it mid-run. Fix these issues in Kilo Cloud Files Reviewed (incremental since f9cec95, 6 files)
Gaps: no Python interpreter execution in this sandbox (execution prohibited), so the budget-model findings are verified by reading the changed lines and the loop they sit in, not by a live run. Sub-agent count: 0 (incremental ~430 changed lines across 6 mostly-prose files). Existing inline comments reconciled: all fetched threads carry Previous review (commit f9cec95)Verdict: No Issues Found | Recommendation: Merge Round 7, and the history got rewritten out from under me — force-push, SHAs moved, the whole dramatic rebase. So I did the paranoid thing and diffed the old review HEAD against the new one: zero bytes of difference in the reviewed mavis files. Same code, new addresses, same verdict. 📊 Overall: Round 7 re-verifies the round-6 state at the rewritten HEAD ( Details (click to expand)Force-push handled per protocol: Both round-5 findings re-verified as FIXED at HEAD by full-file read:
Fresh checks at HEAD, nothing found: every mutation anchor ( Existing inline comments reconciled: 34 threads fetched with pagination; all are on Files Reviewed (incremental since 0905341; content-identical, re-verified at HEAD):
Gaps: no Python interpreter in this sandbox and execution is prohibited, so platform-specific paths (Windows Previous review (commit 0905341)Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Round 6 reviews the fix for round 5's two findings and finds the barn doors not just closed but welded: Details (click to expand)Both previous findings re-verified as FIXED at HEAD (e00a052 + docs at 0905341):
Fresh code checked, nothing found: mutation anchors ( Files Reviewed (incremental since 43aaa49; 3 files changed, plus carried checks):
Gaps: no Python interpreter in this sandbox and execution is prohibited, so platform-specific paths (Windows Previous review (commit 43aaa49)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: The incremental delta since the last review is three prose register rows and zero new code — meaning five review rounds, nine confirmed defects, and nine landings, and the code is now quiet because it's actually fixed, not because anyone stopped looking. The mutation anchors still byte-match the live source. I keep sharpening the knife and keep finding the whetstone already used; it's disorienting. 💀 Worst part: The two survivors are both "the guarantee ends one layer below where you were looking." The lock holder's deadline still dies on Windows inside CPython's own unbounded post-kill pipe drain, and the deadline's override still can be set to a value that isn't a deadline. Round after round has pushed the same defect class one level down; this is where it stops moving. 📊 Overall: A ratchet with 180× headroom on its deadline and two ways a typo takes the headroom out — the last mile is made entirely of edge cases you already built test infrastructure to catch. Fix these issues in Kilo Cloud Files Reviewed (1 file changed since last review; 4 files verified)
Gaps: no Python interpreter available in this sandbox (and execution is prohibited), so the Windows Previous review (commit c16bbd1)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: Both round-4 findings are now genuinely landed, not just replied-to — 💀 Worst part: The round dedicated to "the lock HOLDER must not be able to hang" left one platform where the holder still can — the unbounded post-kill pipe drain on Windows. Round three was "the lock's two halves must agree"; round four partially repeated it, just one layer down (process tree instead of OS branch). 📊 Overall: The ratchet can now say no, read whole declarations, and time out — it just needs to learn to raise a family that can also be put down. Fix these issues in Kilo Cloud Files Reviewed (4 files)
Gaps: no Python interpreter available in this sandbox (and execution is prohibited), so the Windows Previous review (commit 8af2663)Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
[Snapshot truncated.] Additional previous summary content was truncated to keep this comment within platform limits. Reviewed by glm-5.3-flash · Input: 48K · Output: 18.3K · Cached: 367K |
0aaba68 to
ded8f21
Compare
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 7a6563644965 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
7521765 to
c457bf9
Compare
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 7298a8dec416 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
…, and locked the wrong half Four findings against PR #3427, all confirmed VALID and closed at source. A. `exclude:` was never read. `_extract_matrix_platforms` collected runner labels from the base dimension list plus `include:` entries and never expanded or removed combinations, so a matrix that EXCLUDED windows-latest still reported windows as covered -- the exact inversion this ratchet exists to prevent, in the other direction. New helpers `_matrix_axes` (:368), `_base_combinations` (:388), `_combo_matches_exclude` (:405), `_apply_matrix_exclusions` (:422), `_apply_matrix_inclusions` (:444); `_extract_matrix_platforms` (:499) now expands base -> exclude -> include (GitHub's documented order) and takes labels only from surviving combinations. An exclude that matches nothing removes nothing -- not an error. B. The POSIX lock could block forever. `_lock_file` enforced `_LOCK_TIMEOUT_SECONDS` on the Windows branch only; POSIX used a bare blocking `flock`, so a stuck holder wedged the suite with no timeout and no diagnostic. Split into `_try_lock_windows` (:347) / `_try_lock_posix` (:359, LOCK_EX|LOCK_NB) behind `_try_lock_nonblocking` (:375), with ONE shared deadline loop in `_lock_file` (:382) that raises `MutationLockTimeout` (:290) naming the lock file, the timeout and the recorded holder. Both branches: same constant, same failure mode, same message. A timeout always raises -- it never proceeds unlocked. C. The clean-check read the target without the lock. `test_ratchet_file_is_left_clean_after_mutations` read TARGET outside `_mutation_lock()`, so it could observe the file mid-mutation and report a false pass. `_read_ratchet_file_under_lock` (:464) takes the lock for the whole read; `_assert_ratchet_file_clean` (:475) holds the content assertions. D. CodeQL "Incomplete URL substring sanitization" (HIGH, the ratchet's own test double). `fake_urlopen` matched the host with `"api.github.com" in url`, which also accepts `https://api.github.com.evil.example/` and `https://evil.example/?x=api.github.com`. Fixed AT THE SOURCE: `_is_github_api_url` (:305) parses with urllib.parse.urlsplit and requires `parsed.hostname == "api.github.com"` -- host only, the netloc is NOT compared because it carries userinfo and a port. A URL that is not absolute or not parseable is not the API host and must not raise. NO nosec, NO CodeQL config change -- the alert is fixed, not silenced. New cases, each invoking the code under test rather than restating it: - A: `test_mutation_excluded_platform_is_not_covered` (:1255) via `_assert_matrix_platforms` (:619); harness `test_mutation_exclude_handling_is_killed` (:686) mutates the ratchet back to ignoring exclude and requires that named test to fail. - B: `test_posix_lock_path_times_out_and_raises` (:762) -- fake fcntl plus fake clock, proves the POSIX path raises instead of hanging; `test_held_lock_makes_the_next_holder_time_out` (:831) proves it end-to-end against a real holder process; harness `test_mutation_posix_blocking_flock_is_killed` (:912). - C: `test_clean_check_is_serialized_against_concurrent_mutation` (:872) -- the reader thread must NOT complete while the lock is held; harness `test_mutation_unlocked_clean_check_is_killed` (:933). - D: `test_mutation_github_api_host_match_is_exact` (:1394); harness `test_mutation_loose_api_host_match_is_killed` (:953). Every mutation case runs GREEN-before -> RED-after (named test) -> GREEN-after-restore, with a byte-exact restore inside the lock (`_mutation_case`, :567). Measured: ratchet 11 passed / 1 skipped (skip = the network-gated matrix cross-check); harness 10 passed; 22 passed / 0 skipped with PMOVES_MAVIS_MATRIX_CHECK=1 (the live probe ran and passed); 19 passed / 3 skipped with `mavis` off PATH (the two CLI probes plus the matrix gate), with every mutation-kill still firing.
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 546951bd4ea0 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
8af2663 to
c16bbd1
Compare
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
…, and locked the wrong half Four findings against PR #3427, all confirmed VALID and closed at source. A. `exclude:` was never read. `_extract_matrix_platforms` collected runner labels from the base dimension list plus `include:` entries and never expanded or removed combinations, so a matrix that EXCLUDED windows-latest still reported windows as covered -- the exact inversion this ratchet exists to prevent, in the other direction. New helpers `_matrix_axes` (:368), `_base_combinations` (:388), `_combo_matches_exclude` (:405), `_apply_matrix_exclusions` (:422), `_apply_matrix_inclusions` (:444); `_extract_matrix_platforms` (:499) now expands base -> exclude -> include (GitHub's documented order) and takes labels only from surviving combinations. An exclude that matches nothing removes nothing -- not an error. B. The POSIX lock could block forever. `_lock_file` enforced `_LOCK_TIMEOUT_SECONDS` on the Windows branch only; POSIX used a bare blocking `flock`, so a stuck holder wedged the suite with no timeout and no diagnostic. Split into `_try_lock_windows` (:347) / `_try_lock_posix` (:359, LOCK_EX|LOCK_NB) behind `_try_lock_nonblocking` (:375), with ONE shared deadline loop in `_lock_file` (:382) that raises `MutationLockTimeout` (:290) naming the lock file, the timeout and the recorded holder. Both branches: same constant, same failure mode, same message. A timeout always raises -- it never proceeds unlocked. C. The clean-check read the target without the lock. `test_ratchet_file_is_left_clean_after_mutations` read TARGET outside `_mutation_lock()`, so it could observe the file mid-mutation and report a false pass. `_read_ratchet_file_under_lock` (:464) takes the lock for the whole read; `_assert_ratchet_file_clean` (:475) holds the content assertions. D. CodeQL "Incomplete URL substring sanitization" (HIGH, the ratchet's own test double). `fake_urlopen` matched the host with `"api.github.com" in url`, which also accepts `https://api.github.com.evil.example/` and `https://evil.example/?x=api.github.com`. Fixed AT THE SOURCE: `_is_github_api_url` (:305) parses with urllib.parse.urlsplit and requires `parsed.hostname == "api.github.com"` -- host only, the netloc is NOT compared because it carries userinfo and a port. A URL that is not absolute or not parseable is not the API host and must not raise. NO nosec, NO CodeQL config change -- the alert is fixed, not silenced. New cases, each invoking the code under test rather than restating it: - A: `test_mutation_excluded_platform_is_not_covered` (:1255) via `_assert_matrix_platforms` (:619); harness `test_mutation_exclude_handling_is_killed` (:686) mutates the ratchet back to ignoring exclude and requires that named test to fail. - B: `test_posix_lock_path_times_out_and_raises` (:762) -- fake fcntl plus fake clock, proves the POSIX path raises instead of hanging; `test_held_lock_makes_the_next_holder_time_out` (:831) proves it end-to-end against a real holder process; harness `test_mutation_posix_blocking_flock_is_killed` (:912). - C: `test_clean_check_is_serialized_against_concurrent_mutation` (:872) -- the reader thread must NOT complete while the lock is held; harness `test_mutation_unlocked_clean_check_is_killed` (:933). - D: `test_mutation_github_api_host_match_is_exact` (:1394); harness `test_mutation_loose_api_host_match_is_killed` (:953). Every mutation case runs GREEN-before -> RED-after (named test) -> GREEN-after-restore, with a byte-exact restore inside the lock (`_mutation_case`, :567). Measured: ratchet 11 passed / 1 skipped (skip = the network-gated matrix cross-check); harness 10 passed; 22 passed / 0 skipped with PMOVES_MAVIS_MATRIX_CHECK=1 (the live probe ran and passed); 19 passed / 3 skipped with `mavis` off PATH (the two CLI probes plus the matrix gate), with every mutation-kill still firing.
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 42778bc46e2e Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
c16bbd1 to
43aaa49
Compare
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
…, and locked the wrong half Four findings against PR #3427, all confirmed VALID and closed at source. A. `exclude:` was never read. `_extract_matrix_platforms` collected runner labels from the base dimension list plus `include:` entries and never expanded or removed combinations, so a matrix that EXCLUDED windows-latest still reported windows as covered -- the exact inversion this ratchet exists to prevent, in the other direction. New helpers `_matrix_axes` (:368), `_base_combinations` (:388), `_combo_matches_exclude` (:405), `_apply_matrix_exclusions` (:422), `_apply_matrix_inclusions` (:444); `_extract_matrix_platforms` (:499) now expands base -> exclude -> include (GitHub's documented order) and takes labels only from surviving combinations. An exclude that matches nothing removes nothing -- not an error. B. The POSIX lock could block forever. `_lock_file` enforced `_LOCK_TIMEOUT_SECONDS` on the Windows branch only; POSIX used a bare blocking `flock`, so a stuck holder wedged the suite with no timeout and no diagnostic. Split into `_try_lock_windows` (:347) / `_try_lock_posix` (:359, LOCK_EX|LOCK_NB) behind `_try_lock_nonblocking` (:375), with ONE shared deadline loop in `_lock_file` (:382) that raises `MutationLockTimeout` (:290) naming the lock file, the timeout and the recorded holder. Both branches: same constant, same failure mode, same message. A timeout always raises -- it never proceeds unlocked. C. The clean-check read the target without the lock. `test_ratchet_file_is_left_clean_after_mutations` read TARGET outside `_mutation_lock()`, so it could observe the file mid-mutation and report a false pass. `_read_ratchet_file_under_lock` (:464) takes the lock for the whole read; `_assert_ratchet_file_clean` (:475) holds the content assertions. D. CodeQL "Incomplete URL substring sanitization" (HIGH, the ratchet's own test double). `fake_urlopen` matched the host with `"api.github.com" in url`, which also accepts `https://api.github.com.evil.example/` and `https://evil.example/?x=api.github.com`. Fixed AT THE SOURCE: `_is_github_api_url` (:305) parses with urllib.parse.urlsplit and requires `parsed.hostname == "api.github.com"` -- host only, the netloc is NOT compared because it carries userinfo and a port. A URL that is not absolute or not parseable is not the API host and must not raise. NO nosec, NO CodeQL config change -- the alert is fixed, not silenced. New cases, each invoking the code under test rather than restating it: - A: `test_mutation_excluded_platform_is_not_covered` (:1255) via `_assert_matrix_platforms` (:619); harness `test_mutation_exclude_handling_is_killed` (:686) mutates the ratchet back to ignoring exclude and requires that named test to fail. - B: `test_posix_lock_path_times_out_and_raises` (:762) -- fake fcntl plus fake clock, proves the POSIX path raises instead of hanging; `test_held_lock_makes_the_next_holder_time_out` (:831) proves it end-to-end against a real holder process; harness `test_mutation_posix_blocking_flock_is_killed` (:912). - C: `test_clean_check_is_serialized_against_concurrent_mutation` (:872) -- the reader thread must NOT complete while the lock is held; harness `test_mutation_unlocked_clean_check_is_killed` (:933). - D: `test_mutation_github_api_host_match_is_exact` (:1394); harness `test_mutation_loose_api_host_match_is_killed` (:953). Every mutation case runs GREEN-before -> RED-after (named test) -> GREEN-after-restore, with a byte-exact restore inside the lock (`_mutation_case`, :567). Measured: ratchet 11 passed / 1 skipped (skip = the network-gated matrix cross-check); harness 10 passed; 22 passed / 0 skipped with PMOVES_MAVIS_MATRIX_CHECK=1 (the live probe ran and passed); 19 passed / 3 skipped with `mavis` off PATH (the two CLI probes plus the matrix gate), with every mutation-kill still firing.
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest f397dc54ce60 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest d6eeba3cea17 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
0905341 to
f9cec95
Compare
…, and locked the wrong half Four findings against PR #3427, all confirmed VALID and closed at source. A. `exclude:` was never read. `_extract_matrix_platforms` collected runner labels from the base dimension list plus `include:` entries and never expanded or removed combinations, so a matrix that EXCLUDED windows-latest still reported windows as covered -- the exact inversion this ratchet exists to prevent, in the other direction. New helpers `_matrix_axes` (:368), `_base_combinations` (:388), `_combo_matches_exclude` (:405), `_apply_matrix_exclusions` (:422), `_apply_matrix_inclusions` (:444); `_extract_matrix_platforms` (:499) now expands base -> exclude -> include (GitHub's documented order) and takes labels only from surviving combinations. An exclude that matches nothing removes nothing -- not an error. B. The POSIX lock could block forever. `_lock_file` enforced `_LOCK_TIMEOUT_SECONDS` on the Windows branch only; POSIX used a bare blocking `flock`, so a stuck holder wedged the suite with no timeout and no diagnostic. Split into `_try_lock_windows` (:347) / `_try_lock_posix` (:359, LOCK_EX|LOCK_NB) behind `_try_lock_nonblocking` (:375), with ONE shared deadline loop in `_lock_file` (:382) that raises `MutationLockTimeout` (:290) naming the lock file, the timeout and the recorded holder. Both branches: same constant, same failure mode, same message. A timeout always raises -- it never proceeds unlocked. C. The clean-check read the target without the lock. `test_ratchet_file_is_left_clean_after_mutations` read TARGET outside `_mutation_lock()`, so it could observe the file mid-mutation and report a false pass. `_read_ratchet_file_under_lock` (:464) takes the lock for the whole read; `_assert_ratchet_file_clean` (:475) holds the content assertions. D. CodeQL "Incomplete URL substring sanitization" (HIGH, the ratchet's own test double). `fake_urlopen` matched the host with `"api.github.com" in url`, which also accepts `https://api.github.com.evil.example/` and `https://evil.example/?x=api.github.com`. Fixed AT THE SOURCE: `_is_github_api_url` (:305) parses with urllib.parse.urlsplit and requires `parsed.hostname == "api.github.com"` -- host only, the netloc is NOT compared because it carries userinfo and a port. A URL that is not absolute or not parseable is not the API host and must not raise. NO nosec, NO CodeQL config change -- the alert is fixed, not silenced. New cases, each invoking the code under test rather than restating it: - A: `test_mutation_excluded_platform_is_not_covered` (:1255) via `_assert_matrix_platforms` (:619); harness `test_mutation_exclude_handling_is_killed` (:686) mutates the ratchet back to ignoring exclude and requires that named test to fail. - B: `test_posix_lock_path_times_out_and_raises` (:762) -- fake fcntl plus fake clock, proves the POSIX path raises instead of hanging; `test_held_lock_makes_the_next_holder_time_out` (:831) proves it end-to-end against a real holder process; harness `test_mutation_posix_blocking_flock_is_killed` (:912). - C: `test_clean_check_is_serialized_against_concurrent_mutation` (:872) -- the reader thread must NOT complete while the lock is held; harness `test_mutation_unlocked_clean_check_is_killed` (:933). - D: `test_mutation_github_api_host_match_is_exact` (:1394); harness `test_mutation_loose_api_host_match_is_killed` (:953). Every mutation case runs GREEN-before -> RED-after (named test) -> GREEN-after-restore, with a byte-exact restore inside the lock (`_mutation_case`, :567). Measured: ratchet 11 passed / 1 skipped (skip = the network-gated matrix cross-check); harness 10 passed; 22 passed / 0 skipped with PMOVES_MAVIS_MATRIX_CHECK=1 (the live probe ran and passed); 19 passed / 3 skipped with `mavis` off PATH (the two CLI probes plus the matrix gate), with every mutation-kill still firing.
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 3a13000d1553 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
… load-bearingly The test-gap ratchet slice shipped in PR #3095. A follow-up audit on 2026-10-30 found that the ratchet itself had two defects, plus a third surfaced while repairing them. All three are the exact failure mode this lane exists to prevent: a ratchet that reports GREEN while the thing it guards is broken. Defect A — stderr accepted as a version string The shipped `mavis --version` gate was: version = (proc.stdout or proc.stderr or "").strip() assert version Node's module loader writes "Error: Cannot find module '<path>'" to STDERR and exits 1. A 100%-broken launcher therefore satisfied the non-empty assertion. Measured on the operator's host before this fix: $ mavis --version rc=1 stdout='' stderr="Error: Cannot find module '...daemon/cli.js'" test_mavis_cli_version_completes_within_timeout ... PASSED The gate is extracted to `_assert_healthy_version_output()` and now asserts what a working CLI has and a broken one cannot fake: rc == 0, non-empty STDOUT (stderr is never a fallback), and stdout that is not an error banner. `--help` gets the same treatment. Defect B — the upstream pin pointed at a 404 The matrix cross-check pinned `MiniMaxInc/MiniMax-Code`, which does not exist. The real upstream is `MiniMax-AI/minimax-code`. A 404 body is a JSON object where the helper expected a list, so the fetch returned None and the cross-check degraded to a permanent SKIP — it could never report green or red. The pin is corrected and is now itself assertable. Defect C — filename-derived platform set (found while repairing B) The platform detector scanned workflow FILENAMES. Upstream's workflows are ci.yml, cli-release.yml, compatibility.yml, … — not one carries an OS name; the matrix is declared inside ci.yml's BODY as `os: [ubuntu-latest, macos-latest, windows-latest]`. The filename scan returned an empty set, so the gate would have FAILED once enabled, reporting "upstream does not cover Windows" for an upstream that DOES. The detector now reads each workflow's content via its download_url. Upstream matrix answer (the operator's actual question): upstream's Linux matrix is GREEN and upstream DOES cover Windows (`profile: full` on Ubuntu, a focused `profile: windows` on Windows). Live probe: {'platforms': ['macos', 'ubuntu', 'windows'], 'status': 'ok'}. So the 240s timeout is the platform-specific Windows case, not a known-broken upstream. Mutation-kills (the load-bearing proof) pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py rewrites the gate and the upstream pin back to their original defective forms and asserts the ratchet module then FAILS. Both mutations are killed. The first attempt at this harness re-implemented the gate inline instead of invoking it, and restoring the defective gate left the suite at 7 passed — the mutation SURVIVED. The gate is now shared between the ratchet and the mutation-kill, so the two are genuinely coupled. That is recorded as lesson #12 in the LEARNINGS taxonomy. Host shim ~/.minimax/bin/{mavis,minimax}.cmd pointed at `...\MiniMax Code\resources\resources\daemon\cli.js`, which no longer exists (the daemon now ships inside app.asar). Per the operator's direction that the CLI runs from our fork, both shims now exec the fork build at C:\Users\russe\pmoves-fork-minimax-code\dist\cli.js under Node 22.22.1. `mavis --version` → 0.6.5, rc=0, 0.47s. Tests pmoves/tests/test_mavis_cli_timeout.py 7 passed, 1 skipped (8 passed with PMOVES_MAVIS_MATRIX_CHECK=1) pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py 3 passed pmoves/tests/test_kilo_binary_path.py 6 passed (no regression) Docs pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md — lessons #9–#12 added to the 4-bucket x 5-class taxonomy, cross-check re-tallied, post-merge correction table + the upstream-matrix answer recorded. pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md — CLAIM row 2026-10-30T23:00:00Z (5090-CLAUDE, unsigned-local) with full SDK provenance. Co-Authored-By: Mavis <mavis@pmoves.ai>
… check can now say no PR #3427 carried the A/B/C correction round into review. Seven threads came back, and most of them were one defect wearing different clothes: a check that cannot tell "I could not check" from "the answer is no", and a kill signal that cannot tell "the mutation died" from "the run died". Thread 1 (dbId 4427664896, P2) — a failed workflow download was reported as "ok" `_fetch_upstream_matrix()` caught a download failure with a bare `continue` and then returned status="ok" carrying whatever platforms it had managed to scrape from the other workflows. A rate-limited or timed-out download therefore published "upstream dropped Windows" when the truth was "GitHub throttled us" — an infrastructure failure reported as an upstream change. Every failure path now returns status="unavailable" plus a `reason`, and the cross-check SKIPS with that reason instead of blaming upstream. Pinned by test_mutation_upstream_download_failure_is_unavailable. Thread 2 (dbId 4427664903, P2) — platform detection aggregated over every workflow The detector unioned runner labels found in the body of EVERY workflow under .github/workflows/. A label left behind in a release, compatibility or packaging workflow — or in a comment — still counted as test coverage, so removing Windows from the test matrix left the ratchet green while it named the wrong owner for the regression. Detection is now structural: the CI workflow (ci.yml) is selected explicitly, the job whose runs-on is driven by matrix.<key> is located, that job is confirmed to be the TEST job, and only that key's values (plus its include: overrides) are read. A workflow with no identifiable TEST job reports UNAVAILABLE rather than a confident platform set. Pinned by test_mutation_matrix_scoped_platform_detection. Thread 3 (dbId 4427675919) — the runner-label version assumption The match tested a fixed suffix list (-latest / -22 / -24). GitHub-hosted runners appear as windows-2025, windows-2022, macos-15 and ubuntu-24.04 — none of them ends in one of those suffixes. One upstream rename emptied the platform set, the "windows" in platforms gate fired, and the ratchet rebuilt the inverted defect it exists to kill. The match is now the family followed by "latest" or ANY digit, which covers every version shape GitHub publishes. Pinned by test_mutation_runner_label_family_matching. Thread 4 (dbId 4427675854) — infinite recursion inside the patched launcher broken_launcher was installed AS subprocess.run, and its fallback branch called subprocess.run again — resolving the patched attribute and re-entering itself with the same arguments, forever. real_run is now captured BEFORE monkeypatch.setattr and the fallback calls it, matching the sibling test that already had it right. Thread 5 (dbId 4427675888) — the mutation-kill skipped whenever the CLI was absent test_mutation_broken_shim_fails_ratchet — and its sibling test_mutation_hang_fails_ratchet — skipped when mavis was not on PATH, i.e. on CI, so the load-bearing kill only bore load on the operator's laptop. Neither test ever runs the real CLI (the CompletedProcess is built by hand; the call is intercepted), so the guard bought nothing except a skip. The args are now constructed directly, the way test_mutation_error_banner_on_stdout_fails_ratchet already did. Verified: with mavis removed from PATH both files still pass and both kills still fire. Thread 6 (dbId 4427675898) — the kill signal was "the run got sad" The signal was `proc.returncode != 0 and "failed" in output`, which a collection error caused by an unrelated import change, a timeout, or an environment failure also satisfies; the substring cannot tell "1 failed" from "failed to create endpoint". Each mutation now names the test that MUST fail (test_mutation_broken_shim_fails_ratchet for the version gate, test_mutation_wrong_upstream_repo_is_detectable for the upstream pin) and the harness reads pytest's own -rA short test summary for that name. A run that died for any other reason is no longer celebrated as a kill. Thread 7 (dbId 4427675910) — the mutate/restore window raced Both mutations rewrote the same tracked source file and restored it in a finally, so a parallel runner could read a mutated "original" and resurrect a mutated file on restore. The window is now serialized by a threading.Lock plus a cross-process advisory file lock (the OS releases it if a worker dies, so a crashed run cannot leave it held), the restore writes back the exact pre-mutation bytes, and the restore is asserted. Live probe after the repair (PMOVES_MAVIS_MATRIX_CHECK=1): {'status': 'ok', 'platforms': ['macos', 'ubuntu', 'windows'], 'jobs': ['verify'], 'matrix_key': 'os', 'labels': ['macos-latest', 'ubuntu-latest', 'windows-latest']} Note what is NOT in that set: `linux`. The word "Linux" exists in upstream's ci.yml only inside a COMMENT, and a comment is not a matrix entry — precisely the distinction the old body scan could not make. LEARNINGS: pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md gains lessons #13–#17 (unavailable-vs-ok, matrix-scoped platform detection, runner-label family matching, the named-test kill signal, and the harness's own mutate/restore contract), a finding → lesson → code map for all seven threads, and the live probe result. Verified on this host: 12 passed, 1 skipped (the network-gated matrix check skips by default) 13 passed, 0 skipped (with PMOVES_MAVIS_MATRIX_CHECK=1) 10 passed, 3 skipped (with mavis removed from PATH — both kills still fire)
…, and locked the wrong half Four findings against PR #3427, all confirmed VALID and closed at source. A. `exclude:` was never read. `_extract_matrix_platforms` collected runner labels from the base dimension list plus `include:` entries and never expanded or removed combinations, so a matrix that EXCLUDED windows-latest still reported windows as covered -- the exact inversion this ratchet exists to prevent, in the other direction. New helpers `_matrix_axes` (:368), `_base_combinations` (:388), `_combo_matches_exclude` (:405), `_apply_matrix_exclusions` (:422), `_apply_matrix_inclusions` (:444); `_extract_matrix_platforms` (:499) now expands base -> exclude -> include (GitHub's documented order) and takes labels only from surviving combinations. An exclude that matches nothing removes nothing -- not an error. B. The POSIX lock could block forever. `_lock_file` enforced `_LOCK_TIMEOUT_SECONDS` on the Windows branch only; POSIX used a bare blocking `flock`, so a stuck holder wedged the suite with no timeout and no diagnostic. Split into `_try_lock_windows` (:347) / `_try_lock_posix` (:359, LOCK_EX|LOCK_NB) behind `_try_lock_nonblocking` (:375), with ONE shared deadline loop in `_lock_file` (:382) that raises `MutationLockTimeout` (:290) naming the lock file, the timeout and the recorded holder. Both branches: same constant, same failure mode, same message. A timeout always raises -- it never proceeds unlocked. C. The clean-check read the target without the lock. `test_ratchet_file_is_left_clean_after_mutations` read TARGET outside `_mutation_lock()`, so it could observe the file mid-mutation and report a false pass. `_read_ratchet_file_under_lock` (:464) takes the lock for the whole read; `_assert_ratchet_file_clean` (:475) holds the content assertions. D. CodeQL "Incomplete URL substring sanitization" (HIGH, the ratchet's own test double). `fake_urlopen` matched the host with `"api.github.com" in url`, which also accepts `https://api.github.com.evil.example/` and `https://evil.example/?x=api.github.com`. Fixed AT THE SOURCE: `_is_github_api_url` (:305) parses with urllib.parse.urlsplit and requires `parsed.hostname == "api.github.com"` -- host only, the netloc is NOT compared because it carries userinfo and a port. A URL that is not absolute or not parseable is not the API host and must not raise. NO nosec, NO CodeQL config change -- the alert is fixed, not silenced. New cases, each invoking the code under test rather than restating it: - A: `test_mutation_excluded_platform_is_not_covered` (:1255) via `_assert_matrix_platforms` (:619); harness `test_mutation_exclude_handling_is_killed` (:686) mutates the ratchet back to ignoring exclude and requires that named test to fail. - B: `test_posix_lock_path_times_out_and_raises` (:762) -- fake fcntl plus fake clock, proves the POSIX path raises instead of hanging; `test_held_lock_makes_the_next_holder_time_out` (:831) proves it end-to-end against a real holder process; harness `test_mutation_posix_blocking_flock_is_killed` (:912). - C: `test_clean_check_is_serialized_against_concurrent_mutation` (:872) -- the reader thread must NOT complete while the lock is held; harness `test_mutation_unlocked_clean_check_is_killed` (:933). - D: `test_mutation_github_api_host_match_is_exact` (:1394); harness `test_mutation_loose_api_host_match_is_killed` (:953). Every mutation case runs GREEN-before -> RED-after (named test) -> GREEN-after-restore, with a byte-exact restore inside the lock (`_mutation_case`, :567). Measured: ratchet 11 passed / 1 skipped (skip = the network-gated matrix cross-check); harness 10 passed; 22 passed / 0 skipped with PMOVES_MAVIS_MATRIX_CHECK=1 (the live probe ran and passed); 19 passed / 3 skipped with `mavis` off PATH (the two CLI probes plus the matrix gate), with every mutation-kill still firing.
…vis ratchet round 3
…ld hang holding the lock Two more findings against the round-3 code, both confirmed valid. They close the loop round 3 had half-closed: round 3 taught that the lock's two halves must agree (the timeout must exist on BOTH platforms) and that the VERIFICATION must hold the lock the writer holds. Round 4 finds the remaining two gaps -- the lock must cover THE SUBJECT UNDER TEST, and the LOCK HOLDER must not be able to hang. (A) THE LOCK MUST COVER THE SUBJECT, NOT JUST THE MUTATION. `_load_ratchet_module()` read AND executed the ratchet file with NO lock held, so a load landing while another case held the lock and had the file mutated measured a DIFFERENT ratchet than the one it thought it was measuring. Same class as the round-3 clean-check finding, one level earlier: there the VERIFICATION was unlocked, here the SUBJECT is. `_load_ratchet_module(lock_path, target)` (:726) now takes `_mutation_lock(lock_path)` around the whole read+exec. The read+exec moved into `_read_and_exec_ratchet_module()` (:706) so the lock covers BOTH halves as one indivisible window -- a mutation landing between the read and the exec would be just as wrong. `target` is an optional override so the check can point the loader at a scratch file. Pinned by `test_module_load_is_serialized_against_concurrent_mutation` (:1112) -- mutates a marker file under the lock in one thread while a loader thread runs, and asserts the loader CANNOT finish while the mutation is in effect. Killed by `test_mutation_unlocked_module_load_is_killed` (:1311), which rewrites the harness's own loader back to the unlocked form. (B) THE LOCK HOLDER MUST NOT BE ABLE TO HANG. `_run_pytest()` called `subprocess.run` with NO `timeout=`, and it runs INSIDE the mutation lock -- so a hung child held the lock forever and every other case blocked behind it. This is the round-3 POSIX-lock finding turned on its owner: a lock whose HOLDER can hang has no deadline at all, whichever platform it runs on. `_run_pytest()` (:621) passes a real `timeout=` and converts `subprocess.TimeoutExpired` into `PytestRunTimeout` (:373), whose message (:599) names the deadline, the argv/`select` (the test being run), and states that the lock is about to be released and the mutated file restored. The deadline comes from `_pytest_timeout_seconds()` (:576) and is overridable via PMOVES_MAVIS_RATCHET_PYTEST_TIMEOUT; a bad or non-positive override falls back to the DEFAULT rather than disabling the deadline. Lock release was already structural: `_mutation_case()` (:754) holds the lock via `with _mutation_lock(...)` across all three phases and the byte-exact restore is in a `finally` INSIDE that block, so the timeout path restores the file BEFORE releasing the lock. `_mutation_case` gained an optional `lock_path` so a case running inside a child pytest does not contend for the shared lock. Pinned by `test_pytest_run_timeout_fires_and_releases_the_lock` (:1182) -- drives a genuinely hanging module through `_mutation_case` with an 8s override, then asserts the timeout fired with a message naming `8s`/`test_slow`/the lock, that the lock is acquirable again (checked in a thread, so a leaked non-reentrant lock fails rather than deadlocks), and that the mutated file is back to its original bytes. Killed by `test_mutation_pytest_run_without_timeout_is_killed` (:1333). TIMEOUT 300s, chosen from measurement: the slowest LEGITIMATE single pytest subprocess run is 1.6s including interpreter and pytest startup, so the deadline carries ~180x headroom. The deadline is PER-SUBPROCESS, not per-case, so the 48s mutation case is unaffected. Measured: harness -v (14 cases) -> 14 passed in 106.7s; ratchet -> 11 passed / 1 skipped (the network-gated matrix cross-check); the pair with PMOVES_MAVIS_MATRIX_CHECK=1 -> 26 passed (the live probe ran and passed); the pair with `mavis` off PATH -> 23 passed / 3 skipped, every mutation-kill still firing. pmoves/tests/test_mavis_cli_timeout.py was NOT touched by this round.
…vis ratchet round 4
…died with the child
Defect I -- a deadline that a typo can switch off is not a deadline. _pytest_timeout_seconds() guarded the PMOVES_MAVIS_RATCHET_PYTEST_TIMEOUT override with 'value <= 0'. But float('nan') compares False against EVERYTHING, so a 'nan' override sailed past the guard and BECAME the deadline -- and a nan deadline never fires, so the run it was meant to bound was unbounded and the mutation lock could be held forever. 'inf' is the same hole with a slower fuse. FIX: _validated_deadline() rejects anything that is not FINITE and POSITIVE and falls back to the default. Pinned by test_nonfinite_timeout_override_falls_back_to_default; killed by test_mutation_nonfinite_timeout_override_is_killed.
Defect J -- the deadline must survive the KILL. On POSIX, CPython's timed-out subprocess.run path kills the child and calls process.wait() -- bounded. On WINDOWS the same path calls process.communicate() with NO timeout after the kill: an UNBOUNDED read. This harness spawns nested pytest subprocesses BY DESIGN, so a killed inner pytest can leave GRANDCHILDREN behind, and a surviving grandchild holds the stdout pipe open. The unbounded post-kill read then blocks FOREVER, PytestRunTimeout never raises, and the mutation lock is never released -- on the one platform where the guarantee was supposed to be airtight. FIX: the child starts in its OWN process group (start_new_session=True / CREATE_NEW_PROCESS_GROUP); _kill_process_tree() kills the whole GROUP (os.killpg) on POSIX and the whole TREE (taskkill /T /F) on Windows; _drain_process_output() drains the pipes with its OWN bounded communicate(timeout=) and closes them if a survivor still holds them open. PytestRunTimeout is raised on every branch, so the message contract holds on both platforms. Pinned by test_post_kill_drain_is_bounded_when_a_pipe_holder_survives against a fake child whose pipe is held open by a survivor; killed by test_mutation_unbounded_post_kill_drain_is_killed and test_mutation_direct_child_kill_is_killed.
MEASURED: harness 19 passed (128.7s); ratchet 11 passed / 1 skipped (the network-gated matrix cross-check). LEARNINGS lessons #24-#25.
…vis ratchet round 5
The merge gate's python-tests job failed on this branch at head f9cec95 with a finding that was not a defect: --- pmoves/tests/tools [2] timed out; isolating 20 files (budget 600s) --- --- no report for pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py (exit -1) --- The mutation-kill harness is healthy and SLOW. Its 19 cases each run three phases (GREEN before -> RED under mutation -> GREEN after restore) and each phase spawns a full child pytest: 19 x 3 = 57 startups at ~1.7s each, so ~97s is the floor before any deliberate timeout wait. The runner had no way to say "this file is legitimately expensive" -- chunks were built by FILE COUNT as a proxy for cost -- so the chunk was killed at 120s, the 60s per-file isolation killed the same file AGAIN, and the file's real result was replaced by a false "no report" ERROR. The fix is the budget model, not a suppression. A new sibling config, pmoves/configs/pytest_ratchet/_slow_files.yaml, declares a slow file and the extra seconds it gets; the runner hand-parses it (no new dependency, same style as _known_failures.yaml) and a missing file is an empty allowance rather than an error. * chunk_timeout_seconds(files) = GROUP_TIMEOUT_SECONDS + the sum of the chunk's allowances, so the chunk holding the harness is not killed before the harness can report. * file_timeout_seconds(file) = FALLBACK_FILE_TIMEOUT + that file's own allowance, so the file is still MEASURED if some other reason times the chunk out. Both are pure, and both apply the allowance in BOTH places the budget applies. Every file with no allowance gets EXACTLY the old GROUP_TIMEOUT_SECONDS / FALLBACK_FILE_TIMEOUT, so hang detection is not weakened anywhere else. The negative control (test_the_allowance_is_driven_by_the_config_not_by_the_code) proves the extra time is driven by the config and can be taken back. Measured (Windows, Python 3.12.10, pytest 9.1.1): * pmoves/tests/tools/test_pytest_ratchet.py 31 passed (20 + 11 new) * pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py 19 passed in 116.29s (121.3s before the trim) * pmoves/tests/test_mavis_cli_timeout.py 11 passed, 1 skipped * the harness run UNDER THE NEW CHUNK BUDGET: rc=0, JUnit report written, 0 findings, 118.5s -- MEASURED, where the old budgets lost it The harness's own deliberate waste is trimmed too: the mutated slow module now sleeps 12s instead of 20s, still comfortably longer than the 8s override, so the timeout still fires first and the mutated run still finishes. No assertion was changed and no case was dropped.
…chet round 6 Round 6 is the first round in this lane whose subject is the GATE rather than the ratchet it gates: the gate could not tell "broken" from "slow", and reported a healthy file as broken. #26 contract-correctness a budget measured in FILE COUNT is not a budget measured in COST #27 reasoning-gap "no report" conflates "hung" with "out of budget", and a false BROKEN is worse than a missing result #28 defense-in-depth an allowance must be REMOVABLE: with the entry gone the budgets fall back to exactly the old values #29 pattern-conformance a declared cost belongs in a reviewable config beside the baseline, parsed without a new dependency Adds the CI evidence verbatim, the round-6 measurement table, and the SDK provenance table (file -> symbol anchor -> what it does). The AGNOTE row for this round is filed by the register owner.
…rted as a broken one
aac9570 to
d39b11c
Compare
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 8ce0d3f4f3a4 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
…ithout a sound Two holes in round 6's own fix, both found by the review of that change. (1) THE ESCAPE HATCH HAD A TRAPDOOR -- round 6 widened the CHUNK budget (120 -> 720s) and the PER-FILE budget (60 -> 660s), but left FALLBACK_BUDGET_SECONDS (600s) still bounding the whole isolation pass. Since the per-file budget can now hand ONE file 660s, a chunk that timed out anyway could exhaust the flat pass budget BEFORE reaching the harness -- and the '--- fallback budget exhausted; N files unmeasured ---' path would re-declare the very file the allowance exists to defend as BROKEN, with less signal than round 6 had. The allowance admitted the file at the door and priced it out at the window. FIX: fallback_budget_seconds() = FALLBACK_BUDGET_SECONDS + the sum of the chunk's allowances, and the isolation loop compares spent against it. A chunk with no declared-slow file gets EXACTLY 600s -- the default path is numerically unchanged. (2) A BUDGET-OWNING LINE THAT FAILED TO PARSE VANISHED WITHOUT A SOUND -- load_slow_file_entries() skipped any unmatched line inside the slow_files: block, so a typo'd path, '600s' instead of '600', or a mis-nested line silently stripped the file's allowance and CI then re-reported it as BROKEN with LESS signal than before. Silence is fine for prose; this parser is the single source of a budget. FIX: a one-line stderr warning quoting the raw line. A line OUTSIDE the block stays quiet -- only a budget-owning line is worth a sound. (3) FOUND BY THE MUTATION CHECK, NOT BY A REVIEWER -- the first version of the fix for (1) shipped a test that called fallback_budget_seconds() and compared the result. That test SURVIVED the mutation reverting the CALL SITE to the flat budget: the helper was intact and correct while the runner kept using the old currency. A green test, a correct helper, a broken runner. The test now drives run_chunk_with_fallback() itself with the pass budget exhausted and requires the declared-slow file to still be MEASURED rather than declared dead -- with the flat budget the loop breaks on its first check and the file lands in dead, which the runner reports as BROKEN. MEASURED: pmoves/tests/tools/test_pytest_ratchet.py -> 38 passed (31 after round 6 + 7 new); the anchor ratchet -> 445 total, 445 baselined, 0 new -- PASS; the register postdate check -> clean. MUTATION PROOF: M1 (the pass budget reverts to the flat default) and M2 (the unparseable-entry warning is removed) are both KILLED, and the restore is byte-exact with the suite green again. LEARNINGS lessons #30-#32 added to the 4-bucket x 5-class taxonomy (contract-correctness now leads with 15 of 32).
…oor and a typo vanished without a sound
ORGSIM-MIRROR drift check (advisory, fail-soft)vv3 / 7 files / VERIFIED 99 / UNDECIDED 61 / digest 47f5dbaf66d1 Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py |
Summary
The test-gap ratchet slice shipped in PR #3095. A follow-up audit on 2026-10-30 found that the ratchet itself could not say no — two defects, plus a third surfaced while repairing them. All three are the exact failure mode this lane exists to prevent: a ratchet reporting GREEN while the thing it guards is broken.
This PR fixes all three load-bearingly and preserves the original defect as a tracked mutation-kill so it can never silently return.
Defect A — stderr accepted as a version string
The shipped
mavis --versiongate was:Node's module loader writes
Error: Cannot find module '<path>'to stderr and exits 1. A 100%-broken launcher therefore satisfied the non-empty assertion.Measured on the operator's host before this fix:
Repair: the gate is extracted to
_assert_healthy_version_output()(pmoves/tests/test_mavis_cli_timeout.py) and asserts what a working CLI has and a broken one cannot fake:error:/cannot find module/traceback/not found, because some launchers print the error to stdout and still exit 0.The
--helpgate gets the same treatment (rc must be 0 or 2; stdout-only).Defect B — the upstream pin pointed at a 404
The matrix cross-check pinned
MiniMaxInc/MiniMax-Code, which does not exist:The real upstream is
MiniMax-AI/minimax-code. A 404 body is a JSON object where the helper expected a list, so the fetch hit thenot isinstance(payload, list)branch and returnedNone— the cross-check degraded to a permanent SKIP. It could never report green or red.Repair: the pin is corrected to
MiniMax-AI/minimax-codeand the pin itself is now assertable (test_mutation_wrong_upstream_repo_is_detectable).Defect C — filename-derived platform set (found while repairing B)
The platform detector scanned workflow filenames for
ubuntu/macos/windows. Upstream's actual workflow filenames are:Not one carries an OS name. The upstream matrix is declared inside
ci.yml's body asruns-on: ${{ matrix.os }}withos: [ubuntu-latest, macos-latest, windows-latest]. The filename scan therefore returned an empty set, soassert "windows" in platformswould have FAILED once enabled — the ratchet was inverted, reporting "upstream does not cover Windows" for an upstream that does.Repair:
_fetch_upstream_matrix()now fetches each workflow'sdownload_urlbody and scans for the runner labels.The upstream matrix answer (the operator's actual question)
Upstream's Linux matrix is GREEN, and upstream DOES cover Windows.
MiniMax-AI/minimax-code'sci.ymldeclaresos: [ubuntu-latest, macos-latest, windows-latest]withprofile: fullon Ubuntu and a focusedprofile: windowson Windows ("Windows runs a focused contract; full capability coverage remains on Linux/macOS").Live probe 2026-10-30:
{'platforms': ['macos', 'ubuntu', 'windows'], 'status': 'ok'}So the operator's 240s timeout is the platform-specific Windows case (operator's lane), not a known-broken upstream — but only once the ratchet can actually read the matrix, which it previously could not.
Mutation-kills — the load-bearing proof
pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py(NEW, 3 tests) rewrites the gate and the upstream pin back to their original defective forms and asserts the ratchet module then FAILS:The meta-lesson (recorded as lesson #12): the first attempt at this harness re-implemented the gate inline instead of invoking it. Restoring the original defective gate left the suite at 7 passed — the mutation survived. The gate is now shared between the ratchet and the mutation-kill, so the two are genuinely coupled. A mutation-kill that restates the assertion instead of invoking it proves nothing.
Host shim repair
~/.minimax/bin/{mavis,minimax}.cmdpointed at...\MiniMax Code\resources\resources\daemon\cli.js— a path that no longer exists (the daemon now ships insideapp.asar; neither the doubled nor the single-resourcesvariant resolves on disk).Per the operator's direction that the CLI runs from our fork, both shims now exec the fork build:
Node 22.22.1 is required — the host's default
nodeis 22.17.1 and@minimax-ai/coderequires>=22.19 <23 || >=24.2 <27.Result:
mavis --version→0.6.5, rc=0, 0.47s. The ratchet now passes legitimately rather than vacuously.The fork build came from
POWERFULMOVES/PMOVES-minimax-codefast-forwarded to upstreammainvia PMOVES-minimax-code#1 (pnpm build→Built MiniMax Code 0.6.5 from 6285 source files).Tests
pmoves/tests/test_mavis_cli_timeout.pyPMOVES_MAVIS_MATRIX_CHECK=1pmoves/tests/tools/test_mavis_ratchet_mutation_kill.pypmoves/tests/test_kilo_binary_path.pyDocs + SDK provenance
pmoves/docs/AGENTS/test_gap_ratchet_LEARNINGS.md— lessons docs(yt): clarify summary styles and chapter extraction #9–test(pmoves-yt): add endpoint tests #12 added to the 4-bucket × 5-class taxonomy (now 12 lessons, cross-check re-tallied to reasoning-gap 3 / semantic-naming 1 / contract-correctness 3 / defense-in-depth 5); the post-merge correction table and the upstream-matrix answer recorded; SDK-provenance and live-state sections updated with the 2026-10-30 measurements.pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md— CLAIM row2026-10-30T23:00:00Z, signature5090-CLAUDE, unsigned-local, with full SDK file:line provenance, the measured before/after, and cross-references.pmoves/tests/test_mavis_cli_timeout.py(+360 lines net) ·pmoves/tests/tools/test_mavis_ratchet_mutation_kill.py(135 lines, NEW) · the two docs files above.pmoves_launcher_generator_LEARNINGS.mdlesson docs(yt): clarify summary styles and chapter extraction #9 ("a test that can only assert absence cannot say no") ·pmoves/tests/test_kilo_binary_path.py::test_mutation_js_only_path_fails_ratchet(the sibling mutation-kill idiom this correction follows).No workarounds. Every fix is an SDK-file change with a load-bearing mutation-kill. No behaviour was suppressed, skipped, or loosened to make a test pass.
+1 from Mavis.