Repository navigation
feat: Gate test collection and ratchet the schema closure - #5206
Conversation
The hosted merge gate is `devtools verify --quick`: static gates, no pytest, deliberately, because the suite's pre-merge evidence is the author's explicitly selected local or hosted run. That policy has one blind spot it cannot see past. The author's selection describes the tree they ran it on, and a rebase can leave behind a test module that no longer imports; such a module raises on collection, so the selection that "passed" selected zero tests, and CI never collects anything. Add a `test-collection` gate to the quick path. It collects the whole declared corpus through the closed-world arguments in `devtools.pytest_invocation` and executes none of it, so it catches an unimportable module, a syntax error, a missing symbol or a module-scope fixture reference -- and nothing that needs a test body to run. It loads neither testmon nor xdist, so it writes no fingerprints and leaves the checkout's corpus graph untouched. The subprocess names itself to `refuse_bare_pytest`: that guard protects the host's pytest slot from unmetered execution, and a collect-only run holds no slot, but without the marker the gate would be red inside every agent job -- exactly where `verify --quick` runs. Anti-vacuity, executed: a test module with a module-level `from devtools.gate import DoesNotExist` makes the gate exit 1 naming the ImportError; removing it returns exit 0 at 23036 collected tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
Nothing pinned which modules feed `derived_schema_identity`, so the closure grew by importing its way into new files with no review signal. Editing any member forces a full archive reconvergence and invalidates every seeded test archive keyed on that identity, so the boundary is worth a decision rather than whatever the import graph happens to produce. Add `devtools gate schema-closure`, modelled on `gate layering`, over a checked-in membership baseline at `docs/plans/schema-closure-baseline.json`. The ratchet is asymmetric on purpose: growth is blocking, because a new member is a file whose ordinary edits now cost a reconvergence and must land before a rebuild starts; shrinking is free and only reported, because narrowing an import is the wanted direction. The comparison is over membership, not a size integer, so a swap that keeps the count is still growth. Correct docs/internals.md, which was measurably wrong at head: the closure is 560 of 1,311 modules (storage 162, archive 99, sources 93, core 50), not 442 of 1,241 (storage 150, archive 94, sources 63, core 40), and `sources/live/watcher.py` is inside the closure, not outside as the prose claimed. The corrected paragraph points at the baseline as the membership of record. Anti-vacuity, executed: adding `import polylogue.daemon.convergence` to `archive_tiers/write.py` (a member) pulls three modules in and fails the gate naming them; recording that at 563 and then reverting the import leaves the closure at 560 and the gate green, reporting three stale baseline entries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 48 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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. |
Summary
Two gates hardening the merge boundary. Delivers polylogue-z1c94 and polylogue-33geb.
Why now: two regressions reached master today from the same gap — a worker verifies its own focused selection, and the hosted merge gate is
devtools verify --quick, static gates only, no pytest. #5200 and #5201 were the repairs.Both are gates registered in
devtools/gate.py, not new commands: no root verb, noCommandSpec, andtest_top_level_command_surface_is_the_folded_twelvepasses untouched.gate test-collection(z1c94)Runs
pytest -q --collect-onlyover the declared corpus usingCLOSED_WORLD_COLLECTION_ARGS/IGNORED_COLLECTION_ARGSfrompytest_invocation— the same values that define what the corpus is — withmanaged_plugin_args(testmon=False, xdist=False). It writes no testmon fingerprints, so the checkout's corpus graph is untouched. Fails on non-zero exit, on exit 5 (nothing collected), and on a zero collected count with a green exit.Honest reach, stated in the docstring and asserted in tests: it catches an unimportable module, a syntax error, a missing symbol, a module-scope fixture reference. It catches no failing assertion — so it would not have caught either of today's reds. It closes a different hole in the same wall.
One non-obvious thing:
agent_env.py:refuse_bare_pytestrefuses any pytest subprocess inside an agent job unlessPOLYLOGUE_PYTEST_RUN_IDis set, so the gate was initially red in exactly the environment whereverify --quickruns. It now setsPOLYLOGUE_PYTEST_RUN_ID=gate-test-collection— the guard protects the host's pytest slot from unmetered execution, and a collect-only run executes nothing and holds no slot.Executed mutation: a test module with
from devtools.gate import DoesNotExist→ gate exit 1 namingImportError: cannot import name 'DoesNotExist'. Reverted → exit 0,23036 tests collect cleanly (none executed).gate schema-closure(33geb)Ratchets membership against
docs/plans/schema-closure-baseline.json(560 members, generated by--update). Growth is blocking and names each new module; shrinking passes and reports stale baseline entries. The comparison is over membership, not a count, so a same-size swap is still growth. Direction matters here: the closure may shrink freely, but growth must be deliberate and visible, because a closure-moving change has to land before a production rebuild starts.docs/internals.mdcorrected. Measured at head: 560 of 1,311 modules — storage 162, archive 99, sources 93, core 50, against documented 442 of 1,241.sources/live/watcher.pywas listed as outside the closure and is inside. The corrected prose pairsdaemon/write_coordinator.py+sources/live/watcher.py(in) againstdaemon/convergence.py+daemon/cli.py(out), and points at the baseline as the membership of record. (The bead said 561/1314; the live measurement is 560/1311 — the bead's figure came from my dispatch, and the worker's measurement supersedes it.)Executed mutations: adding
import polylogue.daemon.convergenceto a member file grew the closure 560→563 and turned the gate red, naming all three new modules; then--updateto 563 and reverting the import left 560 against a 563 baseline, passing with3 baseline entr(y/ies) no longer feed the identity. Baseline restored;polylogue/is byte-clean in the diff.Verification
All seven changed/added files are outside the closure.
Residual the reviewer should weigh
test-collectionadds ~93s to the quick gate on this host (148s cold). The bead said "seconds"; it is not seconds. It needs no pytest slot and is cheap relative toverify --quick's existing minutes, but the merge gate got ~1.5 min slower and that is a real cost on every PR.The
sources/revision_backfill.py→archive_tiers/archive.pyimport narrowing named in 33geb's "related structural fix" is not done — separate import-hygiene work, now visible when someone does it, since the closure will shrink and the gate will report stale baseline entries.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK