Skip to content

Archive-gate parity, round 2: sequenced_after resolves CHANGE_DIR, names an unresolvable ref, and refuses outside a work tree; the stale scope-globs follow-on comment retired - #752

Merged
brettheap merged 1 commit into
mainfrom
fix/archive-gate-parity-round-2
Sep 7, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/archive-gate-parity-round-2

Conversation

@brettheap

@brettheap brettheap commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1 (openXfactory-1)

The two archive freeze gates read the SAME corpus over the SAME trees, and an
operator archiving a change runs BOTH. After 723 and 734 they still disagreed
about which inputs they can even be RUN on — three arms present in
scripts/scope_globs.py::scope_retention_at_archive and absent from
scripts/sequenced_after.py::retention_at_archive. This mirrors those three,
retires the stale follow-on comment 723 left behind, and pins the parity with a
test that runs both CLIs over one set of fixtures.

The three arms

1. CHANGE_DIR is resolved to an absolute path BEFORE its change id is read

The id is decided from the directory's own name and its PARENT's name (archive
or not), so a cwd-relative spelling carries components the reading needs and the
path does not have.

Before — cd openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario,
--archive-gate .:

sequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:
  - '' has no proposal.md at ref '87c15baa' — tried 'openspec/changes//proposal.md' and any 'openspec/changes/archive/<YYYY-MM-DD>-/proposal.md'; neither exists in that ref's tree
exit=2

and from inside archive/, --archive-gate 2026-09-05-amend-published-tip-unreadable-scenario:

sequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:
  - '2026-09-05-amend-published-tip-unreadable-scenario' has no proposal.md at ref '87c15baa' — tried 'openspec/changes/2026-09-05-amend-published-tip-unreadable-scenario/proposal.md' and any 'openspec/changes/archive/<YYYY-MM-DD>-2026-09-05-amend-published-tip-unreadable-scenario/proposal.md'; neither exists in that ref's tree
exit=2

Both are refusals of a directory the gate can perfectly well check.

After — both spellings simply run:

sequenced_after retention gate passed (declaration unchanged since ratification).
exit=0

2. An unresolvable --ratified-ref is NAMED as such

A git rev-parse --verify --quiet <ref>^{commit} probe runs BEFORE the by-id
lookup. The lookup's own probes (_blob_exists_at_ref, _archive_dir_names_at_ref)
deliberately swallow git's exit status, so without the probe a typo or a deleted
branch is reported in the wording of a change that is ABSENT at a good ref —
sending the operator to look for a missing directory when the ref is what is
wrong.

Before (--ratified-ref no-such-ref on a real archived directory):

sequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:
  - 'amend-published-tip-unreadable-scenario' has no proposal.md at ref 'no-such-ref' — 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

After:

sequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:
  - the ratified ref 'no-such-ref' does not name a commit in '<repo>' — the ratified-side proposal was not looked up at all; this is an unresolvable ref, NOT a change that is absent at a resolvable one
exit=2

A ref naming a NON-COMMIT object (a blob sha) lands in the same named refusal.

3. A CHANGE_DIR outside any git work tree is a named CANNOT RUN finding

Before (a real proposal in a directory under /tmp, in no repository):

  File ".../scripts/sequenced_after.py", line 622, in _git_toplevel
    out = subprocess.run(
          ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', '-C', '/…/outside-any-repo/add-example', 'rev-parse', '--show-toplevel']' returned non-zero exit status 128.
exit=1

After:

sequenced_after PARENT-DECLARATION-RETENTION gate CANNOT RUN:
  - '/…/outside-any-repo/add-example' is not inside a git work tree, so the ratified-side proposal cannot be read: fatal: not a git repository (or any of the parent directories): .git
exit=2

scripts/validate-sequenced-after.py carries the matching usage text, and — like
validate-scope-globs.py — a subprocess.CalledProcessError backstop beside its
whole-error-class catch. That backstop is the one addition beyond the three arms:
no git call on this path is expected to reach the caller unhandled any more (the
two that used to are exactly arms 2 and 3), and if one ever does it is reported
rather than traced. It is disclosed here rather than folded in silently.

The stale comment, and the vendoring cost

scripts/scope_globs.py ~591-595 still said the sibling gate "deliberately"
read a missing working-tree proposal as ABSENT and that aligning it was a
follow-on. That has been false since 734. The comment is retired and replaced
with the closed record (734 took that arm; this change takes the other three,
and the parity test now holds them together).

git diff scripts/scope_globs.py is COMMENT-ONLY — no code line changes
(verified by filtering the diff to non-comment +/- lines: none). It is still
an edit to a file 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), so it grows the re-vendor
obligation
— add-sequenced-after-substrate task 6.8. A comment-only edit is
still a byte difference to a byte-for-byte pin; nothing here makes it free.

The parity test

tests/sequenced_after/test_gate_parity.py (new, 286 lines) builds ONE git
fixture per arm whose proposal.md carries BOTH frozen fields, runs BOTH CLIs
over it, and asserts they agree:

  • passing arms: across the archive rename; relative . from inside the archived
    dir; relative <date>-<id> from inside archive/ — both exit 0, both print
    "passed", neither traces back;
  • the mutation arm (both fields widened after ratification) — both exit 1 with
    FAILED (contested), so the file does not pass with both gates broken;
  • refusing arms: missing working-tree proposal; unresolvable ref; ref naming a
    non-commit object; CHANGE_DIR outside any work tree — both exit 2, both print
    "CANNOT RUN", and both use the same phrase for the fact (does not name a commit, is not inside a git work tree, no proposal.md in the working tree).

The phrase assertion is load-bearing and was added after measurement: with the
arm-2 fix reverted, the exit codes still MATCHED (both gates reached exit 2, one
by the wrong route), so an exit-code-only parity file would have passed while
the divergence stood. Feasible without cross-importing — the file imports
NEITHER substrate and drives both through their CLIs, which is the surface the
operator and the archival workflow actually touch; a test asserts that (by
parsing its own import statements, not by scanning its own source text).

Verification

Recorded verbatim, from a fresh clone at fix/archive-gate-parity-round-2.

Suite delta. python3 -m pytest tests/sequenced_after tests/scope_globs -q

  • main (d5a549e4): 248 passed in 7.09s
  • branch: 262 passed in 9.51s — +14 (5 fixtures in
    tests/sequenced_after/test_integrity.py, 9 in the new parity file: 3 passing
    arms + 4 refusing arms + the mutation arm + the two-distinct-CLIs guard).

Negative control, arm 1 (.resolve() reverted, fixtures kept):

FAILED tests/sequenced_after/test_integrity.py::test_the_archive_gate_RUNS_when_CHANGE_DIR_IS_DOT_from_inside_the_archived_dir
FAILED tests/sequenced_after/test_integrity.py::test_the_archive_gate_RUNS_on_a_RELATIVE_dated_dir_name_from_inside_archive
2 failed, 29 deselected
FAILED tests/sequenced_after/test_gate_parity.py::test_BOTH_GATES_PASS_the_same_runnable_inputs[relative_dot_inside_the_archived_dir]
FAILED tests/sequenced_after/test_gate_parity.py::test_BOTH_GATES_PASS_the_same_runnable_inputs[relative_dated_name_inside_archive]
2 failed, 7 deselected

Negative control, arm 2 (the _ref_names_a_commit guard removed, fixtures kept):

FAILED tests/sequenced_after/test_integrity.py::test_an_UNRESOLVABLE_RATIFIED_REF_is_named_as_such_not_as_an_absent_change
FAILED tests/sequenced_after/test_integrity.py::test_a_ref_naming_a_NON_COMMIT_OBJECT_is_refused_as_an_unresolvable_ref
2 failed, 29 deselected
FAILED tests/sequenced_after/test_gate_parity.py::test_BOTH_GATES_REFUSE_THE_SAME_UNRUNNABLE_INPUTS_AS_CANNOT_RUN[unresolvable_ratified_ref]
FAILED tests/sequenced_after/test_gate_parity.py::test_BOTH_GATES_REFUSE_THE_SAME_UNRUNNABLE_INPUTS_AS_CANNOT_RUN[ratified_ref_naming_a_non_commit_object]
2 failed, 7 deselected

(the parity failures are the SECOND run, after the shared-phrase assertion was
added — the first run of this control passed on exit codes alone, which is the
measurement that motivated the phrase.)

Negative control, arm 3 (check=True restored in _git_toplevel, fixtures kept):

E               subprocess.CalledProcessError: Command '['git', '-C', '/tmp/pytest-of-brett/pytest-20356/test_a_CHANGE_DIR_OUTSIDE_A_WO0/no/such', 'rev-parse', '--show-toplevel']' returned non-zero exit status 128.
FAILED tests/sequenced_after/test_integrity.py::test_a_CHANGE_DIR_OUTSIDE_A_WORK_TREE_is_a_finding_not_a_CalledProcessError
1 failed, 30 deselected
FAILED tests/sequenced_after/test_gate_parity.py::test_BOTH_GATES_REFUSE_THE_SAME_UNRUNNABLE_INPUTS_AS_CANNOT_RUN[change_dir_outside_any_work_tree]
1 failed, 8 deselected

(the parity failure there is the PHRASE assertion, not the exit code: the new
CalledProcessError backstop catches the reverted crash and prints git's own
message under CANNOT RUN — the backstop works, and the phrase is what holds the
parity.)

House validator. python3 scripts/validate-sequenced-after.py .

sequenced_after validation passed (37 active changes, 3 declaring the field).
exit=0

Ledger. python3 scripts/validate-sequenced-after.py . --ledger-diff

sequenced_after corpus sweep
----------------------------
change ids (37 active + 141 archived): 178
co-modified at requirement granularity (each would owe a declaration): 128
sole modifiers (each would declare `sequenced_after: []`): 50
ACTIVE changes: co-modified / sole: 21 / 16
declaring `sequenced_after:`: 6 (add-per-change-sweep-ledger, add-sequenced-after-substrate, amend-chain-anchoring-readiness-and-durability, mirror-floor-addition-grace, mirror-floor-regeneration-automation, register-gate-rules-council-seats)
declaring an explicit `[]` root claim: 0
prose `Sequenced-after:` headers: 3 (3 archived)
DEEPEST DECLARED CHAIN RESOLVED: 2 hop(s), from add-per-change-sweep-ledger

per-change sweep ledger consistent with the corpus (178 rows).
ledger-diff exit=0

The 705 reproduction on this gate, across the rename, still passes.
python3 scripts/validate-sequenced-after.py . --archive-gate openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario --ratified-ref 87c15baa

sequenced_after retention gate passed (declaration unchanged since ratification).
exit=0

doc-health unchanged. python3 scripts/doc-health.py --single-repo .

Findings: 9 critical, 8 error, 58 warning, 13 info. New regressions vs previous report: 0.

identical on main (stashed) and on the branch; exit 0 both.

Full suite. The CI pytest-suite check is the authority, and it is the
skip pin:

selected=10262 passed=10241 skipped=21 failures=0 errors=0
floors: selected>=7090 (margin 3172) passed>=7070 (margin 3171) skipped==21
freshness verifier (…TheFreshnessVerifier::test_the_snapshot_is_byte_identical_to_the_pinned_core): passed
vector replay (…TheVectorReplay::test_every_vector_replays): passed

pass, 23m52s.

Locally the whole run does not complete on this host: python3 -m pytest -q -p no:randomly collects 10492 and was cut at 86% by its own 50-minute cap (the box
was running three other sessions' suites concurrently), and a second attempt was
abandoned at 29%. The single F the truncated run showed was located and run on
its own:

python3 -m pytest -q -p no:randomly -rf --tb=line tests/ideation-dashboard
FAILED tests/ideation-dashboard/test_snapshot.py::test_find_validator_locates_pinned_checkout
1 failed, 5010 passed, 31 skipped in 713.77s (0:11:53)

The environment-dependent family, named: test_snapshot.py::test_find_validator_locates_pinned_checkout
asserts snapshot.find_validator(REPO_ROOT) is not None — it needs a SIBLING
openxFactory checkout reachable from the repo root, i.e. the
~/projects/xFactory/ workspace layout. This work was done in a standalone
scratchpad clone with no siblings, so it fails with assert None is not None;
its neighbour test_minimal_snapshot_validates_against_pinned_validator skips on
the same condition rather than asserting it. Nothing in this change is reachable
from tests/ideation-dashboard/ — the file touches no code it imports — and CI,
which provides the layout, is green. The local skip count also differs from the
pinned 21 for the same reason (31 skips in that one directory alone), which is
why the CI check, not a local run, is the skip-pin authority.

Governance

No OpenSpec change — plain fix per the 638 precedent, on Brett Heap's word
2026-09-07 ("lets work on these").

Closes #749

🤖 Generated with Claude Code

https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb

…ope-globs has

`scripts/sequenced_after.py::retention_at_archive` now refuses the three inputs
`scripts/scope_globs.py::scope_retention_at_archive` has refused since #723:

1. CHANGE_DIR is RESOLVED to an absolute path before its change id is read, so a
   cwd-relative spelling (`.` from inside the archived directory, `<date>-<id>`
   from inside `archive/`) is read against the components it actually carries.
   Before: `.` read as the id `''`; `<date>-<id>` read as an id still carrying
   the date prefix — both refused a directory the gate can perfectly well check.
2. An unresolvable `--ratified-ref` is NAMED as such, by a
   `git rev-parse --verify --quiet <ref>^{commit}` probe run BEFORE the by-id
   lookup. Before: the lookup's own probes swallow git's exit status, so a typo
   or a deleted branch was reported in the wording of a change ABSENT at a good
   ref — the wrong repair.
3. A CHANGE_DIR outside any git work tree is a named CANNOT RUN finding with
   exit 2. Before: a `CalledProcessError` traceback out of `_git_toplevel`,
   exit 1 — the same class of operator error #705 filed against the sibling.

`scripts/validate-sequenced-after.py` carries the matching usage text and, like
`validate-scope-globs.py`, a `CalledProcessError` backstop beside its
whole-error-class catch, so no git failure on this path can trace back.

The stale "KNOWN DIVERGENCE FROM THE SIBLING GATE, deliberately not fixed here"
comment in `scripts/scope_globs.py` is retired — false since #734. That edit is
COMMENT-ONLY (no code line changes) but `scope_globs.py` is vendored
byte-for-byte into codexFactory's merge gate, so it grows the re-vendor
obligation (add-sequenced-after-substrate task 6.8).

`tests/sequenced_after/test_gate_parity.py` runs BOTH CLIs over ONE set of git
fixtures per arm and asserts identical exit codes, the shared refusal phrase and
"CANNOT RUN" on every refusal — importing neither substrate, so the two are
pinned through the surface an operator actually touches.

Closes #749

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

@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 ✨

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

@codex review

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 behavioral changes are narrowly scoped, mirror the established sibling-gate implementation, and are strongly pinned by both unit-level integrity tests and a CLI-level parity suite.

Pull request overview

This PR brings scripts/sequenced_after.py::retention_at_archive to parity with the sibling archive-freeze gate in scripts/scope_globs.py, ensuring both gates handle the same runnable/refusal inputs consistently and that any future divergence is caught by tests rather than operators.

Changes:

  • Align sequenced_after’s archive-gate behavior with scope_globs by (a) resolving CHANGE_DIR before reading the change id, (b) naming unresolvable/non-commit --ratified-ref inputs explicitly, and (c) converting “outside any git work tree” into a named refusal rather than a traceback.
  • Add/extend tests to pin both gates’ CLI behavior (exit codes + refusal phrases) over shared git fixtures.
  • Retire the stale “known divergence” follow-on comment in scripts/scope_globs.py and update validate-sequenced-after.py’s archive-gate contract text + backstop error handling.
File summaries
File Description
tests/sequenced_after/test_integrity.py Adds fixtures asserting the sequenced_after archive gate runs/refuses correctly for the three newly-aligned arms.
tests/sequenced_after/test_gate_parity.py New CLI-level parity suite that runs both gates over the same fixtures and asserts matching exit codes and refusal phrasing.
scripts/validate-sequenced-after.py Updates archive-gate contract text and catches CalledProcessError as a last-resort “CANNOT RUN” backstop (matching scope-globs CLI).
scripts/sequenced_after.py Implements the three parity arms: resolve CHANGE_DIR, _ref_names_a_commit probe, and _git_toplevel refusal instead of traceback.
scripts/scope_globs.py Comment-only update to close the previously recorded divergence and point at the new parity test as the long-term guardrail.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: fbc9f3fc01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

FROZEN at fbc9f3fc — all nine required checks green, no further commits from this lane. pytest-suite: 10241 passed / 21 skipped (pinned skip count met exactly). Review threads: 0. Copilot: approval recommended, 0 comments. Codex REVIEWED this exact head: "Didn't find any major issues" — a real review, recorded as such (first Codex clearance on this lane since 2026-09-03).

Provenance for the admin merge of #752 (plain fix; no OpenSpec change — the #638/#723/#734 precedent). Words: Brett Heap, 2026-09-07 ~12:4xZ, verbatim "lets work on these" naming the three divergent arms and the stale vendored comment (recorded + claimed on #749), then ~14:3xZ verbatim "merge them when green, then ratify 753" (recorded on #749). Three arms mirrored from the scope-globs gate into sequenced_after.retention_at_archive (CHANGE_DIR resolved; unresolvable ref named; outside-work-tree → CANNOT RUN exit 2), a nine-test parity file running both CLIs over shared fixtures, the stale scope_globs.py comment retired (comment-only, verified; grows codexFactory's re-vendor obligation, disclosed). Self-authored PR (brettheap) → REVIEW_REQUIRED structural → admin merge (B2). No Rule 6 window (no openspec/changes/ path). #749 closes with this merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb

@brettheap
brettheap merged commit 3a28fac into main Sep 7, 2026
11 checks passed
brettheap added a commit that referenced this pull request Sep 7, 2026
…mber (#757)

Catch-up so this branch's `sequenced_after` row is validated by the tooling
main now carries (#752's archive-gate parity round 2 rewrote
`scripts/sequenced_after.py` and `scripts/validate-sequenced-after.py`).

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZqmqSDBCmY4cfhPbxN9Xb
brettheap added a commit that referenced this pull request Sep 7, 2026
…09-07 word, capture the records (#753)

RATIFIED 2026-09-07 by Brett Heap (openxFactory operator authority), in session,
verbatim: "merge them when green, then ratify 753". The first clause landed
openxFactory #752 (`3a28face`) and #755 (`64aad02e`) and
xFactory-Hermes-Install #72 (`06c9083d`); this is the second.

BOTH VETO POINTS WERE PUT AND NEITHER WAS TAKEN. `design.md` D1 — option A
(split the changelog arm on the fact the read already establishes, so a HELD tip
with no readable changelog is GRADED with no declarations) against option B
(keep the skip and give the held case a distinct reason class only) — is
ratified AS DESIGNED, and A's stated cost is ratified with it: A changes which
findings an in-scope repository receives, in the conservative direction, with the
estate-wide consequence named as owed at `tasks.md` § 6.1 rather than claimed.
`design.md` D2 — the retired skip's fact re-reported at `info` beside the grading
rather than dropped — was carried separately so it could be vetoed on its own,
and was not vetoed either.

ONE CITATION LINE PER DOCUMENT, which is what `ratified-provenance` counts:
`Ratified:` in `proposal.md`'s front matter, `Ratified by:` in `design.md` and
`tasks.md`. `.openspec.yaml` gains `approved_by` + `approved_on` BESIDE the
drafting provenance it was authored with — `kind`, `id` and `reason` unmoved,
the addition-not-rewrite shape `add-drafted-proposal-origin` defined. The status
flip and the approval pair move in ONE commit because the origin-retention gate
resolves the ratifying commit as the FIRST commit declaring `Status: ratified`.

THE WORD DOES NOT ARCHIVE. `code_surface` is non-empty, so under
`release-realization` the archive is a separate act on merged-plus-green
realization evidence and a separate word (§ 6.4, still unticked); #750 closes at
archive, which is why the pull request says Refs and not Closes. § 6.1, § 6.2,
§ 6.5 and § 6.6 remain owed exactly as the word was given over them — including
§ 6.6's two recorded remedies for the late-`Skip` trace drop, NEITHER of which
this word takes.

Records: review/ratification-2026-09-07.md and review/verification-2026-09-07.md,
every number in them re-derived on this tree at origin/main 64aad02. No ledger
row moves: a row's derived keys read no lifecycle status.

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