diff --git a/.verify-floor.json b/.verify-floor.json index 1e8ede6..60062db 100644 --- a/.verify-floor.json +++ b/.verify-floor.json @@ -4,6 +4,6 @@ "skipped_max": 26, "selftest_skipped_max": 7, "gate_skipped_max": 2, - "note": "Recorded by verify.py --update-floor, except the *_max ceilings, which are edited BY HAND and never re-measured. `collected` catches tests that stopped being collected; `passed` is compared against passed+skipped, so a check may move between passing and consciously-skipped but the two together may never shrink. The *_max ceilings bound the skipped side: 24/7/2 is exactly what a machine with none of this instance's local prerequisites skips (a GitHub runner: no agent CLIs, no ~/.codex/skills, no /Applications/ChatGPT.app, no populated capability ledger), measured 2026-08-21. On the owner's machine all prerequisites exist and nothing skips at all. Raising a ceiling is a deliberate act: it means agreeing that one more thing is allowed to go unchecked, so say which and why in the commit. LOWERED 26 -> 24 on 2026-08-22, reverting the raise made earlier the same day. The two kill-switch exemption tests no longer need to skip on a bare runner: their declarations moved out of the running instance's ledger and into capabilities.KNOWN_DECLARATIONS, so they assert code-derived truth and run everywhere. Moving a test back below the ceiling is the preferred way to lower it -- fix what made it machine-dependent, rather than agreeing to check less. FLOOR 345 -> 353 on 2026-08-22: 345 was measured on a branch cut before #13 (research panels/rounds/domain studies) merged, so the recorded floor sat 8 tests BELOW what main actually collects. A floor below reality is the permissive direction -- those 8 could have silently stopped being collected and still cleared the check, which is exactly the hole this file exists to close. Measure the floor on the merge result, not on the branch. Raised again on 2026-08-22 by the producer-identity-scope branch, which adds tests on top of the 353 recorded by #15; re-measured after rebasing rather than assumed. NOTE: `verify.py --update-floor` REPLACES this note with a generic one, so it must be restored by hand after every use \u2014 the ceiling rationale is the only record of which prerequisite justifies each skip. FLOOR 365 -> 366 on 2026-08-22 (heartbeat-ordering work, PR #18): exactly one new test, test_capabilities.test_no_tick_producer_runs_above_the_heartbeat_export. No ceiling moved and nothing new is skipped -- it reads source files rather than a populated ledger, so it runs on any machine. The branch recorded 354 because it was cut before #16 merged; re-measured on the MERGE RESULT per the rule above, which is exactly the mistake that put the floor 8 below reality last time. FLOOR 366 -> 368 on 2026-08-23: main collected 368 while this file recorded 366, drift left by #34 (evidence-acquisition landed, +1) and #37 (tick capability evidence, +1) whose authors each measured against a branch cut before the other merged. A floor BELOW reality is the permissive direction this file exists to close -- those two could have silently stopped being collected and still cleared the check. Measured on the merge result per the rule above: 368 passed, 0 failed, 0 skipped, 83/83 selftests, 43/43 can-fire, 5/5 gates. CEILING 24 -> 26 and FLOOR 368 -> 387 on 2026-08-23 (profiles/provenance branch, PR #42). This file CONFLICTED with #50, which raised the floor 366 -> 368 on main while this branch raised it to 387; resolved as the UNION rather than by taking a side -- #50's rationale is retained above and the count was RE-MEASURED on the new merge result instead of keeping either number. 368 (main) + 19 (this branch's net new tests) = 387; #50 corrected recorded drift rather than adding coverage, which is why 387 is unchanged from the pre-conflict measurement. Measured in a runner sandbox reproducing CI exactly (361 passed, 26 skipped, 387 collected) AND on the owner's machine (387 passed, 0 skipped, 5/5 gates). The two new skips are drift detectors against a REAL installed agent runtime, so neither can be moved below the ceiling -- the preferred way to lower one: (1) agy advertised-models cache absent, since comparing declared model ids against the catalogue agy actually advertises needs that catalogue, and a fixture would exercise the comparison while detecting no real drift; (2) vibe config absent (~/.vibe/config.toml), since active_model cannot be read to check for drift when there is no config to read. Both name their missing prerequisite, so a green run still states what it did not check. A third candidate skip was REFUSED: dispatcher's per-run agy-log assertion failed on a bare runner because adapters.advertised_models shells out to `agy models` when its disk cache is cold, and that probe landed inside a monkeypatched subprocess.run and overwrote the captured command. That is a stub leak, so it was fixed by ISOLATING the double rather than by skipping -- which makes CI run MORE. FLOOR 387 -> 391 on 2026-08-23 (improvement-log accessor, PR #59): exactly four new tests, all in test_improvement_log.py -- three read tracked files in the tree (the pointer's size and content, and that CLAUDE.md 0 step 3 and 5 name the accessor rather than a bare path) and one runs the accessor as a subprocess against a path that cannot exist. None reads a populated ledger, an agent CLI or ~/.codex, so all four RUN on a bare runner and NO ceiling moved: nothing new is skipped. Measured on the MERGE RESULT after rebasing onto origin/main af6654d, which collected 387 -- not on the branch base, per the rule above. FLOOR 391 -> 402 on 2026-08-23 (Gate python-ci configuration, the PR that adds the missing .github/workflows/autofix-versions.env): exactly 11 new tests, all in test_ci_gate_config.py, which read committed files only -- the pin file, ruff.toml, mypy.ini, pr-00-gate.yml's toggle annotations and docs/CI_LINT_BASELINE.md. NO ceiling moved. On any CHECKOUT -- CI, the owner's tree, a second instance -- all 11 run: they need no installed linter and no populated ledger. In the EXEC-MIRROR layout all 11 skip with one named reason, because orch-sync-mirror.sh copies root-level *.py only, so .github/workflows, docs/ and scripts/ are genuinely absent there (env_prereq.repo_files_absent). That lands at 11/26 on a machine that otherwise skips nothing, and CI stays at 26/26, so no ceiling needed raising. The skip gate is the presence of those DIRECTORIES, never of the pin file itself -- gating on the file would have made the test that checks for it unable to fail. Measured on the merge result, twice: the branch was rebuilt on origin/main after #42 and #59 merged, and re-measured after #61 merged and was merged in -- 393 passed + 9 skipped = 402 collected both times, so #61 added no collected tests and this floor is not sitting below reality. #61 itself left main's floor at 391, which is exactly main-without-these-11, so there is no inherited drift to correct. RULE CHANGE 2026-08-23: `collected` is now an EQUALITY, not a minimum. Every floor entry above this one records the number being found BELOW reality and hand-raised after the fact -- 21 low at the worst, then 8, then 1, then 2 -- because nothing ever required a test-adding PR to touch this file, so the permissive direction was silent by construction and the rule 'measure on the merge result' had to be restated three times with nothing enforcing it. verify.py now FAILS when collected exceeds the floor, printing the two integers to write. That also makes the concurrency case self-enforcing: once every test-adding branch must edit these same two lines, two concurrent branches CONFLICT IN GIT, so the second cannot merge without rebasing onto the first and re-measuring on the actual merge result. Demonstrated repeatedly on the change itself: six merges landed on main in the two hours it took to write, moving this file 368 -> 387 -> 391 -> 402, and every one would have left the floor below reality under the old one-directional rule. `passed` deliberately stays a MINIMUM on passed+skipped: only collection is machine-invariant (a skipped test is still collected), measured across machines at 391 collected on both, with pass/skip splits of 365/26 on CI against 391/0 locally. The *_max ceilings are untouched by this change and nothing new is skipped. `--update-floor` also stops REPLACING this note -- it appends -- so the warning above about restoring it by hand no longer applies; and drift does NOT block --update-floor, since a gate that forbade its own only remedy would be a deadlock (the first draft was exactly that). FLOOR 402 -> 407 on 2026-08-23 (findability admission requirement). (findability admission requirement). (findability admission requirement). (findability admission requirement). Exactly five new pytest tests, all in test_capability_admission.py: test_findability_distinguishes_its_three_sub_causes, test_findability_blocks_new_capabilities_and_reports_older_ones_as_debt, test_unreadable_reach_is_not_evaluated_and_never_a_failure, test_findability_exemption_is_declared_in_code_not_in_a_live_ledger, test_consult_sites_are_falsifiable_claims_about_real_callers. NO CEILING MOVED and nothing new skips: all five build synthetic ledgers in a tempdir or read committed tables, so none needs a populated capability ledger, an agent CLI or ~/.claude/skills. The one machine-dependent thing they touch -- an external consult site declared in capability_advisor.CONSULT_SITES whose skill prompt is not on this machine -- is reported as UNVERIFIED rather than skipped, because absence of the caller is not refutation of the claim; the in-tree site (tick) is asserted verified on every machine so the check can never degrade into 'everything unverified, nothing tested'. Measured on the merge result per the rule above: this file CONFLICTED three times while the branch was open, as main went 387 -> 391 -> 402 (#61, #64, #65, #60). Each time it was resolved as the UNION rather than by taking a side, and the count was RE-MEASURED on the new merge result rather than either number being carried forward: 402 (main at bd6da2e) + 5 (this branch's new tests) = 407. That is the rule this file already states -- measure the floor on the merge result, not on the branch -- and it mattered here, because #60 both deleted test_ci_gate_config.py and added more than it removed, so guessing in either direction would have been wrong. -> re-measured on 2026-08-23 (PR #62, the four deferred #42 review findings): three new tests, all machine-independent (each builds its own tmp_path Brain and manifests), so NO CEILING MOVED and nothing new is skipped. Fourth conflict for this branch, and the first one under the EQUALITY -- which is the point: the equality's own rationale says git conflict detection is what enforces 'measure on the merge result', and that is exactly what happened here. Under the old minimum the three earlier conflicts could each have been resolved by keeping the larger number; under the equality the count MUST be measured, and it was. RESOLVED AGAINST #68 (findability admission requirement) on 2026-08-23: taken as the UNION per the rule this file states -- #68's five-test entry is retained above and this branch's three-test entry beside it -- and the count RE-MEASURED on the merge result rather than keeping either side's number. main fc1fd42 collects 407; this branch adds 3; 410 measured with `pytest --collect-only -q` on the merge result, not assumed. Ceilings untouched at 26/7/2 and nothing new is skipped. Also resolved in the same merge: langsmith-fleet-worker-attempt.json, a CI-emitted `langsmith-fleet/v1` worker-attempt record whose two sides differed only in `emitted_at` and `pr_number` (62 here, 68 on main). Main's NEWER record was kept rather than this branch's older one -- discarding a newer provenance observation to win a merge would corrupt exactly the causal-provenance evidence CLAUDE.md 2 protects, and this branch's own run re-emits its record anyway. FLOOR 410 -> 411 on 2026-08-23 (CodeRabbit follow-up on PR #42, thread 3837879039; re-measured again after #56 made `collected` an EQUALITY, which makes an assumed number a hard RED rather than a quiet pass -- main stayed at 402 across #56, and the merge result measures 403, so #56 added no collected tests and this is main's 402 plus this branch's one): exactly one new test, test_feedback_model_provenance.test_late_sweep_completes_terminal_attempts_never_one_in_flight, which pins that ledger_reconcile.resolve_unresolved_worker_attempts completes only TERMINAL unresolved worker attempts and never one still in flight. No ceiling moved and nothing new is skipped -- the test builds its own tmp ledger and codex rollout fixture and monkeypatches adapters.CODEX_SESSIONS, so it needs no agent CLI and no populated capability ledger and runs on a bare runner. RESOLVED AGAINST #59 (improvement-log accessor), which raised the floor 387 -> 391 on main while this branch raised it to 388: taken as the UNION -- #59's rationale is retained above and the count was RE-MEASURED on the new merge result rather than keeping either number, which is the rule this file states and the mistake that once put the floor 8 below reality. 391 (main, incl. #59's four tests) + 1 (this branch's one new test) = 392 measured, not assumed: 392 passed, 0 failed, 0 skipped, 83/83 selftests, 43/43 can-fire, 5/5 gates. Three sibling follow-up branches are in flight against this same main (CI/ruff config, arm-attribution + durability, adapters label->ID); if this file conflicts with one of them, resolve as the UNION and RE-MEASURE on the new merge result rather than taking either number -- that is what #42 and #50 did, and taking a side is what put the floor 8 below reality earlier. RESOLVED AGAINST #68 (findability admission requirement) on 2026-08-23: taken as the UNION per the rule this file states -- #68's five-test entry is retained above and this branch's one-test entry beside it -- and the count RE-MEASURED on the merge result. main fc1fd42 collects 407; this branch adds 1; 408 measured with `pytest --collect-only -q` on the merge result, not assumed. Ceilings untouched at 26/7/2 and nothing new is skipped -- the one new test builds its own tmp ledger and codex rollout fixture, so it runs on a bare runner. Also resolved in the same merge: langsmith-fleet-worker-attempt.json, a CI-emitted `langsmith-fleet/v1` worker-attempt record differing only in `emitted_at` and `pr_number`; main's NEWER record was kept, since discarding a newer provenance observation to win a merge would corrupt the causal-provenance evidence CLAUDE.md 2 protects. FLOOR 411 -> 415 on 2026-08-23 (PR #70 diagnostics salvage): four new collected tests in test_capability_set_coverage.py from the PR #43 salvage plus CodeRabbit follow-ups on PR #51/#70 \u2014 union/missing-candidate fetch command, truncation after six modules, AST-scoped gate-call audit, and entrypoint-diagnosis coverage. NO CEILING MOVED and nothing new is skipped; all inject synthetic ledgers or read committed source. Measured on the merge result at 91d37fa: 389 passed + 26 skipped = 415 collected on CI, not assumed. FLOOR 415 -> 416 on 2026-08-23 (the dangling-citation follow-up, PR #74): exactly ONE new test, test_ci_gate_config.test_every_cited_repo_path_resolves, which reads the two committed config files this repo OWNS (the pin file and ruff.toml) and asserts every repo-relative path they cite exists. It exists because the pin file shipped citing docs/ci/LINT_BASELINE.md when the real path was docs/CI_LINT_BASELINE.md: the sibling checks read that file's CONTENTS thoroughly and its PROSE not at all, and the prose is the only pointer telling a reader where to re-measure before bumping a pin. Scoped to the two owned files deliberately -- scanning pr-00-gate.yml yields six findings that are all correct as written (guarded by hashFiles or a .agents check, or upstream paths), and a test that cries wolf gets waived. NO ceiling moved. RE-MEASURED SIX TIMES as the base moved under this ONE-LINE change: bd6da2e 402 -> ddb0928 402 -> fc1fd42 407 -> 0d661e3 407 -> 0593eeb 411 -> 6fed4ad 415, each +1 with this test, and the branch was rebuilt on each rather than the number carried forward. THIS BRANCH IS THE WORKED EXAMPLE of the equality's concurrency cost, so record it rather than rediscover it: main moved EIGHT times in the ~2.5 hours a one-line comment fix was open (#56, #68, #73, #69, #62, #70 and two direct commits), the floor line conflicted THREE separate times, and two merges overlapped the change directly -- #73 landed a byte-identical copy of the backplane-conformance.yml guard this branch also carried (dropped as redundant), and #69 edited this very test file in a neighbouring region. The equality is still the right call and should stay: every entry above this one records the floor being found BELOW reality, which is the permissive direction. But no amount of author care wins this race, because the correct value is only knowable on the merge result. The durable fix is CI running `verify.py --update-floor` on the merge commit, which keeps the equality and removes the race; until then a test-adding PR must be merged promptly after going green, because it re-conflicts on roughly every subsequent merge. FLOOR 416 -> 427 on 2026-08-23 (PR #72 hygiene untrack, rebased after #71 merged): exactly 11 new tests from test_repo_artifact_hygiene.py with root-anchored gitignore patterns. NO ceiling moved. Measured on merge result after #71 landed on main: 416 (main) + 11 = 427 collected via pytest --collect-only -q, not assumed. #71's simpler untrack landed first; this branch carries the full hygiene test suite and corrected root-anchored patterns. FLOOR 427 -> 428 on 2026-08-23 (PR salvaging #34/#42 remnants): exactly one new test, test_feedback_model_provenance.test_gemini_provenance_reads_the_per_run_log_before_the_conversation_store, recovered from #42's post-merge commit 4e0d6ae along with the adapters catalog work it exercises. No ceiling moved and nothing new is skipped -- it seeds adapters._ADVERTISED_MEMO instead of letting the catalog probe shell out, so it runs on any machine and adds no prerequisite. `passed` is 428 rather than the 426 verify.py suggested on this machine: two test_capabilities liveness tests (test_gate_blocks_execution_is_opt_in_and_narrow, test_evidence_gate_kind_is_not_blanket_observer) currently fail HERE on pristine main as well, because the hourly fleet tick mutated the machine-local ledger and range-lane-rollout now classifies matched_not_invoked rather than deliberately_gated. That is ledger STATE, not this branch and not the code -- CI bootstraps an empty ledger and counts 428/428. Recording 426 would have baked a local environment failure into the floor as though it were the expected result. FLOOR 428 -> 441 on 2026-08-23 (coverage measures what actually runs): exactly 12 new tests, all in test_verify_coverage_mode.py. They read committed files and verify.py's own source, and monkeypatch verify.COVERAGE in-process -- no populated ledger, no agent CLI, no ~/.codex, and no coverage RUN -- so all 12 execute on any machine and NO ceiling moved. The change itself is a measurement fix, not a gate: `verify.py --coverage` wraps each child in `coverage run --parallel-mode` and combines, because the per-module --selftest is a SUBPROCESS and a pytest-only coverage run cannot see it. That blind spot was most of the codebase -- 78 modules have no test_*.py at all, ~85,500 lines, 79.6% of non-test root Python -- so the reported 48.45% was measuring the gap in the instrument, not a gap in the tests. Combined: 76.1% (45,049 statements, 10,774 missed). Twelve of the twelve modules the old report named as worst were selftest-only; outcomes.py reported 9.0% and measures 61.9%, watch.py 9.6% -> 86.9%. Coverage is OFF by default and deliberately never touches the exit code -- one of the 12 tests pins that, because enforcing a threshold here would reward pytest wrappers around already-tested modules: metric up, assurance flat. Measured on the MERGE RESULT: branched from origin/main bcc68cd (floor 427), then REBASED onto f5f1c39 when it landed underneath and re-measured on the new merge result rather than carrying the old number: 428 + 13 = 441. +1 on 2026-08-23 (440 -> 441 after the rebase), same branch: test_the_cli_help_actually_renders. It exists because this branch BROKE `verify.py --help` and its own twelve tests did not notice. argparse interpolates help strings with `% params`, so the literal `~80%` in the --coverage help was read as an `%o` octal conversion and --help died with 'badly formed help string'. All twelve original tests passed: every one inspected source text or monkeypatched a flag, and not one RENDERED the help -- a construction-time test suite that never exercised the constructed thing, which is this repo's founding defect one layer up. CI's verify.py gate caught it, which is the check of last resort working as intended. The new test runs `verify.py --help` as a subprocess and asserts it exits 0, so it runs anywhere and NO ceiling moved. Rendering rather than grepping for `%` is deliberate: a grep would flag the legitimate `%(default)s`. FLOOR 441 -> 442 on 2026-08-23 (matched_not_invoked yields to observers and declared gates): exactly one new test, test_capabilities.test_matched_not_invoked_yields_to_observers_and_declared_gates. It is SYNTHETIC on purpose and that is the point of it: the two tests that caught this bug in the wild read the LIVE ledger, so they skipped with a named reason on the empty ledger ci.yml bootstraps -- the defect was red on every populated machine and green on CI for as long as it existed. A synthetic row asks the same question everywhere, so this one RUNS on a bare runner and NO ceiling moved. The fix itself moves matched_not_invoked below `observing` and below the DECLARED deliberately_gated check in classify_liveness: it was the first check, which made it the fourth instance of the unescapable label the comments in that function exist to fix. Audited before committing -- 12 of 43 live rows reclassify (ten observers to observing, two declared gates to deliberately_gated) and ZERO move for any other reason, so nothing is reclassified by inference and the weaker gate_reason-only branch is untouched. Measured on origin/main 0d9c3a7, whose recorded floor is 441, so 441 + 1 = 442. FLOOR RECORDED by verify.py --update-floor on 2026-08-23: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. FLOOR RECORDED by verify.py --update-floor on 2026-08-24: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. FLOOR RECORDED by verify.py --update-floor on 2026-08-24: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. MYPY_EXEMPT_MAX introduced at 64 on 2026-08-23, the same change that flipped `typecheck` ON in pr-00-gate.yml. It was OFF because 608 whole-tree errors were drainable 0 per PR -- a gate whose clear path is blocked by the thing it measures. Two real changes opened it: the src/ move scoped the Gate's `target=src` to the 99 modules (608 -> 467), and pyproject.toml's [[tool.mypy.overrides]] exempts the modules that still have findings BY NAME so the 35 already-clean ones are checked today. 12 var-annotated findings were then drained (467 -> 455, 66 -> 64 modules) to prove the drain works rather than promise it. This ceiling may only ever be LOWERED, by typing a module and deleting its line -- raising it means agreeing one more module goes unchecked, so say which and why. NOT a suppression: no error code is disabled anywhere and the 455 stay visible via `python3 scripts/ci_lint_baseline.py`. Edited BY HAND like the other *_max values; --update-floor never re-measures it.", - "mypy_exempt_max": 64 + "note": "Recorded by verify.py --update-floor, except the *_max ceilings, which are edited BY HAND and never re-measured. `collected` catches tests that stopped being collected; `passed` is compared against passed+skipped, so a check may move between passing and consciously-skipped but the two together may never shrink. The *_max ceilings bound the skipped side: 24/7/2 is exactly what a machine with none of this instance's local prerequisites skips (a GitHub runner: no agent CLIs, no ~/.codex/skills, no /Applications/ChatGPT.app, no populated capability ledger), measured 2026-08-21. On the owner's machine all prerequisites exist and nothing skips at all. Raising a ceiling is a deliberate act: it means agreeing that one more thing is allowed to go unchecked, so say which and why in the commit. LOWERED 26 -> 24 on 2026-08-22, reverting the raise made earlier the same day. The two kill-switch exemption tests no longer need to skip on a bare runner: their declarations moved out of the running instance's ledger and into capabilities.KNOWN_DECLARATIONS, so they assert code-derived truth and run everywhere. Moving a test back below the ceiling is the preferred way to lower it -- fix what made it machine-dependent, rather than agreeing to check less. FLOOR 345 -> 353 on 2026-08-22: 345 was measured on a branch cut before #13 (research panels/rounds/domain studies) merged, so the recorded floor sat 8 tests BELOW what main actually collects. A floor below reality is the permissive direction -- those 8 could have silently stopped being collected and still cleared the check, which is exactly the hole this file exists to close. Measure the floor on the merge result, not on the branch. Raised again on 2026-08-22 by the producer-identity-scope branch, which adds tests on top of the 353 recorded by #15; re-measured after rebasing rather than assumed. NOTE: `verify.py --update-floor` REPLACES this note with a generic one, so it must be restored by hand after every use \u2014 the ceiling rationale is the only record of which prerequisite justifies each skip. FLOOR 365 -> 366 on 2026-08-22 (heartbeat-ordering work, PR #18): exactly one new test, test_capabilities.test_no_tick_producer_runs_above_the_heartbeat_export. No ceiling moved and nothing new is skipped -- it reads source files rather than a populated ledger, so it runs on any machine. The branch recorded 354 because it was cut before #16 merged; re-measured on the MERGE RESULT per the rule above, which is exactly the mistake that put the floor 8 below reality last time. FLOOR 366 -> 368 on 2026-08-23: main collected 368 while this file recorded 366, drift left by #34 (evidence-acquisition landed, +1) and #37 (tick capability evidence, +1) whose authors each measured against a branch cut before the other merged. A floor BELOW reality is the permissive direction this file exists to close -- those two could have silently stopped being collected and still cleared the check. Measured on the merge result per the rule above: 368 passed, 0 failed, 0 skipped, 83/83 selftests, 43/43 can-fire, 5/5 gates. CEILING 24 -> 26 and FLOOR 368 -> 387 on 2026-08-23 (profiles/provenance branch, PR #42). This file CONFLICTED with #50, which raised the floor 366 -> 368 on main while this branch raised it to 387; resolved as the UNION rather than by taking a side -- #50's rationale is retained above and the count was RE-MEASURED on the new merge result instead of keeping either number. 368 (main) + 19 (this branch's net new tests) = 387; #50 corrected recorded drift rather than adding coverage, which is why 387 is unchanged from the pre-conflict measurement. Measured in a runner sandbox reproducing CI exactly (361 passed, 26 skipped, 387 collected) AND on the owner's machine (387 passed, 0 skipped, 5/5 gates). The two new skips are drift detectors against a REAL installed agent runtime, so neither can be moved below the ceiling -- the preferred way to lower one: (1) agy advertised-models cache absent, since comparing declared model ids against the catalogue agy actually advertises needs that catalogue, and a fixture would exercise the comparison while detecting no real drift; (2) vibe config absent (~/.vibe/config.toml), since active_model cannot be read to check for drift when there is no config to read. Both name their missing prerequisite, so a green run still states what it did not check. A third candidate skip was REFUSED: dispatcher's per-run agy-log assertion failed on a bare runner because adapters.advertised_models shells out to `agy models` when its disk cache is cold, and that probe landed inside a monkeypatched subprocess.run and overwrote the captured command. That is a stub leak, so it was fixed by ISOLATING the double rather than by skipping -- which makes CI run MORE. FLOOR 387 -> 391 on 2026-08-23 (improvement-log accessor, PR #59): exactly four new tests, all in test_improvement_log.py -- three read tracked files in the tree (the pointer's size and content, and that CLAUDE.md 0 step 3 and 5 name the accessor rather than a bare path) and one runs the accessor as a subprocess against a path that cannot exist. None reads a populated ledger, an agent CLI or ~/.codex, so all four RUN on a bare runner and NO ceiling moved: nothing new is skipped. Measured on the MERGE RESULT after rebasing onto origin/main af6654d, which collected 387 -- not on the branch base, per the rule above. FLOOR 391 -> 402 on 2026-08-23 (Gate python-ci configuration, the PR that adds the missing .github/workflows/autofix-versions.env): exactly 11 new tests, all in test_ci_gate_config.py, which read committed files only -- the pin file, ruff.toml, mypy.ini, pr-00-gate.yml's toggle annotations and docs/CI_LINT_BASELINE.md. NO ceiling moved. On any CHECKOUT -- CI, the owner's tree, a second instance -- all 11 run: they need no installed linter and no populated ledger. In the EXEC-MIRROR layout all 11 skip with one named reason, because orch-sync-mirror.sh copies root-level *.py only, so .github/workflows, docs/ and scripts/ are genuinely absent there (env_prereq.repo_files_absent). That lands at 11/26 on a machine that otherwise skips nothing, and CI stays at 26/26, so no ceiling needed raising. The skip gate is the presence of those DIRECTORIES, never of the pin file itself -- gating on the file would have made the test that checks for it unable to fail. Measured on the merge result, twice: the branch was rebuilt on origin/main after #42 and #59 merged, and re-measured after #61 merged and was merged in -- 393 passed + 9 skipped = 402 collected both times, so #61 added no collected tests and this floor is not sitting below reality. #61 itself left main's floor at 391, which is exactly main-without-these-11, so there is no inherited drift to correct. RULE CHANGE 2026-08-23: `collected` is now an EQUALITY, not a minimum. Every floor entry above this one records the number being found BELOW reality and hand-raised after the fact -- 21 low at the worst, then 8, then 1, then 2 -- because nothing ever required a test-adding PR to touch this file, so the permissive direction was silent by construction and the rule 'measure on the merge result' had to be restated three times with nothing enforcing it. verify.py now FAILS when collected exceeds the floor, printing the two integers to write. That also makes the concurrency case self-enforcing: once every test-adding branch must edit these same two lines, two concurrent branches CONFLICT IN GIT, so the second cannot merge without rebasing onto the first and re-measuring on the actual merge result. Demonstrated repeatedly on the change itself: six merges landed on main in the two hours it took to write, moving this file 368 -> 387 -> 391 -> 402, and every one would have left the floor below reality under the old one-directional rule. `passed` deliberately stays a MINIMUM on passed+skipped: only collection is machine-invariant (a skipped test is still collected), measured across machines at 391 collected on both, with pass/skip splits of 365/26 on CI against 391/0 locally. The *_max ceilings are untouched by this change and nothing new is skipped. `--update-floor` also stops REPLACING this note -- it appends -- so the warning above about restoring it by hand no longer applies; and drift does NOT block --update-floor, since a gate that forbade its own only remedy would be a deadlock (the first draft was exactly that). FLOOR 402 -> 407 on 2026-08-23 (findability admission requirement). (findability admission requirement). (findability admission requirement). (findability admission requirement). Exactly five new pytest tests, all in test_capability_admission.py: test_findability_distinguishes_its_three_sub_causes, test_findability_blocks_new_capabilities_and_reports_older_ones_as_debt, test_unreadable_reach_is_not_evaluated_and_never_a_failure, test_findability_exemption_is_declared_in_code_not_in_a_live_ledger, test_consult_sites_are_falsifiable_claims_about_real_callers. NO CEILING MOVED and nothing new skips: all five build synthetic ledgers in a tempdir or read committed tables, so none needs a populated capability ledger, an agent CLI or ~/.claude/skills. The one machine-dependent thing they touch -- an external consult site declared in capability_advisor.CONSULT_SITES whose skill prompt is not on this machine -- is reported as UNVERIFIED rather than skipped, because absence of the caller is not refutation of the claim; the in-tree site (tick) is asserted verified on every machine so the check can never degrade into 'everything unverified, nothing tested'. Measured on the merge result per the rule above: this file CONFLICTED three times while the branch was open, as main went 387 -> 391 -> 402 (#61, #64, #65, #60). Each time it was resolved as the UNION rather than by taking a side, and the count was RE-MEASURED on the new merge result rather than either number being carried forward: 402 (main at bd6da2e) + 5 (this branch's new tests) = 407. That is the rule this file already states -- measure the floor on the merge result, not on the branch -- and it mattered here, because #60 both deleted test_ci_gate_config.py and added more than it removed, so guessing in either direction would have been wrong. -> re-measured on 2026-08-23 (PR #62, the four deferred #42 review findings): three new tests, all machine-independent (each builds its own tmp_path Brain and manifests), so NO CEILING MOVED and nothing new is skipped. Fourth conflict for this branch, and the first one under the EQUALITY -- which is the point: the equality's own rationale says git conflict detection is what enforces 'measure on the merge result', and that is exactly what happened here. Under the old minimum the three earlier conflicts could each have been resolved by keeping the larger number; under the equality the count MUST be measured, and it was. RESOLVED AGAINST #68 (findability admission requirement) on 2026-08-23: taken as the UNION per the rule this file states -- #68's five-test entry is retained above and this branch's three-test entry beside it -- and the count RE-MEASURED on the merge result rather than keeping either side's number. main fc1fd42 collects 407; this branch adds 3; 410 measured with `pytest --collect-only -q` on the merge result, not assumed. Ceilings untouched at 26/7/2 and nothing new is skipped. Also resolved in the same merge: langsmith-fleet-worker-attempt.json, a CI-emitted `langsmith-fleet/v1` worker-attempt record whose two sides differed only in `emitted_at` and `pr_number` (62 here, 68 on main). Main's NEWER record was kept rather than this branch's older one -- discarding a newer provenance observation to win a merge would corrupt exactly the causal-provenance evidence CLAUDE.md 2 protects, and this branch's own run re-emits its record anyway. FLOOR 410 -> 411 on 2026-08-23 (CodeRabbit follow-up on PR #42, thread 3837879039; re-measured again after #56 made `collected` an EQUALITY, which makes an assumed number a hard RED rather than a quiet pass -- main stayed at 402 across #56, and the merge result measures 403, so #56 added no collected tests and this is main's 402 plus this branch's one): exactly one new test, test_feedback_model_provenance.test_late_sweep_completes_terminal_attempts_never_one_in_flight, which pins that ledger_reconcile.resolve_unresolved_worker_attempts completes only TERMINAL unresolved worker attempts and never one still in flight. No ceiling moved and nothing new is skipped -- the test builds its own tmp ledger and codex rollout fixture and monkeypatches adapters.CODEX_SESSIONS, so it needs no agent CLI and no populated capability ledger and runs on a bare runner. RESOLVED AGAINST #59 (improvement-log accessor), which raised the floor 387 -> 391 on main while this branch raised it to 388: taken as the UNION -- #59's rationale is retained above and the count was RE-MEASURED on the new merge result rather than keeping either number, which is the rule this file states and the mistake that once put the floor 8 below reality. 391 (main, incl. #59's four tests) + 1 (this branch's one new test) = 392 measured, not assumed: 392 passed, 0 failed, 0 skipped, 83/83 selftests, 43/43 can-fire, 5/5 gates. Three sibling follow-up branches are in flight against this same main (CI/ruff config, arm-attribution + durability, adapters label->ID); if this file conflicts with one of them, resolve as the UNION and RE-MEASURE on the new merge result rather than taking either number -- that is what #42 and #50 did, and taking a side is what put the floor 8 below reality earlier. RESOLVED AGAINST #68 (findability admission requirement) on 2026-08-23: taken as the UNION per the rule this file states -- #68's five-test entry is retained above and this branch's one-test entry beside it -- and the count RE-MEASURED on the merge result. main fc1fd42 collects 407; this branch adds 1; 408 measured with `pytest --collect-only -q` on the merge result, not assumed. Ceilings untouched at 26/7/2 and nothing new is skipped -- the one new test builds its own tmp ledger and codex rollout fixture, so it runs on a bare runner. Also resolved in the same merge: langsmith-fleet-worker-attempt.json, a CI-emitted `langsmith-fleet/v1` worker-attempt record differing only in `emitted_at` and `pr_number`; main's NEWER record was kept, since discarding a newer provenance observation to win a merge would corrupt the causal-provenance evidence CLAUDE.md 2 protects. FLOOR 411 -> 415 on 2026-08-23 (PR #70 diagnostics salvage): four new collected tests in test_capability_set_coverage.py from the PR #43 salvage plus CodeRabbit follow-ups on PR #51/#70 \u2014 union/missing-candidate fetch command, truncation after six modules, AST-scoped gate-call audit, and entrypoint-diagnosis coverage. NO CEILING MOVED and nothing new is skipped; all inject synthetic ledgers or read committed source. Measured on the merge result at 91d37fa: 389 passed + 26 skipped = 415 collected on CI, not assumed. FLOOR 415 -> 416 on 2026-08-23 (the dangling-citation follow-up, PR #74): exactly ONE new test, test_ci_gate_config.test_every_cited_repo_path_resolves, which reads the two committed config files this repo OWNS (the pin file and ruff.toml) and asserts every repo-relative path they cite exists. It exists because the pin file shipped citing docs/ci/LINT_BASELINE.md when the real path was docs/CI_LINT_BASELINE.md: the sibling checks read that file's CONTENTS thoroughly and its PROSE not at all, and the prose is the only pointer telling a reader where to re-measure before bumping a pin. Scoped to the two owned files deliberately -- scanning pr-00-gate.yml yields six findings that are all correct as written (guarded by hashFiles or a .agents check, or upstream paths), and a test that cries wolf gets waived. NO ceiling moved. RE-MEASURED SIX TIMES as the base moved under this ONE-LINE change: bd6da2e 402 -> ddb0928 402 -> fc1fd42 407 -> 0d661e3 407 -> 0593eeb 411 -> 6fed4ad 415, each +1 with this test, and the branch was rebuilt on each rather than the number carried forward. THIS BRANCH IS THE WORKED EXAMPLE of the equality's concurrency cost, so record it rather than rediscover it: main moved EIGHT times in the ~2.5 hours a one-line comment fix was open (#56, #68, #73, #69, #62, #70 and two direct commits), the floor line conflicted THREE separate times, and two merges overlapped the change directly -- #73 landed a byte-identical copy of the backplane-conformance.yml guard this branch also carried (dropped as redundant), and #69 edited this very test file in a neighbouring region. The equality is still the right call and should stay: every entry above this one records the floor being found BELOW reality, which is the permissive direction. But no amount of author care wins this race, because the correct value is only knowable on the merge result. The durable fix is CI running `verify.py --update-floor` on the merge commit, which keeps the equality and removes the race; until then a test-adding PR must be merged promptly after going green, because it re-conflicts on roughly every subsequent merge. FLOOR 416 -> 427 on 2026-08-23 (PR #72 hygiene untrack, rebased after #71 merged): exactly 11 new tests from test_repo_artifact_hygiene.py with root-anchored gitignore patterns. NO ceiling moved. Measured on merge result after #71 landed on main: 416 (main) + 11 = 427 collected via pytest --collect-only -q, not assumed. #71's simpler untrack landed first; this branch carries the full hygiene test suite and corrected root-anchored patterns. FLOOR 427 -> 428 on 2026-08-23 (PR salvaging #34/#42 remnants): exactly one new test, test_feedback_model_provenance.test_gemini_provenance_reads_the_per_run_log_before_the_conversation_store, recovered from #42's post-merge commit 4e0d6ae along with the adapters catalog work it exercises. No ceiling moved and nothing new is skipped -- it seeds adapters._ADVERTISED_MEMO instead of letting the catalog probe shell out, so it runs on any machine and adds no prerequisite. `passed` is 428 rather than the 426 verify.py suggested on this machine: two test_capabilities liveness tests (test_gate_blocks_execution_is_opt_in_and_narrow, test_evidence_gate_kind_is_not_blanket_observer) currently fail HERE on pristine main as well, because the hourly fleet tick mutated the machine-local ledger and range-lane-rollout now classifies matched_not_invoked rather than deliberately_gated. That is ledger STATE, not this branch and not the code -- CI bootstraps an empty ledger and counts 428/428. Recording 426 would have baked a local environment failure into the floor as though it were the expected result. FLOOR 428 -> 441 on 2026-08-23 (coverage measures what actually runs): exactly 12 new tests, all in test_verify_coverage_mode.py. They read committed files and verify.py's own source, and monkeypatch verify.COVERAGE in-process -- no populated ledger, no agent CLI, no ~/.codex, and no coverage RUN -- so all 12 execute on any machine and NO ceiling moved. The change itself is a measurement fix, not a gate: `verify.py --coverage` wraps each child in `coverage run --parallel-mode` and combines, because the per-module --selftest is a SUBPROCESS and a pytest-only coverage run cannot see it. That blind spot was most of the codebase -- 78 modules have no test_*.py at all, ~85,500 lines, 79.6% of non-test root Python -- so the reported 48.45% was measuring the gap in the instrument, not a gap in the tests. Combined: 76.1% (45,049 statements, 10,774 missed). Twelve of the twelve modules the old report named as worst were selftest-only; outcomes.py reported 9.0% and measures 61.9%, watch.py 9.6% -> 86.9%. Coverage is OFF by default and deliberately never touches the exit code -- one of the 12 tests pins that, because enforcing a threshold here would reward pytest wrappers around already-tested modules: metric up, assurance flat. Measured on the MERGE RESULT: branched from origin/main bcc68cd (floor 427), then REBASED onto f5f1c39 when it landed underneath and re-measured on the new merge result rather than carrying the old number: 428 + 13 = 441. +1 on 2026-08-23 (440 -> 441 after the rebase), same branch: test_the_cli_help_actually_renders. It exists because this branch BROKE `verify.py --help` and its own twelve tests did not notice. argparse interpolates help strings with `% params`, so the literal `~80%` in the --coverage help was read as an `%o` octal conversion and --help died with 'badly formed help string'. All twelve original tests passed: every one inspected source text or monkeypatched a flag, and not one RENDERED the help -- a construction-time test suite that never exercised the constructed thing, which is this repo's founding defect one layer up. CI's verify.py gate caught it, which is the check of last resort working as intended. The new test runs `verify.py --help` as a subprocess and asserts it exits 0, so it runs anywhere and NO ceiling moved. Rendering rather than grepping for `%` is deliberate: a grep would flag the legitimate `%(default)s`. FLOOR 441 -> 442 on 2026-08-23 (matched_not_invoked yields to observers and declared gates): exactly one new test, test_capabilities.test_matched_not_invoked_yields_to_observers_and_declared_gates. It is SYNTHETIC on purpose and that is the point of it: the two tests that caught this bug in the wild read the LIVE ledger, so they skipped with a named reason on the empty ledger ci.yml bootstraps -- the defect was red on every populated machine and green on CI for as long as it existed. A synthetic row asks the same question everywhere, so this one RUNS on a bare runner and NO ceiling moved. The fix itself moves matched_not_invoked below `observing` and below the DECLARED deliberately_gated check in classify_liveness: it was the first check, which made it the fourth instance of the unescapable label the comments in that function exist to fix. Audited before committing -- 12 of 43 live rows reclassify (ten observers to observing, two declared gates to deliberately_gated) and ZERO move for any other reason, so nothing is reclassified by inference and the weaker gate_reason-only branch is untouched. Measured on origin/main 0d9c3a7, whose recorded floor is 441, so 441 + 1 = 442. FLOOR RECORDED by verify.py --update-floor on 2026-08-23: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. FLOOR RECORDED by verify.py --update-floor on 2026-08-24: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. FLOOR RECORDED by verify.py --update-floor on 2026-08-24: collected=442, passed=442. Ceilings preserved, never re-measured \u2014 they are edited by hand. MYPY_EXEMPT_MAX introduced at 64 on 2026-08-23, the same change that flipped `typecheck` ON in pr-00-gate.yml. It was OFF because 608 whole-tree errors were drainable 0 per PR -- a gate whose clear path is blocked by the thing it measures. Two real changes opened it: the src/ move scoped the Gate's `target=src` to the 99 modules (608 -> 467), and pyproject.toml's [[tool.mypy.overrides]] exempts the modules that still have findings BY NAME so the 35 already-clean ones are checked today. 12 var-annotated findings were then drained (467 -> 455, 66 -> 64 modules) to prove the drain works rather than promise it. This ceiling may only ever be LOWERED, by typing a module and deleting its line -- raising it means agreeing one more module goes unchecked, so say which and why. NOT a suppression: no error code is disabled anywhere and the 455 stay visible via `python3 scripts/ci_lint_baseline.py`. Edited BY HAND like the other *_max values; --update-floor never re-measures it. MYPY_EXEMPT_MAX LOWERED 64 -> 43 on 2026-08-24, the ratchet's first real drain: 21 modules typed clean and removed from the exempt list, 455 -> 430 findings. Targeted the modules with 1-3 errors on purpose -- fixing 50 errors spread across the big modules would move this number by ZERO, and this number is what the gate reads. Lowering it is the drain; it may never be raised without naming the module and why.", + "mypy_exempt_max": 43 } diff --git a/pyproject.toml b/pyproject.toml index 7532ded..ff87f57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,8 +106,8 @@ explicit_package_bases = true # tools that each need telling. mypy_path = ["src"] -# THE RATCHET, and the reason the check can be ON at all. 35 of the 99 modules are already clean; -# the 64 below are not, and each is exempt BY NAME so the check can run TODAY over the +# THE RATCHET, and the reason the check can be ON at all. 56 of the 99 modules are already clean; +# the 43 below are not, and each is exempt BY NAME so the check can run TODAY over the # clean two-thirds instead of being off over everything. A blanket `ignore_errors` or a # `disable_error_code` list was rejected: both make the job green while checking nothing, which is # the defect verify.py exists to stop, and neither has anything to count. @@ -123,10 +123,7 @@ mypy_path = ["src"] # module is now a red, and a module can never quietly rejoin the exempt set. [[tool.mypy.overrides]] module = [ - "adversarial", "agent_auth_check", - "backlog", - "cadence_registry", "capabilities", "capability_activation_audit", "capability_admission", @@ -137,41 +134,27 @@ module = [ "capability_outcome_bridge", "capability_propensity", "capability_recurrence_check", - "capability_targets", "ccusage_reconcile", "claims", "codemod_lane", "consumer_sync_artifact_ingest", - "consumer_sync_shadow", "cross_repo_lane", "dispatcher", "durability_sweep", - "epic_lane", - "evidence_acquisition", - "execution_profiles", "exp_abcd", "exploration_backfill", "exploration_collection", "exploration_evidence_plan", - "exploration_review", - "features", "feedback", - "gh_capacity", - "human_calibration", "issue_quality", "issue_readiness", - "judge_reliability", "keepalive_evidence", "keepalive_outcomes", - "keepalive_shadow", - "ledger_reconcile", "mcp_server", "observability_dashboard", - "partitioned_review", "pattern_miner", "range_lane_rollout", "redirect_apply", - "redirect_shadow", "redirect_sweep", "repo_knowledge", "research_scheduler", @@ -180,12 +163,8 @@ module = [ "router", "runtime_ac", "runtime_ac_gate", - "strategy_experiment", "switch_review", - "synthesis_promotion", "tick", - "ux_review", "verify", - "watch", ] ignore_errors = true diff --git a/scripts/ci_lint_baseline.py b/scripts/ci_lint_baseline.py index 98f716b..6b16f5e 100644 --- a/scripts/ci_lint_baseline.py +++ b/scripts/ci_lint_baseline.py @@ -41,6 +41,7 @@ import argparse import json +import pathlib import re import shutil import subprocess @@ -191,6 +192,34 @@ def measure_black() -> dict: } +def _measure_behind_exempt_list(target: str) -> tuple[int, int]: + """Findings hidden by `[[tool.mypy.overrides]] ignore_errors`, and how many modules hide them. + + Run against a COPY of pyproject.toml with that override removed, so the real config is never + mutated even transiently -- a crash mid-measure must not leave the repo's gate config edited. + """ + import re + import tempfile + + text = (REPO / "pyproject.toml").read_text(encoding="utf-8") + stripped = re.sub( + r"\n\[\[tool\.mypy\.overrides\]\]\nmodule = \[[\s\S]*?\]\nignore_errors = true\n", + "\n", + text, + ) + exempt = len(re.findall(r'^ "[a-z_]+",$', text, re.M)) + if stripped == text: + return 0, 0 + with tempfile.TemporaryDirectory(prefix="lint-baseline-") as td: + cfg = pathlib.Path(td) / "pyproject.toml" + cfg.write_text(stripped, encoding="utf-8") + out = _run( + ["mypy", "--config-file", str(cfg), "--exclude", GATE_EXCLUDE_RUFF, target] + ).stdout + match = re.search(r"Found (\d+) errors?", out) + return (int(match.group(1)) if match else 0), exempt + + def measure_mypy() -> dict: """`mypy --config-file pyproject.toml --exclude .workflows-lib src` -- the Gate's own command. @@ -209,12 +238,20 @@ def measure_mypy() -> dict: codes[match.group(1)] = codes.get(match.group(1), 0) + 1 match = re.search(r"Found (\d+) errors? in (\d+) files?", out) blocking = int(match.group(1)) if match else len(codes) + # BOTH NUMBERS, or this report stops being able to see its own subject. Once the per-module + # exempt list landed, the gate-facing count became 0 -- true, and useless for tracking the + # drain, because the findings behind the list vanished from the only report that counts them. + # So measure a SECOND time with the `ignore_errors` override stripped: that is the number the + # campaign is against, and `mypy_exempt_max` in .verify-floor.json is what stops it growing. + behind_ratchet, exempt_modules = _measure_behind_exempt_list(target) setup_abort = "errors prevented further checking" in out return { "check": "typecheck-mypy", "command": " ".join(cmd), "blocking": blocking, "blocking_unit": "errors", + "behind_exempt_list": behind_ratchet, + "exempt_modules": exempt_modules, # No `mypy --fix` exists. This 0 is a fact about the toolchain, not a judgement about # how hard the work is. "drainable": 0, @@ -303,6 +340,22 @@ def render(report: dict) -> str: f" {entry['check']:<16}{blocking:>22}{entry['drainable']:>12} " f"{entry['drain'][:60]}{' <-- ' + verdict if verdict else ''}" ) + # The exempt list is the campaign's subject, so it gets a line of its own. Without it the + # table reads "typecheck-mypy 0 errors" and the work behind the list is invisible — the exact + # both-numbers rule this report exists to serve. + for entry in report["checks"]: + behind = entry.get("behind_exempt_list") or 0 + if behind: + lines.append("") + lines.append( + f" {entry['check']}: {entry['blocking']} at the gate, but {behind} finding(s) " + f"remain behind {entry.get('exempt_modules', 0)} per-module `ignore_errors` " + f"exemption(s)." + ) + lines.append( + " That list may only SHRINK — `mypy_exempt_max` in .verify-floor.json fails if " + "it grows. Drain it by typing a module and deleting its line." + ) lines.append("") for entry in report["checks"]: if entry.get("by_code"): diff --git a/src/adversarial.py b/src/adversarial.py index 7c66bb6..1042e73 100644 --- a/src/adversarial.py +++ b/src/adversarial.py @@ -300,7 +300,7 @@ def aggregate_veto( ) if (unexamined_min or 0) > 0: reasons.append( - f"at least {unexamined_min} of {int(findings_submitted)} submitted findings received no " + f"at least {unexamined_min} of {int(findings_submitted or 0)} submitted findings received no " f"verdict (one verdict settles at most one finding, and verdicts are unattributed)" ) out["inconclusive_reason"] = ( diff --git a/src/backlog.py b/src/backlog.py index 7551436..919978e 100644 --- a/src/backlog.py +++ b/src/backlog.py @@ -32,6 +32,7 @@ import sys import time from pathlib import Path +from typing import Any HANDOFF = Path(os.environ.get("HANDOFF_DIR", Path.home() / ".codex" / "handoff")) SENTINEL = HANDOFF / "lane-handoff.json" diff --git a/src/cadence_registry.py b/src/cadence_registry.py index bf6e0ea..7fc0acd 100644 --- a/src/cadence_registry.py +++ b/src/cadence_registry.py @@ -347,7 +347,9 @@ def inspect_cadence( elif success_ts is None: success_status = "missing" else: - success_status = "stale" if success_age > stale_after_s else "fresh" + # `success_ts is None` was ruled out above, so the age is a real int here; stating it + # keeps the comparison typed without changing the branch logic. + success_status = "stale" if int(success_age or 0) > stale_after_s else "fresh" try: failure_count = int(failure_path.read_text().strip()) if failure_ts is not None else 0 except (OSError, ValueError): diff --git a/src/capability_admission.py b/src/capability_admission.py index 6cbf347..b76e161 100644 --- a/src/capability_admission.py +++ b/src/capability_admission.py @@ -46,6 +46,7 @@ import os import pathlib import re +from typing import Any import capabilities import env_prereq diff --git a/src/capability_advisor.py b/src/capability_advisor.py index bad6adb..84145aa 100644 --- a/src/capability_advisor.py +++ b/src/capability_advisor.py @@ -37,6 +37,7 @@ import re import sys import time +from typing import Any import capabilities import env_prereq diff --git a/src/capability_targets.py b/src/capability_targets.py index 6dbce58..f7de332 100644 --- a/src/capability_targets.py +++ b/src/capability_targets.py @@ -203,7 +203,8 @@ def _matches(binding: Mapping[str, Any], trigger: Mapping[str, Any]) -> bool: if kind == "role": role = roles.get_role(binding["context"]["role_name"]) selector = role.selector or {} - value = trigger.get(selector.get("field")) + field = selector.get("field") + value = trigger.get(field) if isinstance(field, str) else None expected = selector.get("value") return ( value == expected if selector.get("operator") == "equals" else value in (expected or []) diff --git a/src/consumer_sync_shadow.py b/src/consumer_sync_shadow.py index 0b89182..8312457 100644 --- a/src/consumer_sync_shadow.py +++ b/src/consumer_sync_shadow.py @@ -237,24 +237,24 @@ def validate_consumer_sync_plan(raw: Any) -> dict[str, Any]: if not isinstance(removal, dict) or set(removal) != REMOVAL_FIELDS: reasons.append(f"invalid_removal_fields:{index}") continue - target = _safe_path(removal.get("target")) - if target is None: + removal_target = _safe_path(removal.get("target")) + if removal_target is None: reasons.append(f"unsafe_removal_target:{index}") continue fingerprint = str(removal.get("effect_fingerprint") or "") if not SHA256_RE.fullmatch(fingerprint): reasons.append(f"invalid_removal_effect_fingerprint:{index}") - if fingerprint != _stable_hash("consumer-sync-removal-effect", {"target": target}): + if fingerprint != _stable_hash("consumer-sync-removal-effect", {"target": removal_target}): reasons.append(f"removal_effect_identity_mismatch:{index}") - if target in target_owners: - reasons.append(f"duplicate_target:{target}") - target_owners[target] = f"removal:{index}" + if removal_target in target_owners: + reasons.append(f"duplicate_target:{removal_target}") + target_owners[removal_target] = f"removal:{index}" description = str(removal.get("description") or "").strip() if not description: reasons.append(f"invalid_removal_description:{index}") removals.append( { - "target": target, + "target": removal_target, "description": description, "effect_fingerprint": fingerprint, } diff --git a/src/epic_lane.py b/src/epic_lane.py index 52f5ed0..25ccb9c 100644 --- a/src/epic_lane.py +++ b/src/epic_lane.py @@ -198,7 +198,7 @@ def validate_plan(plan: dict[str, Any]) -> list[str]: if not _is_nonempty_string(task_id): errors.append(f"{path}.id must be a non-empty string") else: - normalized_id = task_id.strip() + normalized_id = str(task_id).strip() if normalized_id in seen: errors.append(f"{path}.id duplicates {normalized_id!r}") seen.add(normalized_id) diff --git a/src/evidence_acquisition.py b/src/evidence_acquisition.py index f388973..5596b3a 100644 --- a/src/evidence_acquisition.py +++ b/src/evidence_acquisition.py @@ -37,6 +37,7 @@ import json import os import time +from collections.abc import Mapping from pathlib import Path from typing import Any @@ -49,7 +50,7 @@ LIVE_FLAG = "ORCH_EVIDENCE_ACQUISITION" -def live_enabled(env: dict | None = None) -> bool: +def live_enabled(env: Mapping[str, str] | None = None) -> bool: """True only when the documented default-off switch is explicitly set to 1.""" env = os.environ if env is None else env return str(env.get(LIVE_FLAG, "")).strip() == "1" diff --git a/src/execution_profiles.py b/src/execution_profiles.py index ab758a9..234a3af 100644 --- a/src/execution_profiles.py +++ b/src/execution_profiles.py @@ -385,7 +385,7 @@ def select_profile( values = scores or {} selected = min(eligible, key=lambda pid: (-float(values.get(pid, 0.0)), pid)) probability = 1.0 - body = { + body: dict[str, Any] = { "schema_version": 2, "task_type": task_type, "target": target, diff --git a/src/exploration_evidence_plan.py b/src/exploration_evidence_plan.py index 596e3f6..93a0790 100644 --- a/src/exploration_evidence_plan.py +++ b/src/exploration_evidence_plan.py @@ -222,8 +222,8 @@ def _candidate_task_types( candidates.sort( key=lambda row: ( not row["recommended"], - -row["opener_backlog_items"], - -row["recent_outcome_rows"], + -int(row["opener_backlog_items"]), + -int(row["recent_outcome_rows"]), row["task_type"], ) ) diff --git a/src/exploration_review.py b/src/exploration_review.py index 0007835..37d7fc8 100644 --- a/src/exploration_review.py +++ b/src/exploration_review.py @@ -41,6 +41,8 @@ def _route_agents(task_type: str, route_table: dict | None = None) -> list[str]: spec = (route_table or router.ROUTE_TABLE).get(task_type) or {} out: list[str] = [] for row in spec.get("agents") or []: + if not isinstance(row, dict): + continue agent = row.get("agent") if not agent or agent in out or agent in router.BACKUP_AGENTS: continue diff --git a/src/features.py b/src/features.py index d28e5ca..ba1559d 100644 --- a/src/features.py +++ b/src/features.py @@ -18,6 +18,7 @@ import os import time from pathlib import Path +from typing import Any ORCH = Path(__file__).resolve().parent REG = Path(os.environ.get("ORCH_FEATURES_PATH", ORCH / "experiments" / "features.json")) diff --git a/src/gh_capacity.py b/src/gh_capacity.py index 797acd1..eae53b9 100644 --- a/src/gh_capacity.py +++ b/src/gh_capacity.py @@ -35,6 +35,7 @@ import sys import time from pathlib import Path +from typing import Any HANDOFF = Path(os.environ.get("HANDOFF_DIR", Path.home() / ".codex" / "handoff")) GH_LEDGER = ( @@ -200,7 +201,9 @@ def gh_run(args: list[str], *, resource: str = "core", timeout_s: int = 30, runn except Exception: return 1, None headers, body = _split_headers_body(getattr(r, "stdout", "") or "") - _append_ledger([_ratelimit_row_from_headers(headers, fallback_resource=resource)]) + row = _ratelimit_row_from_headers(headers, fallback_resource=resource) + if row is not None: + _append_ledger([row]) parsed = None if body: try: @@ -301,7 +304,11 @@ def throttle_if_enabled(resource: str, **kw) -> dict | None: def build(*, runner=subprocess.run) -> dict: """Probe + snapshot the tracked resources (what `gh_capacity.py` with no args writes/prints).""" resources = probe(runner=runner) - out = {"generated_at": int(time.time()), "probe_ok": resources is not None, "resources": {}} + out: dict[str, Any] = { + "generated_at": int(time.time()), + "probe_ok": resources is not None, + "resources": {}, + } for name in TRACKED: st, meta = state(name) out["resources"][name] = {"state": st, **meta} diff --git a/src/human_calibration.py b/src/human_calibration.py index e638eda..089d90d 100644 --- a/src/human_calibration.py +++ b/src/human_calibration.py @@ -346,7 +346,7 @@ def compute( raw_mae = None if pairs: raw_mae = sum( - abs(float(row["proxy_score"]) - float(row["human_score"])) for row in pairs + abs(float(str(row["proxy_score"])) - float(str(row["human_score"]))) for row in pairs ) / len(pairs) return { "generated_at": generated_at or int(time.time()), diff --git a/src/issue_quality.py b/src/issue_quality.py index 22ad7c0..0329dd0 100644 --- a/src/issue_quality.py +++ b/src/issue_quality.py @@ -280,7 +280,7 @@ def parallel_fetch(keys: set[tuple[str, int]], fn) -> dict[tuple[str, int], obje ) body_keys: set[tuple[str, int]] = set() for repo, pr_number in linked_cache: - issue_numbers = linked_cache.get((repo, pr_number)) or [] + issue_numbers: list[int] = linked_cache.get((repo, pr_number)) or [] if not isinstance(issue_numbers, list): continue for issue_number in issue_numbers: diff --git a/src/judge_reliability.py b/src/judge_reliability.py index 4108f14..93a3f68 100644 --- a/src/judge_reliability.py +++ b/src/judge_reliability.py @@ -14,6 +14,7 @@ import json import time from collections import defaultdict +from typing import Any import feedback diff --git a/src/keepalive_shadow.py b/src/keepalive_shadow.py index 983eabf..2fe5607 100644 --- a/src/keepalive_shadow.py +++ b/src/keepalive_shadow.py @@ -35,6 +35,7 @@ import subprocess import sys from pathlib import Path +from typing import Any import redirect_policy @@ -161,7 +162,7 @@ def synthesize_report(signals: dict) -> dict: state_raw = str(signals.get("pr_state") or "open").lower() last_changes = bool(signals.get("last_has_changes")) - drift = {"severity": "none", "findings": []} + drift: dict[str, Any] = {"severity": "none", "findings": []} if state_raw in ("closed", "merged"): state = "exited" diff --git a/src/ledger_reconcile.py b/src/ledger_reconcile.py index 3fff5aa..8dc330b 100644 --- a/src/ledger_reconcile.py +++ b/src/ledger_reconcile.py @@ -478,7 +478,7 @@ def record_completion( # caller left EMPTY -- an explicitly supplied resolved_model always wins, because the # caller may have provenance this reader cannot see. probed = adapters.cli_reported_model( - agent, target[len("offload:") :], started_ts=started_ts, log_file=log_file + agent, str(target)[len("offload:") :], started_ts=started_ts, log_file=log_file ) probe_reason = probed.get("reason") if probed.get("model"): diff --git a/src/partitioned_review.py b/src/partitioned_review.py index 56e13f3..88cf0be 100644 --- a/src/partitioned_review.py +++ b/src/partitioned_review.py @@ -973,7 +973,9 @@ def _validate_adjudication(value: Any, synthesis: dict[str, Any]) -> list[str]: }: errors.append(f"{path} has an invalid shape") continue - seen.append(decision.get("assertion_key")) + assertion_key = decision.get("assertion_key") + if assertion_key is not None: + seen.append(assertion_key) if decision.get("assertion_key") not in expected: errors.append(f"{path}.assertion_key is not in the adjudication queue") if decision.get("decision") not in ADJUDICATION_DECISIONS: diff --git a/src/redirect_apply.py b/src/redirect_apply.py index fe66811..76330e1 100644 --- a/src/redirect_apply.py +++ b/src/redirect_apply.py @@ -624,6 +624,21 @@ def status(corpus_path: Path | None = None, *, env: dict | None = None) -> dict[ } +def _recording_role_runner(spent: list): + """Record the call and return an empty proposal. + + Was `lambda *a, **k: spent.append(a) or {}` — a deliberate "record, then yield {}" idiom that + reads as a bug to a checker, because `list.append` returns None and `X or {}` therefore always + takes the right branch. Same behaviour, stated instead of implied. + """ + + def runner(*a, **k) -> dict: + spent.append(a) + return {} + + return runner + + def _selftest() -> None: import tempfile @@ -907,7 +922,7 @@ def fake_runner(command, capture_output=True, text=True, check=False): corpus_path=corpus, dry_run=True, env={}, - role_runner=lambda *a, **k: spent.append(a) or {}, + role_runner=_recording_role_runner(spent), ) assert guarded.get("skipped") and not spent, guarded assert "spend-offloads" in guarded["skipped"], guarded diff --git a/src/redirect_shadow.py b/src/redirect_shadow.py index c188da7..8bb905d 100644 --- a/src/redirect_shadow.py +++ b/src/redirect_shadow.py @@ -717,7 +717,7 @@ def as_int(value: Any, default: int = 0) -> int: def _already_historical_replayed_targets(corpus_path: Path = CORPUS_PATH) -> set[str]: return { - e.get("target") + str(e.get("target")) for e in _iter_events(corpus_path) if e.get("kind") == "redirect_proposal" and e.get("source") == HISTORICAL_SOURCE diff --git a/src/strategy_experiment.py b/src/strategy_experiment.py index 2215346..02ea726 100644 --- a/src/strategy_experiment.py +++ b/src/strategy_experiment.py @@ -145,7 +145,7 @@ def implementation_agents(arms: Sequence[Any]) -> list[str]: normalized = ( arms if arms and isinstance(arms[0], dict) and "arm_id" in arms[0] else normalize_arms(arms) ) - return _dedupe_preserve(agent for arm in normalized for agent in arm["agents"]) + return _dedupe_preserve([agent for arm in normalized for agent in arm["agents"]]) def load_hypothesis_arms( diff --git a/src/synthesis_promotion.py b/src/synthesis_promotion.py index 0e317ce..0c1c493 100644 --- a/src/synthesis_promotion.py +++ b/src/synthesis_promotion.py @@ -885,7 +885,7 @@ def default_mirror_outcome(state: dict, event_key: str) -> dict: else: verifier = outcome.get("verifier_verdict") or "PASS_SYNTHESIS_PROMOTION" adjudicated = outcome.get("adjudicated_verdict") or "PASS" - merged = outcome.get("merged") + merged = bool(outcome.get("merged")) durability = outcome.get("durability") or ("durable" if phase == "durable" else "pending") feedback.record_outcome( synth_run_id, diff --git a/src/ux_review.py b/src/ux_review.py index c528129..c045003 100644 --- a/src/ux_review.py +++ b/src/ux_review.py @@ -27,6 +27,7 @@ import time from collections import defaultdict from pathlib import Path +from typing import TextIO import adapters import dispatcher @@ -582,7 +583,9 @@ def review( register_panel_subject(bundle, evaluators, spec=rubric_prompt) - procs: dict[str, tuple[subprocess.Popen, object, Path]] = {} + # The middle element is the evaluator's open log file, not an opaque object — declaring it + # `object` is what made every `out.write/flush/close` unreachable to the checker. + procs: dict[str, tuple[subprocess.Popen, TextIO, Path]] = {} for ev in evaluators: pf = rdir / f"rubric-prompt-{ev}.txt" pf.write_text(rubric_prompt) diff --git a/src/watch.py b/src/watch.py index 44ec26c..ac7621a 100644 --- a/src/watch.py +++ b/src/watch.py @@ -19,6 +19,7 @@ import sys import time from pathlib import Path +from typing import Any import redirect_plan import redirect_policy