Skip to content

Fix scope-globs archive-gate to resolve the ratified proposal by change id - #723

Merged
brettheap merged 4 commits into
mainfrom
fix/scope-globs-archive-gate-across-rename
Sep 6, 2026
Merged

brettheap merged 4 commits into
mainfrom
fix/scope-globs-archive-gate-across-rename

Conversation

@brettheap

@brettheap brettheap commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1 (openXfactory-1)

Fixes the --archive-gate crash filed in #705: scope_globs.scope_retention_at_archive derived the ratified-side proposal path from CHANGE_DIR's CURRENT path, so once a change had moved to openspec/changes/archive/<date>-<id>/ the gate asked git for that archived path at --ratified-ref — a commit before the rename, where it never existed — and died with an unhandled CalledProcessError traceback instead of a finding, on exactly the archived directory the gate exists to check. Same defect, same shape as #638 (issue #633) in the sibling sequenced_after gate.

Fix

  • scope_retention_at_archive now locates the ratified-side proposal.md BY CHANGE ID against --ratified-ref's own tree — active path first, then any openspec/changes/archive/<date>-<id>/ — by REUSING scripts/sequenced_after.py's change_id_of_dir and proposal_path_at_ref (the Fix archive-gate to resolve the ratified proposal by change id #638 functions) rather than re-implementing the convention. One implementation, so the two archive gates cannot drift apart; no cycle (sequenced_after does not import scope_globs), and no mirror/lockstep test is needed because there is no second copy.
  • The sibling is loaded on first use, by location, under the name sequenced_after_substrate, and both halves of that are deliberate:
    • Deferred, not module-level, because scripts/scope_globs.py is VENDORED BYTE-FOR-BYTE into codexFactory's merge gate (scripts/merge_master/scope_globs.py, pinned by tests/merge-master/test_vendored_scope_globs.py), which vendors only this module and frontmatter_strict.py. A module-level import would make the vendored copy UNIMPORTABLE — breaking every merge-gate path — until the whole 1,600-line sequenced_after substrate were vendored beside it, for a function the merge gate never calls. Deferred, the vendored copy is unaffected, and a caller that does reach this path without the sibling present gets a named ScopeGlobsResolutionError rather than an import traceback. Nothing in codexFactory is touched by this PR, and no re-vendor is required by it.
    • Under sequenced_after_substrate, not via _sibling("sequenced_after"), because the bare name is AMBIENT in this repository's test run: tests/sequenced_after/ is itself an importable package by that name (its __init__.py exists to stop a same-named-module collision), so under pytest's prepend import mode import sequenced_after resolves to the TEST PACKAGE, not to scripts/sequenced_after.py. sequenced_after_substrate is the name that package already documents for the implementation under test. Measured, not assumed: the plain-_sibling route fails in a full-suite run.
  • When the id has no proposal.md at the ref at all, the sibling's SequencedAfterError is re-raised (message intact) as the new ScopeGlobsResolutionError — a SUBCLASS of ScopeGlobsError, so this module still presents one error class to its callers while the "could not run" fact stays distinguishable.
  • validate-scope-globs.py::_archive_gate catches it and prints a named finding with exit 2 — scope_globs SCOPE-RETENTION gate CANNOT RUN: then - <exc> — mirroring validate-sequenced-after.py's wording. A retention mutation is still exit 1; a traceback is now unreachable on this path.
  • Pre-rename behaviour and absolute/relative CHANGE_DIR behaviour are unchanged (the pre-existing archive-gate fixtures still pass untouched). Docstrings and --archive-gate usage text updated to say the ratified-side proposal is located by change id at the ref.

New fixtures (tests/scope_globs/test_integrity.py, mirroring #638's) — TWELVE in all across three rounds; the five below are the original set, the review rounds added seven more (listed under Review round 1 and Review round 2)

  • test_the_archive_gate_PASSES_across_the_archive_rename
  • test_the_archive_gate_FAILS_across_the_archive_rename_on_a_real_mutation
  • test_the_archive_gate_CLI_reports_a_ref_with_NO_PROPOSAL_as_a_finding_not_a_traceback
  • test_the_archive_gate_resolves_a_ratified_ref_that_is_ITSELF_ALREADY_ARCHIVED — a fourth, covering the archived-directory-enumeration branch (the ratified_ref is the archival commit itself, so the active-path shortcut cannot resolve it). Stated plainly: this one PASSES on main too — it is branch coverage, not a regression witness.
  • test_the_sequenced_after_sibling_is_NOT_imported_at_module_import_time — a fifth, pinning the DEFERRAL itself: it loads scripts/scope_globs.py in a fresh interpreter and asserts neither sequenced_after nor sequenced_after_substrate is in sys.modules afterwards, so a future refactor that hoists the import to module level fails in THIS repository rather than in codexFactory's vendored copy.

Negative control, run before pushing: with only the two scripts/ changes stashed and the rename fixtures in place, three of them fail on the unfixed implementation (the fourth, the branch-coverage one, passes there by construction; the fifth was added afterwards and is a forward guard, not a regression witness):

FAILED tests/scope_globs/test_integrity.py::test_the_archive_gate_PASSES_across_the_archive_rename
FAILED tests/scope_globs/test_integrity.py::test_the_archive_gate_FAILS_across_the_archive_rename_on_a_real_mutation
FAILED tests/scope_globs/test_integrity.py::test_the_archive_gate_CLI_reports_a_ref_with_NO_PROPOSAL_as_a_finding_not_a_traceback
3 failed, 1 passed, 12 deselected in 0.57s

Verification (all commands run in a clone at origin/main 1897f28; every figure below is measured, not estimated)

  • python3 -m pytest tests/scope_globs tests/sequenced_after -q → 247 passed in 8.86s at head d9569096 (235 measured on origin/main in a worktree of the same clone, + 12 added by this PR across its three rounds: 5 original, 6 in review round 1, 1 in review round 2).
  • Full suite, the exact invocation the pytest-suite gate uses (python3 -m pytest tests/ -q -m "not postgres"), run twice on this machine — once on this branch, once on origin/main in a worktree of the same clone:
    • branch: 98 failed, 9485 passed, 110 skipped, 338 deselected, 9 warnings, 50 errors, 72 subtests passed in 2111.75s (0:35:11)
    • origin/main: 97 failed, 9481 passed, 110 skipped, 338 deselected, 9 warnings, 50 errors, 72 subtests passed in 2000.55s (0:33:20)
    • SKIPPED is identical (110 = 110) — the load-bearing pin. No test was skipped, marked or deselected by this PR.
    • This machine is not a runner: both runs fail ~97 tests and error 50 identically, on environment dependencies (uninitialized openXwallet submodule, no pinned openspec CLI on PATH, no PINNED_CORE_CHECKOUT). The gate on GitHub is the authority; what is measurable locally is the DIFFERENCE, and it is fully accounted for. Diffing the two failure/error sets by test id leaves exactly three entries, none of them mine:
      • branch-only: tests/client-identity-roster/…::test_packaged_corpus_self_test_is_strict_and_green and tests/ideation_dashboard/…::test_end_to_end_self_test_passes — both artifacts of the temporary .baseline-main/ worktree sitting inside the clone during the run (their validators walk the filesystem and reported [misplaced-roster-instance] .baseline-main/examples/…).
      • origin/main-only: tests/doc-health/…::test_the_resolver_fails_on_a_checkout_it_cannot_confirm_and_never_walks_up — an artifact of the baseline being a worktree rather than a clone.
      • All three re-run GREEN in the clean clone once the worktree was removed: 3 passed in 58.24s.
    • The arithmetic closes: 9485+98+50 = 9633 and 9481+97+50 = 9628, a difference of exactly the 5 tests this PR adds, so all five ran and all five passed in the full-suite context.
  • python3 scripts/validate-scope-globs.py . → scope_globs validation passed (all active changes conform). (exit 0)
  • The reproduction from the issue, BEFORE — run in a worktree of this clone checked out at origin/main 1897f28 (verbatim, this clone's paths):
    $ python3 scripts/validate-scope-globs.py --archive-gate openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario --ratified-ref 87c15baa
    Traceback (most recent call last):
      File "/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main/scripts/validate-scope-globs.py", line 107, in <module>
        raise SystemExit(main())
                         ^^^^^^
      File "/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main/scripts/validate-scope-globs.py", line 101, in main
        return _archive_gate(Path(args.archive_gate), args.ratified_ref)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main/scripts/validate-scope-globs.py", line 79, in _archive_gate
        problem = sg.scope_retention_at_archive(change_dir, ratified_ref)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main/scripts/scope_globs.py", line 419, in scope_retention_at_archive
        ratified = scope_globs_at_ref(repo_root, ratified_ref, proposal_rel)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main/scripts/scope_globs.py", line 400, in scope_globs_at_ref
        out = subprocess.run(
              ^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/subprocess.py", line 571, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['git', '-C', '/tmp/claude-1000/-home-brett-projects-xFactory-openxFactory/b61273ce-a0b0-4c9f-b5ca-99db0f7b36ff/scratchpad/fix-705/.baseline-main', 'show', '87c15baa:openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario/proposal.md']' returned non-zero exit status 128.
    EXIT=1
    
    AFTER (this branch):
    $ python3 scripts/validate-scope-globs.py --archive-gate openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario --ratified-ref 87c15baa
    scope_globs scope-retention gate passed (scope unchanged since ratification).
    EXIT=0
    
    And the unresolvable-id arm on the same real corpus, a named finding rather than a traceback:
    $ python3 scripts/validate-scope-globs.py --archive-gate openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario --ratified-ref 1897f282~200
    scope_globs SCOPE-RETENTION gate CANNOT RUN:
      - 'amend-published-tip-unreadable-scenario' has no proposal.md at ref '1897f282~200' — tried 'openspec/changes/amend-published-tip-unreadable-scenario/proposal.md' and any 'openspec/changes/archive/<YYYY-MM-DD>-amend-published-tip-unreadable-scenario/proposal.md'; neither exists in that ref's tree
    EXIT=2
    
  • 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.
  • The gate itself, first observed after this PR opened: all nine required checks PASS at head 183753fa, pytest-suite among them (run 34027573546, 22m39s) — selected=9836 passed=9815 skipped=21 failures=0 errors=0, meeting the EXACT skip pin of 21 and both floors (selected>=7090, passed>=7070), with the freshness verifier and the vector replay both passed.
  • Review round 2 re-verification at head d9569096, in this clone: python3 -m pytest tests/scope_globs tests/sequenced_after -q → 247 passed in 8.86s; full suite python3 -m pytest -q → 95 failed, 9833 passed, 110 skipped, 9 warnings, 50 errors, 72 subtests passed in 2689.61s (0:44:49) — SKIPPED 110, identical to BOTH round-0 local runs (branch and origin/main) recorded above, and the failure/error counts are the same environment-dependency set (three fewer failures than round 0 because the temporary .baseline-main/ worktree that inflated that run has since been removed from the clone); python3 scripts/validate-scope-globs.py . → scope_globs validation passed (all active changes conform). (exit 0); and the issue reproduction --archive-gate openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario --ratified-ref 87c15baa → scope_globs scope-retention gate passed (scope unchanged since ratification). (exit 0). The pytest-suite gate on GitHub remains the skip-pin authority (EXACT 21).
  • The gate at the round-2 head d9569096: 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-suite run 34038244933, 22m47s — 9734 passed, 21 skipped, 338 deselected, 9 warnings, 93 subtests passed, pinned as selected=9848 passed=9827 skipped=21 failures=0 errors=0: the EXACT skip pin of 21 is met again, with the named freshness verifier and the vector replay both passed. Copilot re-reviewed d9569096 (review 5125564734) and recommended approval with 0 new comments; both review threads are resolved and 0 remain unresolved.
  • Codex review: NOT requested/absent — Codex has been usage-limited on every request since 2026-09-03, recorded twice on this PR and not re-requested for round 2. Absence recorded, never read as clearance.

Review round 1 (adversarial pass → 84c77de4)

Four fixes, all inside the declared scope, and six fixtures: scope_retention_at_archive now RESOLVES change_dir before the change id is read (an unresolved relative spelling carried neither the directory's own name nor its parent's, so cd <archived dir> && --archive-gate . read the id as ''); _git_toplevel converts a failed rev-parse --show-toplevel into a named ScopeGlobsResolutionError; an unresolvable or non-commit --ratified-ref is named as such rather than reported as an absent change; and the deferred sibling loader probes EVERY attribute the gate uses (change_id_of_dir, proposal_path_at_ref, SequencedAfterError) on BOTH the sys.modules cache-hit path and after exec_module. Fixtures: test_the_archive_gate_RUNS_when_CHANGE_DIR_IS_DOT_from_inside_the_archived_dir, test_the_archive_gate_RUNS_on_a_RELATIVE_dated_dir_name_from_inside_archive, test_a_CHANGE_DIR_OUTSIDE_A_WORK_TREE_is_a_finding_not_a_CalledProcessError, test_an_UNRESOLVABLE_RATIFIED_REF_is_named_as_such_not_as_an_absent_change, test_a_ref_naming_a_NON_COMMIT_OBJECT_is_refused_as_an_unresolvable_ref, test_the_sibling_loader_REQUIRES_every_attribute_the_gate_uses.

Review round 2 (d9569096) — two Copilot threads on head d4112e65, one taken, one refused

  • TAKEN — a missing working-tree proposal.md reported a verdict instead of refusing to run (scripts/scope_globs.py:580). scope_retention_at_archive read an absent current-side proposal as "no scope declared" (current = read_scope_globs(proposal) if proposal.is_file() else None) and compared on, so a ratified-absent change reported RETAINED and a ratified-present one reported a contested MUTATION — a removal nobody made, because the file that would hold the declaration is not there. Both are verdicts about a declaration the gate never read, and the CLI's own contract already said the other thing: every failure to READ the current front matter is a named finding with exit 2. It now raises ScopeGlobsResolutionError naming the change directory and the missing path, which _archive_gate already catches and prints as scope_globs SCOPE-RETENTION gate CANNOT RUN: — exit 2, no traceback. Docstring and --archive-gate usage text updated to list the new arm. New fixture test_a_MISSING_WORKING_TREE_PROPOSAL_is_a_CANNOT_RUN_finding_not_a_verdict, built the way the neighbouring archive-gate tests are (a ratified commit carrying the scope, then a git rm of the proposal in a later commit; the directory survives because it also carries tasks.md); it asserts the direct call raises the named error and the CLI exits 2 with CANNOT RUN, no Traceback on either stream, and no contested.
  • REFUSED, already addressed — "the sys.modules cache check only verifies proposal_path_at_ref" (scripts/scope_globs.py:160). The comment carries original_commit_id 183753fa, the branch's first commit, where line 155 really did read if module is not None and hasattr(module, "proposal_path_at_ref"):. 84c77de4 — an ancestor of the reviewed head d4112e65 — replaced it with the full-set probe now at scripts/scope_globs.py:157-160, re-probed after exec_module at :186-192, pinned by test_the_sibling_loader_REQUIRES_every_attribute_the_gate_uses. GitHub flags the thread isOutdated: true (originalLine 155 → line 160), and Copilot's OWN second review, taken at d4112e65 (review 5125162188), generated 0 new comments and recommended approval. No change made.

Follow-on (out of scope, deliberately not taken here)

The sibling gate sequenced_after.retention_at_archive reads a missing working-tree proposal.md as ABSENT and compares on — scripts/sequenced_after.py:740, current = read_declaration(proposal) if proposal.is_file() else ABSENT. That is now the ONE arm on which the two archive gates differ. scripts/sequenced_after.py is outside this PR's declared scope (scripts/scope_globs.py, scripts/validate-scope-globs.py, tests/scope_globs/test_integrity.py), so the divergence is recorded rather than fixed: a comment at the raise site says so, and the alignment is owed as a separate change.

No OpenSpec change — plain fix PR for a pre-existing implementation defect, per the #638 precedent scoped in #705. No sweep-ledger row: the ledger seeds rows for OpenSpec changes, and this PR adds none (#638 added none either). Files touched: scripts/scope_globs.py, scripts/validate-scope-globs.py, tests/scope_globs/test_integrity.py — nothing outside the scope declared in #705.

Closes #705

🤖 Generated with Claude Code

https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv

…ge id

`scope_retention_at_archive` derived the ratified-side proposal path from
CHANGE_DIR's CURRENT path, so once a change had moved to
`openspec/changes/archive/<date>-<id>/` the gate asked git for that archived
path at `--ratified-ref` — a commit before the rename, where it never existed —
and died with an unhandled CalledProcessError traceback instead of a finding,
on exactly the archived directory the gate exists to check (#705).

The ratified-side proposal is now located BY CHANGE ID against the ref's own
tree, REUSING the sibling `scripts/sequenced_after.py`'s `change_id_of_dir` and
`proposal_path_at_ref` (added by #638 for the identical defect in the
parent-declaration gate) rather than re-implementing the convention, so the two
archive gates cannot drift apart. The sibling is loaded on first use, by
location, under `sequenced_after_substrate`: deferred because this module is
vendored byte-for-byte into codexFactory's merge gate, which vendors only this
file and `frontmatter_strict.py` and never calls the archive freeze; by that
name because `tests/sequenced_after/` is itself an importable package called
`sequenced_after`. An unresolvable id raises the new named
`ScopeGlobsResolutionError` (a `ScopeGlobsError` subclass, so callers keep one
error class) and the CLI reports it as a named finding with exit 2.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
Copilot AI lite review requested due to automatic review settings September 6, 2026 10:29

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are still concrete edge cases that can produce incorrect results or an unexpected traceback (notably the cached substrate-module validation and missing current proposal.md handling) that should be fixed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes the validate-scope-globs.py --archive-gate path-resolution failure when the change directory has already been renamed into openspec/changes/archive/<date>-<id>/, by resolving the ratified-side proposal.md by change id against the ratified ref’s tree (reusing the existing sequenced_after substrate logic via a deferred, by-location import). Adds targeted fixtures to ensure the archive-rename scenario is covered and the deferred import remains load-bearing.

Changes:

  • Rework scope_retention_at_archive() to locate the ratified proposal path via sequenced_after.proposal_path_at_ref() using the change id, not the current directory path.
  • Update the validator CLI’s --archive-gate behavior/documentation to report “cannot run” cases as a named finding (exit 2) instead of a traceback.
  • Add new integrity tests covering archive-rename behavior, missing-proposal-at-ref reporting, archived-ref resolution branch coverage, and the deferred-import guard.
File summaries
File Description
scripts/scope_globs.py Resolves ratified-side proposal by change id at the ref via deferred loading of sequenced_after substrate; introduces ScopeGlobsResolutionError.
scripts/validate-scope-globs.py Updates --archive-gate usage docs and catches ScopeGlobsError to emit a named “CANNOT RUN” finding with exit 2.
tests/scope_globs/test_integrity.py Adds fixtures for archive-rename scenarios and pins the deferred-import requirement.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/scope_globs.py Resolved
Comment thread scripts/scope_globs.py Resolved
…efusal

Adversarial review of the by-id resolution found the archive gate still
refusing directories it can check, and still tracing back on the operator
error class #705 filed. Four fixes, all inside the declared scope.

- `scope_retention_at_archive` RESOLVES `change_dir` before the change id is
  read. The id is decided from the directory's own name and its PARENT's name
  ('archive' or not), so an unresolved relative spelling carries neither: `cd
  <archived dir> && --archive-gate .` read the id as '' (a REGRESSION from
  main, which derived the path from the resolved location), and `cd
  archive && --archive-gate <date>-<id>` never stripped the date prefix. Both
  were exit 2 CANNOT RUN on the previous head, both are exit 0 now, measured
  on this repository's own archived corpus.
- `_git_toplevel` converts a failed `rev-parse --show-toplevel` into
  `ScopeGlobsResolutionError` naming the directory, so a mistyped or
  outside-the-work-tree CHANGE_DIR — the same class of operator error #705
  filed — is a named finding with exit 2 rather than an unhandled
  `CalledProcessError` traceback.
- The ratified ref is confirmed to name a COMMIT before the by-id lookup. The
  lookup's probes deliberately swallow git's exit status, so an unresolvable
  ref or a non-commit object was reported in the wording of a change absent at
  a good ref, pointing the operator at the wrong thing.
- The deferred sibling loader probes EVERY attribute the gate uses
  (`change_id_of_dir`, `proposal_path_at_ref`, `SequencedAfterError`) before
  reusing a cached module, and pops a failed load out of `sys.modules` on ANY
  exception rather than only ImportError/OSError, so a half-initialized stub is
  never left behind. Registration still precedes `exec_module`, as importlib
  does it and as measured necessary: executing the sibling unregistered dies
  with "'NoneType' object has no attribute '__dict__'".

The CLI catch is widened to `CalledProcessError` beside `ScopeGlobsError` as a
backstop, and the usage text states the anchoring (CHANGE_DIR must live under
`openspec/changes/`) and every CANNOT-RUN case. Six fixtures added; the two
cwd-relative ones fail on the previous head.

The identical relative-path defect exists in the sibling
`validate-sequenced-after.py --archive-gate .` and is NOT fixed here: that is
`scripts/sequenced_after.py`, outside this PR's declared scope, and closing it
in both gates at once keeps the single implementation this PR preserves.

Refs #705

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
Copilot AI review requested due to automatic review settings September 6, 2026 11:21
Catch-up so the recorded verification describes the tree that would merge.
Main advanced 1897f28 -> 31cc52b (README.md, docs/, four tasks.md); no
file this PR touches is among them.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped to the archive-gate path, matches the stated fix strategy, and includes targeted regression/behavioral tests for the previously crashing scenarios.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

Bot round taken on head 183753fa, plus an adversarial-review round. Head is now d4112e65 (fix commit 84c77de4 + a catch-up merge of origin/main 31cc52b3).

Copilot, scripts/scope_globs.py:155 — the sys.modules cache probe checks only proposal_path_at_ref: TAKEN. The probe now requires EVERY attribute this module calls on the sibling — change_id_of_dir, proposal_path_at_ref, SequencedAfterError — before reusing a cached module, and a load that produces a module missing any of them raises the same named ScopeGlobsResolutionError rather than reaching an AttributeError at the call site. Two related hardenings in the same function: the except is widened from (ImportError, OSError) to Exception so ANY module-level failure in the sibling (a SyntaxError after an edit, an assertion at import) still arrives as the named finding, and the sys.modules entry is popped on every failure path so a half-initialized stub is never left behind. Registration still precedes exec_module: executing the sibling while it is absent from sys.modules was MEASURED to die with 'NoneType' object has no attribute '__dict__', so "register only after a successful exec" is not available here.

Copilot, scripts/scope_globs.py:508 — an absent working-tree proposal.md read as current=None: ANSWERED, not changed. Three reasons. (1) That line is pre-existing and unchanged by this PR — git diff 1897f282..183753fa shows it as context, not as a change. (2) It is character-for-character the sibling gate's own behaviour (sequenced_after.retention_at_archive: current = read_declaration(proposal) if proposal.is_file() else ABSENT), and this PR exists to keep the two archive gates on ONE reading of the convention; diverging their absent-file semantics inside a fix for #705 is exactly the drift it was written to prevent. If the semantics should change, it should change in one packet touching both gates. (3) The usage text's "the ratified or current front-matter cannot be read" names a declaration that is present but malformed or non-dialect, not an absent file — and the operator error this comment is really worried about, a CHANGE_DIR that names nothing, now lands earlier as a named CANNOT RUN (exit 2) from either the work-tree probe or the by-id lookup, never as a misleading pass or mutation. Measured on this corpus at the new head:

$ python3 scripts/validate-scope-globs.py --archive-gate /tmp/no/such/dir --ratified-ref 87c15baa
scope_globs SCOPE-RETENTION gate CANNOT RUN:
  - '/tmp/no/such' is not inside a git work tree, so the ratified-side proposal cannot be read: fatal: cannot change to '/tmp/no/such': No such file or directory
EXIT=2

Adversarial review, taken in this round (detail in the updated PR body): the cwd-relative CHANGE_DIR regression (cd <archived dir> && --archive-gate . was exit 0 on main, exit 2 on 183753fa, and is exit 0 again now), the CalledProcessError traceback still reachable through _git_toplevel, and a --ratified-ref that does not name a commit being reported in the wording of a change absent at a good ref. Six fixtures added; the two cwd-relative ones fail on 183753fa.

Not taken, with reasons. The identical cwd-relative defect in the sibling validate-sequenced-after.py --archive-gate . is REPRODUCED ('' has no proposal.md at ref ...) and left unfixed: scripts/sequenced_after.py is outside this PR's declared scope, and the same is true of the two remaining shared roughnesses the review found there. Both gates should gain those in one packet, so the single implementation stays single.

Codex: requested on this PR below, so the response — or the usage-limit refusal that has met every request since 2026-09-03 — is recorded here rather than asserted from elsewhere. Absence is recorded as absence, never read as clearance.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

brettheap added a commit that referenced this pull request Sep 6, 2026
… what the narrowing costs (#719 review round)

The three adversarial reviews of PR #719 returned four MINOR findings and five
NOTE-level ones. Taken here, in the packet's own files and its one module:

- **TWO SCENARIOS ADDED to the MODIFIED block.** The amended sentence promoted
  with no scenario exercising it, so the rule would have been pinned only by
  this packet's tests — running code standing in for canon, which is the exact
  shape the proposal refuses. *A marker's reason quotes a code span* and *A
  marker's tail carries no separator outside a code span*, appended at the end
  so no promoted scenario moves. The marker names a BODY unit, so
  `suppression`'s `adds_new_title` gate has nothing to withhold; measured, the
  block still raises ZERO findings from its own family.
- **THE CORPUS FIGURES ARE SCOPED TO THE TREE THEY WERE TAKEN ON.** SEVEN
  markers and 17,566 units re-derive only with this packet's own delta excluded
  — with it the same walk gives EIGHT markers over 109 files. Every place the
  figures appear now says "other than this one" (the delta's AMENDED BY note,
  which promotes into canon, plus proposal.md, design.md, README.md,
  .openspec.yaml and tasks.md 2.1/2.2). The substantive claim is unchanged and
  holds on both readings: no derived unit is literally `WHEN` or `AND`.
- **THE NARROWING OF `document-lifecycle`'s MARKER GRAMMAR IS DISCLOSED.** Its
  "naming each deleted unit as a CommonMark code span" was true of every span
  under the retired rule and is true only of the spans before the boundary
  under the amended one, so an author separating two names with the separator
  now declares only the first. Named in proposal.md as a NEW failure mode this
  amendment creates, deliberate and conservative (the second unit is REPORTED,
  never silently dropped), with its reporting scoped into the owed successor at
  tasks.md 5.1.
- **A SUPPRESSION-LEVEL TEST.** The six added tests held the boundary at parse
  level; the harm lands one level down, where a reason quoting a real canon
  unit makes the retired rule suppress that unit silently. 121 -> 128 (was
  127), the new test running the SAME marker paragraph under both rules. The
  corpus test's docstring now says its same-document unit set is a PROXY for
  the promoted requirement's units.
- **ONE GRAMMAR TOKEN, ONE SPELLING.** The pairing branch's literal " - " and
  its hardcoded [3:] become `_REASON_SEP` and `len(_REASON_SEP)`. Parse
  unchanged.
- **RESIDUE NAMED RATHER THAN EDITED**: specs/019-modified-block-currency-family
  FR-016 and reading A1 still state the retired rule and are deliberately not
  touched (a build record, not promoted canon, pinned by no gate) — tasks.md
  5.3; and the estate-wide run is owed at landing, this lane being confined to
  its own clone — tasks.md 5.4.

REFUSED, with reasons, in the pull request comment: the vendored-scope_globs
note (it is about PR #723, whose file this pull request does not touch), the
estate-wide MEASUREMENT itself (other clones are outside this lane's limits;
the obligation is recorded instead), and the merge-from-main re-measure (owed
at landing, on Brett Heap's word, not in a review round).

Verification re-run at this head and reported in the body. NOTHING IS RATIFIED
by this commit: every document still carries `Status: draft`, .openspec.yaml
still carries drafting provenance with no approval pair, and tasks.md 1.1/1.2
are still unticked.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
…verdict

`scope_retention_at_archive` read an ABSENT current-side `proposal.md` as
"no scope declared" (`current = ... if proposal.is_file() else None`) and
compared on. That made the gate answer a question it had never asked: with a
scope ratified at REF it reported a contested MUTATION -- a removal nobody
made, because the file that would hold the declaration is simply not there;
with nothing ratified it reported RETAINED. Both readings are verdicts about
a declaration the gate never read.

The CLI's own contract already said the other thing: every failure to READ
the current front matter is a named finding with exit 2. So an absent
working-tree proposal now raises `ScopeGlobsResolutionError` naming the change
directory and the path, which `_archive_gate` already catches and prints as
`scope_globs SCOPE-RETENTION gate CANNOT RUN:` with exit 2 and no traceback.

Known divergence, deliberately NOT fixed here: the sibling
`sequenced_after.retention_at_archive` reads the same case as ABSENT and
compares on. `scripts/sequenced_after.py` is outside this PR's declared scope,
so the alignment is recorded in the code as a comment and in the PR body as a
follow-on rather than taken here.

Also: `--archive-gate` usage text names the new arm, and the
`scope_retention_at_archive` docstring lists the new raise.

New fixture: `test_a_MISSING_WORKING_TREE_PROPOSAL_is_a_CANNOT_RUN_finding_not_a_verdict`
-- git fixture in the shape of the neighbouring archive-gate tests (ratified
commit carrying the scope, then `git rm` of the proposal in a later commit,
the directory surviving because it carries a `tasks.md`). Asserts the direct
call raises the named error and that the CLI exits 2 with `CANNOT RUN`, no
`Traceback` on either stream, and no `contested` (the verdict it used to be
mistaken for).

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
Copilot AI review requested due to automatic review settings September 6, 2026 14:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The fix is tightly scoped to the archive-gate resolution path, aligns behavior with the established sequenced_after approach, and is backed by comprehensive new fixtures for the failure modes described in #705.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

FROZEN at d9569096 — all nine required checks green, no further commits from this lane. clearing-dispatch-gate, lane-line, merge-master-approval, openreposhape-pin, openspec-cli-pin, pytest-suite (run 34038244933: 9734 passed / 21 skipped — pinned skip count met exactly), release-tag-gate, signed-execution-chain-gate, wallet-validation: all SUCCESS. Review threads: 2 total, 0 unresolved (round 1 taken in 84c77de4; round 2: thread A refused as already-addressed at this head with citation, thread B taken in d9569096). Copilot's third review at d9569096: approval recommended, 0 comments. Codex: absent (usage-limited) on the one request — recorded as ABSENCE, not clearance. Adversarial review (three lenses at 183753fa): MERGEABLE_AFTER_FIXES → fixes taken, re-verified.

Provenance for the admin merge of #723 (plain fix PR for #705; no OpenSpec change — the #638 precedent). Word: Brett Heap, 2026-09-06 09:2xZ, in session, verbatim "merge 705 when green, then ratify 692" — recorded on #705 ahead of this PR existing. Self-authored PR (brettheap) → REVIEW_REQUIRED is structural → admin merge (standing pattern B2). No Rule 6 window: no openspec/changes/ path is touched. Follow-on named in the body, not claimed: sequenced_after.retention_at_archive reads a missing working-tree proposal as ABSENT rather than refusing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb

@brettheap
brettheap merged commit 6295e38 into main Sep 6, 2026
11 checks passed
brettheap added a commit that referenced this pull request Sep 6, 2026
…ord, capture the records (#719)

RATIFIED 2026-09-06 by Brett Heap (openxFactory operator authority), in
session, verbatim: "merge 705 when green, then ratify 692". The first
clause landed PR #723 (merge 6295e38); this is the second.

THE VETO POINT WAS PUT AND WAS NOT TAKEN. design.md D1 — option A (the
reason begins at the first ` — ` standing outside every code span) against
option B (require the removed units in a fenced list) — was carried in the
pull request body, in tasks.md § 1.2 and in the README row. A is RATIFIED
AS DESIGNED, and A's stated cost is ratified with it: the conservative
narrowing of what document-lifecycle's "naming each deleted unit as a
CommonMark code span" reaches is a NEW failure mode this amendment creates,
it is silently corrected today, and its reporting is the owed successor at
tasks.md § 5.1.

WHAT MOVES. proposal.md, design.md and tasks.md carry Status: ratified with
EXACTLY ONE citation line each (Ratified: in the proposal's front matter,
Ratified by: in the other two), which is what ratified-provenance counts.
.openspec.yaml gains approved_by + approved_on BESIDE the drafting
provenance it was authored with — kind and id unmoved, the
addition-not-rewrite shape add-drafted-proposal-origin defined, and the
shape the archive gate's origin-retention arm reads, which is why the
status flip and the approval pair move in ONE commit. The README OpenSpec
Records row flips. Two records are captured beside the packet:
review/ratification-2026-09-06.md and review/verification-2026-09-06.md.

WHAT DOES NOT MOVE. The spec delta is byte-identical; no promoted canon is
touched; no ledger row moves (a row's derived keys read no lifecycle
status); § 5.1–§ 5.5 stay UNTICKED — the archive is a separate act on
merged-plus-green realization evidence and on a separate word, so #692
closes at archive and not at this landing.

VERIFIED ON THE MERGED TREE (origin/main 6295e38), every number re-derived
after the encode: openspec validate amend-marker-reason-boundary --strict
valid; --all --strict 96 passed / 1 failed (the pre-existing skip_specs
change, an INFO under the pinned 1.12); the pinned entrypoint 95 passed /
2 failed with both dispositioned and 0 undispositioned; doc-health
9 critical / 8 error / 44 warning / 13 info, finding-set diff EMPTY against
both origin/main and the pre-ratification branch, and the family names this
change ZERO times; --family modified-block-currency 0/0/0/8 info; pytest
tests/doc-health 1587 passed (test_modified_block_currency.py 128);
sequenced_after passed (37 active, 2 declaring) and the ledger consistent
(177 rows); scope_globs passed. Two probes fired and cleared: the
proposal-origin class-7 ERROR with the approval pair removed, and the
modified-block-currency carriage finding with the block's marker removed.
The self-reference discharge re-run on the merged tree: names=1 and the
same 550-character reason under BOTH the amended and the retired grammar,
IDENTICAL True.

Refs #692

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants