Repository navigation
Fix sequenced-after archive-gate to refuse a missing working-tree proposal, matching the scope-globs gate - #734
Conversation
… gate `retention_at_archive` read an absent current-side `proposal.md` as the `ABSENT` sentinel and compared on, so the gate returned a VERDICT about a declaration it had never read: a change that declared nothing at ratification reported RETAINED (a pass), and one that DID declare reported a contested MUTATION — a removal nobody made, because the file that would hold the declaration is simply not there. `ABSENT` means "no declaration was made", a load-bearing fact in this module; it is not a stand-in for "the proposal is missing". The sibling gate `scope_globs.scope_retention_at_archive` already refuses this case (#723, fixing #705) and recorded the divergence as a follow-on because `scripts/sequenced_after.py` was outside its declared scope. This is that follow-on: the arm is mirrored here with the same shape, so the two archive gates read the case alike — a named "CANNOT RUN" finding with exit 2, never a verdict and never a traceback. No other arm changes: a proposal that EXISTS and declares nothing is still read as `ABSENT` and compared, as today. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
|
Lane: openxfactory-1 (openXfactory-1) @codex review |
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟢 Approval recommended
The core behavioral change is narrowly scoped, consistent with the sibling gate’s semantics, and is covered by a new targeted test for the previously-misread scenario.
Pull request overview
This PR brings the sequenced_after archive-gate into parity with the scope_globs archive-gate by refusing to “compare on” when the current working-tree proposal.md is missing, since the current declaration cannot be read and the gate therefore cannot run.
Changes:
- Update
scripts/sequenced_after.py::retention_at_archiveto raiseSequencedAfterErrorwhenCHANGE_DIR/proposal.mdis missing in the working tree (so the CLI reports a namedCANNOT RUNfinding with exit 2). - Clarify
scripts/validate-sequenced-after.py--archive-gatedocumentation and refusal-mode comment to include the new “missing working-tree proposal” arm. - Add a new pytest fixture covering the missing working-tree proposal case and asserting both the direct-call error and the CLI behavior.
File summaries
| File | Description |
|---|---|
| tests/sequenced_after/test_integrity.py | Adds a new integrity test asserting missing working-tree proposal.md is treated as CANNOT RUN (exit 2), not as an ABSENT comparison input. |
| scripts/validate-sequenced-after.py | Updates --archive-gate docs/comments to describe the additional refusal mode and keep exit-code semantics clear. |
| scripts/sequenced_after.py | Changes the archive retention gate to refuse (raise) when the current-side proposal file is missing, avoiding an invalid ABSENT-based verdict. |
Review details
Suppressed comments (1)
tests/sequenced_after/test_integrity.py:380
- For the CLI path, the test checks the change dir is echoed but doesn't assert the missing
proposal.mdpath is included in the CANNOT RUN output; pinning it would ensure the CLI continues to surface the actionable file path.
assert "CANNOT RUN" in result.stdout, result.stdout
assert str(change) in result.stdout, result.stdout
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…und 1) Copilot: the fixture asserted the refusal names the change DIRECTORY but not the missing `proposal.md` path the gate went looking for. Taken — the diagnostic's job is to tell an operator which path was probed, and a directory-only assertion would still pass if that half of the message were dropped. Asserted on both the direct call's message and the CLI's stdout. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
There was a problem hiding this comment.
🔵 Needs a closer look
The updated documentation/commentary now states there are only “two ways” the gate can be unrunnable, but the implementation reports exit 2 for any SequencedAfterError while reading declarations (including malformed/unparseable front matter), so the described contract is currently inaccurate.
Review details
Suppressed comments (3)
Previously missed (2) — in code that hasn't changed since the last review.
scripts/sequenced_after.py:734
- The
retention_at_archivedocstring now enumerates two specific raise cases, but the function can also raiseSequencedAfterErrorif either proposal exists but its front matter is malformed/unparseable (viaread_declaration). Updating the docstring makes the contract accurate for callers.
scripts/validate-sequenced-after.py:48 - The usage text claims there are "TWO WAYS" the archive gate can fail to run, but the implementation treats any SequencedAfterError while reading declarations as a CANNOT RUN (exit 2), including cases like malformed/unparseable proposal front matter. Tightening this wording avoids misleading operators and future maintainers.
This issue also appears on line 162 of the same file.
scripts/validate-sequenced-after.py:167
- This comment lists only two "distinct fact" causes for the archive gate to be unrunnable, but
_archive_gatecatches all SequencedAfterError fromretention_at_archive, including unreadable/malformed proposal front matter. Broadening the comment prevents it from becoming inaccurate as error cases evolve.
# UNRUNNABLE IS NOT A MUTATION FINDING (exit 1) AND NOT A TRACEBACK: it
# is a distinct fact — the id names no proposal.md at `ratified_ref` at
# all, or CHANGE_DIR carries no proposal.md in the working tree so the
# current-side declaration cannot be read — reported the same way every
# other refusal in this CLI is, as a named finding and exit 2, and the
# same shape `validate-scope-globs.py` uses for its own gate.
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
…und 2) Copilot: the new usage text claimed "TWO WAYS THIS GATE CAN FAIL TO RUN", but `_archive_gate` catches the whole `SequencedAfterError` class, so malformed or unparseable front matter on EITHER side also lands as a named CANNOT RUN finding with exit 2. Measured, not assumed: a proposal whose `sequenced_after:` block does not parse prints `... gate CANNOT RUN: - the `sequenced_after` front-matter block does not parse: ...` and exits 2. Taken, and the wording is now stated as the rule rather than a list — every failure to READ what the gate compares is exit 2 — so a refusal added to the substrate later lands correctly without the comment having to be revised. The docstring says the same. The one mishandling that is genuinely NOT converted is named rather than claimed away: a CHANGE_DIR outside any git work tree still surfaces git's `CalledProcessError` (measured). The sibling `scope_globs` gate converts that one; this gate does not, and that is a separate arm from the one this PR was ruled to align. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
|
Lane: openxfactory-1 (openXfactory-1) Review round 2 (head TAKEN — the new wording claimed an enumerated "TWO WAYS" the gate can fail to run, and the implementation is broader. The usage text, the And the one mishandling that is genuinely NOT converted is now named rather than claimed away, in both the usage text and the docstring — a Re-verified at Round 1 (head Codex: usage-limit refusal on the |
|
You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, matches the stated parity goal, and the new fixture directly locks in the corrected refusal behavior and diagnostic output.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-1 (openXfactory-1) Disclosure — this PR's DESCRIPTION was briefly wrong, and it is recorded rather than quietly fixed. At 00:0xZ this body carried the text of ANOTHER lane's pull request for a few minutes. Cause: the body was authored into a generically named file in a shared scratchpad directory ( Blast radius, checked rather than assumed:
Lesson banked: a PR body file belongs in the lane's own clone or under a lane-unique filename — never at a shared, generically named scratchpad path where a sibling session can land on it. |
|
Lane: openxfactory-1 (openXfactory-1) FROZEN at Provenance for the admin merge of #734 (plain fix; no OpenSpec change — the #638/#723 precedent). Words: Brett Heap, 2026-09-06T23:10Z, by multiple choice, label verbatim "Plain fix now, this lane" (recorded on #692, ruling 3), then 2026-09-07T02:07:13Z in session, verbatim "merge it" given against this PR presented frozen. Brings 🤖 Generated with Claude Code |
Lane: openxfactory-1 (openXfactory-1)
The two archive gates read the same corpus over the same trees and are meant to answer the same questions the same way. On one arm they did not.
scope_globs.scope_retention_at_archiveREFUSES a change directory whose working-treeproposal.mdis missing (#723, fixing #705): the current-side declaration cannot be read, so the gate cannot run, andvalidate-scope-globs.py --archive-gateprints a namedCANNOT RUNfinding with exit 2. The siblingsequenced_after.retention_at_archivestill read that same case as theABSENTsentinel and compared on.What that misreads.
ABSENTis a load-bearing FACT in this module — "no declaration about chain position was made" — and it is emphatically not a stand-in for "the proposal is missing". Using it for a missing file made the gate return a VERDICT about a declaration it had never read, and it is wrong in both directions. Measured, not asserted, onorigin/main1a2ea821:proposal.md:sequenced_after retention gate passed (declaration unchanged since ratification).EXIT=0. The gate PASSED a directory whose current declaration it never read.sequenced_after: [add-parent], proposal then deleted:"sequenced_after was mutated after ratification (ratified: ['add-parent']; current: <no sequenced_after declaration>); … Restoring or accepting the mutation is a contested-class act requiring an explicit disposition"— a contested mutation nobody made.#723 recorded this divergence as a follow-on rather than fixing it, because
scripts/sequenced_after.pywas outside its declared scope (its raise site carries a comment saying so, and the note is in #723's body and on #705's landing comment). This PR is that follow-on.Fix
sequenced_after.retention_at_archivenow raisesSequencedAfterErrorwhenchange_dircarries noproposal.mdin the WORKING TREE, naming the change directory and the missing path and saying the current declaration cannot be read at all — placed after the ratified-side resolution and BEFORE the comparison, the same position the sibling puts it in, so a ratified side that is itself unresolvable still reports as such and the two gates order their refusals alike.validate-sequenced-after.py::_archive_gateneeds no new code: it already catchesSequencedAfterErrorand printssequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:with exit 2. Its comment and the--archive-gateusage text are updated to name the new arm.ABSENTand compared, exactly as today — that is a real declaration fact, not an unreadable one. The pre-existing archive-gate fixtures pass untouched.The message the new arm prints, verbatim from the hand run below:
New fixture (
tests/sequenced_after/test_integrity.py), mirroring #723'stest_a_MISSING_WORKING_TREE_PROPOSAL_is_a_CANNOT_RUN_finding_not_a_verdictand built the way the neighbouring archive-gate tests are — a ratified commit carrying the declaration, then agit rmof the proposal in a later commit; the directory survives because it also carriestasks.md:test_a_MISSING_WORKING_TREE_PROPOSAL_is_a_CANNOT_RUN_finding_not_a_verdict— asserts the direct call raisesSequencedAfterErrornaming the change directory AND the missingproposal.mdpath, and that the CLI exits 2 withCANNOT RUN, both paths named back, noTracebackon either stream, and nocontested(not the mutation the old reading mistook it for).ONE fixture, not a set: the other ways this gate can be held wrong were already covered by #638's three, and no lockstep/parity test exists between the two archive gates to extend (the only
locksteptest in this family,tests/scope_globs/test_dialect_lockstep.py, pins the front-matter DIALECT mirror against the OpenSpec CLI — a different obligation). None was invented here.Negative control, run before pushing — the two
scripts/changes reverted, the fixture left in place:Verification (fresh clone at
origin/main1a2ea821; every figure measured)python3 -m pytest tests/sequenced_after tests/scope_globs -q→248 passed in 14.28s. Baseline measured in the same clone with the three files stashed:247 passed in 13.74s. +1, exactly the fixture this PR adds. Re-run at the final headf3016f04:248 passed in 12.32s.python3 scripts/validate-sequenced-after.py .→sequenced_after validation passed (38 active changes, 3 declaring the field).(exit 0)python3 scripts/validate-sequenced-after.py . --ledger-diff→per-change sweep ledger consistent with the corpus (178 rows).(exit 0)proposal.mdremoved (.tmp-handrun/…, deleted after the run):scripts/changes stashed, is the first bullet of "What that misreads" above:passed … EXIT=0.python3 scripts/doc-health.py --single-repo .→ unchanged (no docs touched). Headline identical on both trees:Findings: 9 critical, 8 error, 44 warning, 13 info. New regressions vs previous report: 0.f3016f04: ALL NINE required checks PASS —clearing-dispatch-gate,lane-line,merge-master-approval,openreposhape-pin,openspec-cli-pin,pytest-suite,release-tag-gate,signed-execution-chain-gate,wallet-validation.pytest-suiterun 34067352680, 23m52s:selected=10094 passed=10073 skipped=21 failures=0 errors=0, meeting the EXACT skip pin of 21 and both floors (selected>=7090, margin 3004;passed>=7070, margin 3003), with the named freshness verifier and the vector replay bothpassed. This is the skip-pin authority, and it is met.python3 -m pytest -qlocally, at3c2cb1d9(the round-1 and round-2 commits after it add two test assertions and prose only):96 failed, 10071 passed, 110 skipped, 9 warnings, 50 errors, 72 subtests passed in 4123.47s (1:08:43).origin/mainrun each read 110). Nothing was skipped, marked or deselected by this PR. The CIpytest-suitegate above is the authority for the pinned EXACT count of 21, and it met it.origin/main) — uninitializedopenXwalletsubmodule, no pinnedopenspecCLI on PATH, noPINNED_CORE_CHECKOUT. They cluster astests/trust-anchor/test_negative_corpus.py(66),test_declaration_perimeter.py(14),tests/openxwallet_pin/test_verify_pin.py(6) and a scattering of the same kind. Noorigin/mainbaseline was re-run for this figure, so it is reported as an absolute reading against Fix scope-globs archive-gate to resolve the ratified proposal by change id #723's recorded readings for this machine, not as a measured difference — and it is not offered as evidence of anything the green gate does not already establish.FAILED/ERRORline namestests/sequenced_afterortests/scope_globs— measured by grepping the run log, 0 of 146.Review rounds (bench: Copilot took three passes; Codex refused on a usage limit and the absence is recorded, never read as clearance; Sourcery is the private-repo upsell stub, not a review)
969cfe7e) — one thread, TAKEN and resolved: the fixture now pins the missingproposal.mdpath ITSELF, not only the change directory, on both the direct call's message and the CLI's stdout.f3016f04) — findings in the review body (no threads), TAKEN and disposed in a PR comment: the new usage text claimed an enumerated "TWO WAYS" the gate can fail to run, but_archive_gatecatches the wholeSequencedAfterErrorclass, so malformed or unparseable front matter on EITHER side also lands as a namedCANNOT RUNwith exit 2 (measured). The usage text, the_archive_gatecomment and the docstring now state the RULE rather than a list. And the one mishandling that is genuinely NOT converted — aCHANGE_DIRoutside any git work tree, which still surfaces git'sCalledProcessError(measured) — is named rather than claimed away.f3016f04: 🟢 Approval recommended, 0 new comments. 0 unresolved threads.Not taken here (out of the declared scope:
scripts/sequenced_after.py,scripts/validate-sequenced-after.py,tests/sequenced_after/test_integrity.py)scripts/scope_globs.py:591-595still carries the comment saying this divergence is "deliberately not fixed here … recorded as a follow-on". With this PR the divergence is closed, so that comment is now stale. It is one comment in a file this PR does not declare, andscripts/scope_globs.pyis additionally VENDORED byte-for-byte into codexFactory's merge gate — so it is named here rather than edited.scope_retention_at_archiveresolveschange_dirto an absolute path, names an unresolvable--ratified-refas such, and converts achange_diroutside any git work tree into a named finding;retention_at_archivedoes none of those three. Each is a separate arm with its own reasoning, and the ruling here was for this arm only.No OpenSpec change — plain fix per the #638 precedent, on Brett Heap's word 2026-09-06 ("Plain fix now, this lane"); follow-on named at #723's landing on #705. No sweep-ledger row: the ledger seeds rows for OpenSpec changes, and this PR adds none (#638 and #723 added none either).
This lane authors only. It does not merge, approve, close, force-push, or post
LANDING/LANDED.Refs #705
🤖 Generated with Claude Code
https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb