Skip to content

Harden the SPENT-state containment guard: every structural boundary closes an entry, fences are opaque, and the floor holds - #589

Merged
brettheap merged 21 commits into
mainfrom
fix/spent-state-containment-hardening
Sep 3, 2026
Merged

brettheap merged 21 commits into
mainfrom
fix/spent-state-containment-hardening

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1d

Claim: #584 (comment)

Re-scopes #584 (closed with a pointer). The same ratified change was realized twice in parallel; the realization half landed as #587 (squash 3fa222f3) and this branch carries #584's other half — the containment repairs its five bot rounds found, which main does not have. No blame in that: two sessions worked the same packet and one squashed first.

Why containment is the guard worth hardening

declare-spent-bundle-state accepts a declaration only where the changelog entry CONTAINING it is the entry of the bundle it names as superseding — so the act that spends a number is the LATER CUT that allocates its replacement, and a bundle can never declare itself spent.

Every way of closing an entry the reader does not know about is therefore an ACCEPT. A declaration under an unrecognized boundary keeps the previous release entry's authority, matches the bundle it names, and the superseded-and-never-published error this family exists to raise is replaced by an info. Seven of the ten escapes below are that class.

The escapes, each measured against main's code before a line was written

Probed through main's own parse_spent_declarations / check_repo, not inferred from the finding text. Full transcripts: evidence/hardening-red-first.md.

# escape on main after
F1 a non-release ## Deprecations does not close the entry entry=contract-v3.0 — wrongly ACCEPTED entry=None — refused
F2 ## contract-v3.0.1 / ## contract-v3.0-notes open contract-v3.0's entry (\b is not a complete-token test) wrongly ACCEPTED entry=None; ## contract-v3.01 still opens its own, being a real name
F7 a level-one # heading does not close the entry wrongly ACCEPTED refused; ###+ still does NOT close, which is load-bearing
F9a a heading inside a code fence reopens an entry (main: "NO FENCE TRACKING, deliberately") wrongly ACCEPTED, and contracts/CHANGELOG.md already carries a fence fences opaque; the declaration lands in the entry it was really written in
F9b an indented ATX heading (1–3 spaces) is missed wrongly ACCEPTED closes; four spaces is an indented code block and does not
L2 Setext headings (===/---) do not close wrongly ACCEPTED close, and never OPEN; a thematic break and a table rule close nothing
L3 an empty ATX heading (## alone) is not a boundary wrongly ACCEPTED is a boundary
F8 a below-floor repo with no contracts/CHANGELOG.md is SKIPPED entirely (the guard sat above parse_bundle) silent "not checked" [] — answered as it always was; the guard is gated on in-scope-ness
F11 the batch-read Skip names only the manifest though both were read misleading skip names both, and says NEITHER was obtained
L4 a below-floor SUBJECT raises an orphan warning whose action is false for it spurious warning silent; a wrong-shape subject still raises it

Ten of ten reproduced on main. None skipped. Three findings from #584's rounds are deliberately absent because they do not exist here (F3, F10, F12/F13 — main phrases that refusal conditionally, its orphan guard is unconditional and early, and it computes the reason in _declaration_state); each is named with its reason in the evidence file.

What changed, and why it reads as a hardening

One structural-boundary function, _entry_boundary(line, previous, in_fence) -> (closes, opens), that every heading shape passes through — TOTAL over the fence state, so a second caller cannot reintroduce the escape by forgetting to skip fenced lines. Beside it _fence_state and _setext_content, each answering one question, and two floor predicates that are deliberately not each other's negation (a name of the wrong shape is neither above the floor nor below it, which is exactly the distinction the orphan sweep turns on).

Five of #584's containment findings were each found on the fix for the last. That is what a rule scattered across one regex and one startswith looks like from outside, so the rule is now pinned as ONE parametrized table — 21 rows carrying the stays-open cases beside the closes cases, so it cannot be satisfied by a reader that closes on everything any more than by one that closes on nothing.

The fence rule, decided explicitly: fenced blocks ( ``` and ~~~, closer of the same character, at least as long, followed only by whitespace) are OPAQUE to headings and to the reserved opener. Fail-closed in both directions — an example inside a fence cannot spend a bundle, and a declaration hidden in one does not count, leaving the superseded `error` standing. This replaces `main`'s "no fence tracking" reading, whose stated fear (a declaration hidden by indentation) is unreachable because the opener matches at column zero.

Over-closing is the fail-closed error and under-closing is not, which picks every judgment above — but a rule tightened past the live document would refuse the declaration that makes main green. So the live read is a test: it reads contracts/CHANGELOG.md from disk, pins entry == contract-v3.0, and carries a spliced-heading positive control over the same bytes.

main's reader was adapted, not replaced. #584's module returns a dict keyed by subject and splits judgment into a separate spent_refusal; porting that would have rewritten a module that landed hours earlier and made the repair unreviewable inside it.

Tests

family file tests/doc-health
origin/main 47f90080 46 passed 1411 passed, 0 failed
this head 73 passed 1438 passed, 0 failed

+27: 21 table rows and 6 scenario tests, each with a positive control per the file's convention. Zero tests deleted, zero edited to pass. One fixture was extended — test_an_unreadable_changelog_at_the_published_tip_skips's shim now answers ls_tree_paths, because the guard it exercises deliberately moved below the inventory listing — and its assertions were kept, with one added.

The self-gate is green on main and stays green here. Unlike #584 this branch carries no declared red: the declaration is already live, so any failure in that file would be this branch's own.

Gates, at de4f96a7

gate result
pytest tests/doc-health 1438 passed, 0 failed
pytest tests/sequenced_after 118 passed
validate-sequenced-after.py . passed — 31 active, 1 declaring. No pin moved
openspec validate --all --strict 84 passed, 0 failed
proposal-support verify declare-spent-bundle-state ok
verify-commit --commit HEAD exactly two mismatches, contracts/CHANGELOG.md and docs/contract-versioning-policy.md — byte-identical to the same command at origin/main, therefore inherited. This branch edits no inventory member
doc-health --single-repo, base vs head, same --as-of 54 findings both sides, finding lists BYTE-IDENTICAL (6 critical, 5 error, 29 warning, 14 info). Whole report diff is 20 lines: canon share 34.3% → 34.4% and the standard stage's words 14482 → 14675, from the one paragraph added to docs/doc-health.md. No new finding, none removed

The live-corpus read that matters most is the ACCEPTED info itself, unchanged on contracts/releases/contract-v2.6.digests.yaml — main's answer, read through every tightened rule. The hardening refuses more and accepts exactly what it accepted before.

Deliberately untouched

contracts/CHANGELOG.md, contracts/manifest.yaml, contracts/releases/*, docs/contract-versioning-policy.md, health/dispositions.yaml. Nothing is ticked in openspec/changes/declare-spent-bundle-state/tasks.md § 2 (that group is #587's) or § 5 (the archive is not this PR's); one dated line is added under § 2.3 recording this PR and the escapes it closes. docs/doc-health.md gains one paragraph saying what "inside the entry" means; family counts are untouched. The 027-spent-bundle-state branch is left alone.

The Speckit feature specs/027-spent-bundle-state/ is carried and re-framed: spec/plan/tasks state that the realization landed as #587, the existing evidence files are kept, and evidence/test-counts.md carries a correction against itself — #584's family count was 66, not the 69 it published.

…loses an entry, fences are opaque, and the floor holds

The containment rule is the guard `declare-spent-bundle-state` leans on
hardest — a declaration is accepted only where the changelog entry CONTAINING
it is the entry of the bundle it names as superseding — and every way of
closing an entry the reader does not know about is an ACCEPT: the declaration
keeps the previous release entry's authority and quiets the
superseded-and-never-published `error` the family exists to raise.

Ten escapes were measured against main's reader before a line was written, each
probed through main's own functions rather than inferred (F1 a non-release `##`
heading; F2 an incomplete version token; F7 a level-one heading; F9a a heading
inside a code fence; F9b an indented ATX heading; L2 Setext headings; L3 an
empty ATX heading; F8 a below-floor repository with no changelog now skipped
entirely; F11 a batch-read skip naming one of two members; L4 a spurious orphan
warning on a below-floor subject). Seven of the ten let a declaration be
accepted from outside its superseding bundle's entry.

The rule now passes through ONE structural-boundary function rather than one
regex a reader has to re-derive, and is pinned as ONE parametrized table
carrying the stays-open rows beside the closes rows — so the next shape of
heading somebody invents is a row rather than a round. Fenced blocks are
declared OPAQUE to headings and to the reserved opener alike, which is
fail-closed both ways: an example inside a fence cannot spend a bundle, and a
declaration hidden in one does not count, leaving the `error` standing. The
changelog guard moves below `parse_bundle` and is gated on in-scope-ness, so a
repository with no bundle at or above the enforcement floor is answered as it
always was.

Over-closing is the fail-closed error and under-closing is not, which picks
every judgment here — but a rule tightened past the live document would refuse
the declaration that makes main green, so the live read is a test: it reads
`contracts/CHANGELOG.md` from disk, pins `entry == contract-v3.0`, and carries a
spliced-heading control over the same bytes.

Family file 46 -> 73 tests; `tests/doc-health` 1411 -> 1438 passed, zero
failures on both sides. doc-health `--single-repo` over the live corpus: 54
findings before and after, the two finding lists BYTE-IDENTICAL.

Re-scopes #584, whose realization half landed as #587 (`3fa222f3`); its Speckit
feature `specs/027-spent-bundle-state/` is carried and re-framed, with
`evidence/hardening-red-first.md` measuring each escape before and after.
`contracts/CHANGELOG.md`, `contracts/manifest.yaml`, `contracts/releases/*`,
`docs/contract-versioning-policy.md` and `health/dispositions.yaml` are
untouched.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 2, 2026 19:24

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

…thing

The ladder is #587's and its box stays as #587 left it. One dated line names
PR #589, the ten escapes it measured against main's reader, and the seven that
let a declaration be accepted from outside its superseding bundle's entry — so
the packet's record says what was hardened over it rather than leaving the
repair discoverable only from a PR conversation.

Group 5's archive is not this PR's.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>

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

One new test asserts the repository has exactly one SPENT declaration, which is unnecessarily brittle and will fail on valid future additions.

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

Pull request overview

This PR hardens the release-tag-publication doc-health family’s SPENT-declaration containment parsing so declarations are only accepted when truly inside the superseding bundle’s ## contract-vX.Y changelog entry, with structural boundaries handled centrally (including fence opacity) and floor/in-scope gating preserved.

Changes:

  • Centralizes changelog structural-boundary handling via _entry_boundary(...) (ATX, Setext, indentation, and complete-token matching) and makes fenced blocks opaque to both headings and SPENT declarations.
  • Moves/gates the changelog-read guard on computed in-scope bundles, fixes batch-read Skip messaging, and adjusts orphan-subject logic for below-floor subjects.
  • Adds an explicit boundary truth-table + scenario tests, and updates doc/feature artifacts to record measurements, gates, and re-scoping.
File summaries
File Description
tests/doc-health/test_release_tag_publication.py Adds a boundary-table and scenario tests for containment, fences, floor gating, and skip/orphan behaviors.
scripts/doc_health/release_tag_publication.py Implements unified boundary parsing (incl. fence/setext), in-scope gating for the changelog guard, and clearer Skip reasons.
docs/doc-health.md Documents what “inside the entry” means for SPENT containment (incl. fences and heading levels).
openspec/changes/declare-spent-bundle-state/tasks.md Records the containment-hardening follow-up and enumerates the closed escapes.
specs/027-spent-bundle-state/spec.md Re-frames the feature to focus on containment hardening (realization already landed elsewhere).
specs/027-spent-bundle-state/tasks.md Records Phase 6 hardening tasks and measurements as the branch’s scope.
specs/027-spent-bundle-state/plan.md Documents the (re-scoped) hardening plan and design decisions.
specs/027-spent-bundle-state/research.md Captures design-turning research findings (published tip, identity path rules, etc.).
specs/027-spent-bundle-state/quickstart.md Provides a runnable walkthrough to observe accepted/refused behaviors and expected pre/post-merge behavior.
specs/027-spent-bundle-state/pr-body.md Preserves PR #584 narrative as a record, with notes about re-scoping and what’s not part of this branch.
specs/027-spent-bundle-state/data-model.md Documents the reserved form, declaration model, outcomes, and path/identity rules.
specs/027-spent-bundle-state/evidence/hardening-red-first.md Records before/after probes for each containment escape and the confirming green state.
specs/027-spent-bundle-state/evidence/gates.md Captures gate command outputs and their interpretations.
specs/027-spent-bundle-state/evidence/post-merge-proof.md Records the simulated post-merge proof and red-first control.
specs/027-spent-bundle-state/evidence/red-log.md Records the red-log and ordering correction for the earlier realization work.
specs/027-spent-bundle-state/evidence/test-counts.md Corrects earlier miscount and records current collected test counts.
specs/027-spent-bundle-state/evidence/doc-health-delta.md Documents single-repo doc-health deltas (base vs head) and what moved.
specs/027-spent-bundle-state/evidence/doc-health-rows-base.txt Captures normalized ranked-plan rows for the base measurement.
specs/027-spent-bundle-state/evidence/doc-health-rows-head.txt Captures normalized ranked-plan rows for the head measurement.
Review details
  • Files reviewed: 19/19 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.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

All four checks GREEN on bf3f8c23 — bot round 1

check result run
pytest-suite pass, 20m55s — selected=8765 passed=8744 skipped=21 failures=0 errors=0 33673162569
merge-master-approval pass, 23s 33673160310
signed-execution-chain-gate pass, 55s 33673162422
wallet-validation pass, 29s 33673162519

Zero failures, and skipped is exactly the pinned 21. Unlike #584 this branch carries no declared red: the SPENT declaration is already live on main, so the family's self-gate is green and any failure in that file would be this branch's own.

Where to look hardest, since containment is the guard that took five Codex P1s on the predecessor and each was found on the fix for the last:

  • _entry_boundary(line, previous, in_fence) in scripts/doc_health/release_tag_publication.py — is there a heading shape CommonMark admits that it does not close? Under-closing is the escape; over-closing is fail-closed but must not reach the live document.
  • The fence rule: closer of the same character, at least as long, followed only by whitespace — and the deliberate extension of the suppression to the reserved opener. Is that fail-closed in both directions as claimed?
  • _at_or_above_floor / _below_floor are deliberately NOT each other's negation. A subject of the wrong shape must still raise the orphan warning; a well-formed below-floor name must not.
  • The relocated changelog guard: gated on in-scope-ness, so a below-floor repository with no changelog is answered as it always was — but an in-scope bundle still gets its read declined rather than answered.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf3f8c23d9

ℹ️ 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".

…king

Codex P1 — a backtick fence whose info string carries a backtick opens no
CommonMark fence, so the reader ran ONE FENCE OUT OF PHASE with the document:
the next bare fence closed its fictitious block while opening a real one, every
boundary between them was swallowed as code, and a declaration inside the real
block was read as a record. Measured: read AND accepted, from under a `## Notes`
heading, inside a code block — both halves of the containment rule defeated by
one line. The opener splits in two because the rule is not shared: a backtick
fence's info string may not contain a backtick, a tilde fence's may. The test
carries controls on both sides, a one-sided fix stopping tilde fences from
opening at all.

Codex P2 — a run of dashes below a thematic break was read as a Setext
underline, refusing a correctly contained declaration. Taken for that shape,
which CommonMark is unambiguous about, plus a Setext underline as the preceding
line. The broader ask is refused with a measurement: every block form added to
the exclusion list moves the reader toward UNDER-closing, whose failure is
silence about the finding this family exists to raise, where over-closing's
failure is one error standing beside the superseded error and quieting nothing —
and indented code is the case against a blanket exclusion, since an indented
line cannot interrupt a paragraph and the dashes below it genuinely are an
underline. The residue is stated in `_setext_content`'s docstring.

Copilot — the live-read test's `len(read) == 1` reds for the wrong reason the
day a second number is spent. The declaration is looked up by subject now, and
the anti-over-read half the count was standing in for is stated properly: the
reserved form spliced INSIDE the live document's own fenced block must add no
declaration.

Neither shape exists in the live changelog — zero thematic breaks, zero backtick
fence lines CommonMark would decline to open — so both were latent, and are
recorded as latent rather than banked as harmless.

Family file 73 -> 76; `tests/doc-health` 1438 -> 1441 passed, zero failures.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 2, 2026 20:09

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

The live-corpus fence “anti-over-read” test currently splices into the fence opener line (not inside the fenced region), so it can pass without actually validating fence opacity behavior.

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

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

Round 2 — both Codex round-1 findings and Copilot's TAKEN, on head 24be0ce9, all four checks green

Codex P1 (a backtick fence's info string) — TAKEN, and it is the sharpest finding on this branch. A reader ONE FENCE OUT OF PHASE with the document is worse than main's "no fence tracking": measured, the declaration was read from inside a real code block AND accepted from under a ## Notes heading — both halves of the containment rule defeated by one line. The opener splits in two, because the rule is not shared (a backtick fence's info string may not carry a backtick; a tilde fence's may), with controls on both sides since a one-sided fix stops tilde fences opening at all. Full measurement in the thread.

Codex P2 (Setext detection over non-paragraph blocks) — TAKEN for the shape it measured; the broader ask REFUSED with a measurement. *** then --- refused a correctly contained declaration, and CommonMark is unambiguous there, so thematic breaks and Setext underlines leave _setext_content. The rest of the block forms stay in, and the refusal has a direction: every line added to that exclusion list moves this reader toward under-closing, whose failure is silence about the finding this family exists to raise, where over-closing's failure is one error standing beside the superseded error, quieting nothing, repaired by moving one line. Indented code is the case against a blanket exclusion — it cannot interrupt a paragraph, so it is lazy continuation and the dashes below it genuinely are an underline. The residue is stated in _setext_content's own docstring rather than left for a reviewer to find.

Copilot (len(read) == 1 in the live-read test) — TAKEN, and the assertion was doing two jobs. Looked up by subject now, so it reds for a containment defect rather than for the estate spending a second number — and the anti-over-read half the count was standing in for is stated properly: the reserved form spliced inside the live document's own fenced block must add no declaration. Strictly better than the count, and a real positive control for the fence rule against the live bytes.

Both new escapes were latent, not live — contracts/CHANGELOG.md carries zero thematic breaks and zero backtick fence lines CommonMark would decline to open. Recorded as latent rather than banked as harmless.

Checks on 24be0ce9

check result run
pytest-suite pass, 20m59s 33677640913
merge-master-approval pass, 21s 33677639537
signed-execution-chain-gate pass, 1m0s 33677640903
wallet-validation pass, 22s 33677641034

Family file 73 → 76; tests/doc-health 1441 passed, 0 failed; live declaration re-verified through every tightened rule: entry: contract-v3.0, missing: ().

Running total: 3 findings, 3 taken, 1 sub-ask refused with a measurement. No thread is left undispositioned.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24be0ce996

ℹ️ 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".

Codex P1 — a hole round 1's own fix opened, and the third time on this guard
that a fix has been the next finding's cause. That fix excluded any line
MATCHING the underline pattern; in `## contract-v3.0` / `===` / `---` the `===`
matches while acting as nothing — no paragraph precedes it, so CommonMark makes
it paragraph text and the `---` below it a real Setext H2. Excluding it by
syntax lost the boundary and the entry stayed open. Measured: ACCEPTED.

The repair is structural rather than another exclusion. `_setext_content` is
gone; `_paragraph_line(line, closes, opaque)` takes the boundary decision the
caller already made, and the loop carries a boolean forward instead of the
previous line's text — so `_entry_boundary(line, after_paragraph, in_fence)`
cannot be handed a syntax question in place of a state one. An underline that
really underlined sets `closes` and ends the paragraph; one that only looked
like an underline does not. All five Setext-family shapes are now measured
together rather than one at a time, which is what the previous two rounds each
failed to do.

Copilot — the live-corpus anti-over-read guard was VACUOUS. It spliced at a byte
offset into the fence opener line, so the reserved opener landed after ```y and
was unreadable for a reason that had nothing to do with fences; the assertion
passed whatever the fence rule did. Spliced as a real line at the start of the
fenced content now, and the non-vacuity is itself asserted: the same line with
the fence opener removed MUST be read. That assertion is the one that would have
caught this, and it fails loudly for any future splice landing somewhere
unreadable.

Family file 76 -> 78; `tests/doc-health` 1441 -> 1443 passed, zero failures.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 2, 2026 20:45

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.

🔵 Needs a closer look

The changes alter subtle parsing and repo-surface behavior (containment/fence/Setext/floor gating) where a small regression could reintroduce silent acceptance paths, so final human review is warranted despite the strong test coverage.

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

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

Round 3 — both round-2 findings TAKEN, on head 0aa59945, all four checks green

Codex P1 (an underline-shaped line that underlined nothing) — TAKEN, and it was a hole ROUND 1'S OWN FIX OPENED. Measured: ## contract-v3.0 / === / --- / declaration gave entry='contract-v3.0' — ACCEPTED, contrary to FR-H07. No paragraph precedes the ===, so CommonMark makes it paragraph text and the --- below it a real Setext H2; round 1 excluded the === on syntax and lost the boundary.

That is the third time on this guard that a fix has been the next finding's cause (PR #584 saw it twice), so this round's repair is structural rather than another exclusion. _setext_content is gone. _paragraph_line(line, closes, opaque) takes the boundary decision the caller has already made, and the loop carries a boolean forward instead of the previous line's text — so _entry_boundary(line, after_paragraph, in_fence) cannot be handed a syntax question in place of a state one. The class of bug is now unrepresentable in the signature rather than merely absent from the body. An underline that really underlined sets closes and therefore ends the paragraph; one that only looked like an underline does not.

All five Setext-family shapes measured together, which is what the previous two rounds each failed to do:

shape after
=== / --- entry=None — the boundary is caught
Title / === / --- entry=None — closed by the first; the second is not a second heading
*** / --- entry='contract-v3.0' — both thematic breaks, correctly contained
blank / ----- entry='contract-v3.0' — thematic break
| a | b | / |---|---| entry='contract-v3.0' — a table rule is not an underline

Copilot (the live-corpus anti-over-read guard) — TAKEN, and the guard was VACUOUS. text[fence:fence+30] is '```yaml\n relocating:\n ', so fence + 4 spliced the reserved opener mid-line in the fence opener; it was unreadable for a reason that had nothing to do with fences and the assertion passed whatever the fence rule did. A test that cannot fail is worse than no test, and this one was guarding the fence rule against the live bytes. Spliced as a real line at the start of the fenced content now — and the non-vacuity is itself asserted: the identical line with the fence opener removed MUST be read. That assertion is the one that would have caught this, and it fails loudly for any future splice landing somewhere unreadable.

Checks on 0aa59945

check result run
pytest-suite pass, 18m22s 33681228683
merge-master-approval pass, 19s 33681227376
signed-execution-chain-gate pass, 1m6s 33681228696
wallet-validation pass, 26s 33681228717

Family file 76 → 78; tests/doc-health 1443 passed, 0 failed; live declaration re-verified through every rule: entry: contract-v3.0, missing: ().

Running total: 5 findings on the code, 5 taken, 1 sub-ask refused with a measurement. Codex 2 P1 + 1 P2; Copilot 2 inline. Every thread answered.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0aa5994512

ℹ️ 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".

Codex P1 — Python's `\s` matches U+00A0 and the other Unicode spaces, while
CommonMark's ATX opening sequence admits only a space, a tab or end of line. A
`##<U+00A0>contract-v3.0` line is paragraph text to every renderer and opened a
FICTITIOUS entry here; measured with a base entry of contract-v2.9 so that
"opened a fictitious entry" and "closed the real one" are distinguishable, a
declaration below it was ACCEPTED under a heading that does not exist. Fixed in
all three patterns and in both space classes of the entry heading — the
separator after `##`, and the one after the version token so a name followed by
U+00A0 is not read as a complete token.

THE REGRESSION TESTS AIM AT THE HOLE THIS FIX COULD OPEN, not only at the one it
closes. Narrowing `\s` invites narrowing it too far, so a TAB separator is a row
of its own and must still OPEN, and a tab-separated H1 must still CLOSE.

And one hole the fix opened in the TEST rather than the code, closed with it:
three rows turn on a literal U+00A0, which an editor or a formatter can
normalise to an ordinary space — after which they would pass for the wrong
reason, exercising a plain heading and proving nothing. Written against a named
NBSP constant now, because an escape cannot be normalised silently.

Latent, not live: the changelog carries zero ATX lines using non-space/tab
whitespace.

Family file 78 -> 83; `tests/doc-health` 1443 -> 1448 passed, zero failures.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 2, 2026 21:18

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 containment hardening is implemented coherently (single boundary function + explicit fence handling), comprehensively pinned by tests, and supported by measured evidence without introducing behavioral regressions in-scope.

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

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

Round 4 — Codex's round-3 P1 TAKEN, on head 8219cb3e, all four checks green

Codex P1 (\s is a Python fact, not CommonMark's) — TAKEN, and it is an escape rather than a style preference. MEASURED with a base entry of contract-v2.9, so "opened a fictitious entry" and "closed the real one" are distinguishable: ##<U+00A0>contract-v3.0 gave entry='contract-v3.0', i.e. ACCEPTED under a heading that does not exist — every renderer reads that line as paragraph text. Fixed in all three patterns and in both space classes of the entry heading: the separator after ##, because a Unicode space there means the line is no heading at all, and the one after the version token, so a name followed by U+00A0 is not read as a complete token. After: entry='contract-v2.9', the real containing entry, so the declaration is refused.

The regression tests aim at the hole THIS FIX could open, not only the one it closes. Three rounds on this guard have now each been the next round's cause, so narrowing \s gets its own controls: a TAB separator must still OPEN (##\tcontract-v3.0 → contract-v3.0) and a tab-separated H1 must still CLOSE. Five rows in all.

And one hole the fix opened in the TEST rather than the code, closed with it. Those rows turn on a literal U+00A0, which an editor, a formatter or a copy-paste normalises to an ordinary space — after which they pass for the wrong reason, exercising a plain ## contract-v3.0 heading and proving nothing. Written f"##{NBSP}…" against a named constant now, with the reason stated at it: an escape cannot be normalised silently.

Latent, not live: contracts/CHANGELOG.md carries zero ATX lines using non-space/tab whitespace.

Copilot's round-3 verdict is noted and is not a code finding. "Needs a closer look — a small regression could reintroduce silent acceptance paths" is exactly the right thing to say about this diff, and it is the reason every escape here carries a before/after measurement and every fix a positive control. The reader's own asymmetry is the answer to it: over-closing yields one error beside the superseded error, quieting nothing; under-closing is the silent path, and it is what all nine measured escapes were.

Checks on 8219cb3e

check result run
pytest-suite pass, 20m20s 33684435828
merge-master-approval pass, 20s 33684433967
signed-execution-chain-gate pass, 1m12s 33684435857
wallet-validation pass, 29s 33684435889

Family file 78 → 83; tests/doc-health 1448 passed, 0 failed; live declaration re-verified: entry: contract-v3.0, missing: ().

Running total: 6 findings on the code, 6 taken, 1 sub-ask refused with a measurement. Codex 3 P1 + 1 P2; Copilot 2 inline. Every thread answered.

All six of Codex's findings across this PR and its predecessor's late rounds have been on ONE guard — containment — and four of them on the fix for the last. The structural answer arrived in round 2 (the boundary decision is now carried as state, not re-derived from syntax); rounds 3 and 4 have been about the alphabet the patterns are written in rather than about the rule.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8219cb3e23

ℹ️ 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".

Codex P1 — round 1's class one layer down, in the line splitter rather than in
the opener pattern. `str.splitlines()` breaks on eight separators CommonMark
does not, so an INVALID backtick opener like ```bad<U+2028>`info — one line to
CommonMark, its info string carrying a backtick — reached the reader as a VALID
opener plus content. One fence out of phase again: the `## Notes` boundary
swallowed as code, the next bare fence closing the fictitious block while
opening a real one, and the declaration inside the real block read under the
earlier entry. Measured ACCEPTED for all eight of U+2028, U+2029, U+0085, VT,
FF, FS, GS and RS. Now split on `\r\n|\r|\n` and nothing else.

THE CONTROL IS AIMED AT THE HOLE THIS FIX OPENS, which on this guard is not
hypothetical: narrowing the splitter invites narrowing it to `\n` alone, and a
CRLF document would carry a stray `\r` at the end of every line — defeating the
fence closer's `[ \t]*$`, the ATX lookahead's `[ \t]|$` and the Setext
underline's anchor all at once and silently. LF, CRLF and lone CR are each
pinned in BOTH directions, because a splitter that broke only the reading half
would look correct from the accepting half.

`_lines` drops a single trailing empty element so a document ending in a newline
keeps the line count a human repairing a declaration would count. The eight
separators are named in a table rather than typed as literals, for the reason
NBSP was named in round 3; the test file now carries zero literal exotic
characters, checked.

Latent, not live: the changelog carries none of the eight.

Family file 83 -> 94; `tests/doc-health` 1448 -> 1459 passed, zero failures.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 2, 2026 22:01
@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.

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 small but user-visible/documented inconsistencies (a duplicated word in a Skip message and an incorrect ruling date in a key comment) that should be corrected before approval.

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

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 2
  • Review effort level: Lite

brettheap and others added 2 commits September 2, 2026 23:37
…ubled word in a user-facing skip

BOTH TAKEN, and both are exactly the class of finding a bot is better at than
the author of the diff.

THE RULING DATE — the raw-HTML block comment in the reader, and the matching
header in the test file, both carried 2026-09-02, which is the date of the
`declare-spent-bundle-state` ratification and of the SPENT declaration's own
`RULED BY` line, not of the variant-B ruling. The ruling is 2026-09-03. The
comment is the justification a future reader will find first — plan.md § D7,
evidence § L and the quickstart all say 2026-09-03, so this was the one place
the archaeology would have gone wrong.

THE DOUBLED "for" — this branch's own, not `main`'s. `main` reads *"a SPENT
declaration could not be looked for — which is not the same fact as there being
none"*; the batch-read repair added the bundles it declined to answer for and
produced *"could not be looked for for contract-v2.0"*. It is USER-FACING skip
text, so it reads as a typo rather than as a fact about a read. Rewritten to put
the bundles where the sentence already had a slot: *"so a SPENT declaration for
contract-v2.0 could not be looked for — which is not the same fact as there
being none"*. The two existing assertions on this message are on the parts that
carry meaning (the tip read, "not the same fact as there being none", and the
bundle name), so the rule is unchanged and still pinned.

`tests/doc-health` 1485 passed, zero failures; family file 120.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 3, 2026 03:39
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

Round 10 fixes — both of Copilot's findings TAKEN, on head 5012fb66

Batched into one commit, both dispositioned in their threads and both resolved.

(a) The ruling's DATE — TAKEN, and it was the one place the archaeology would have gone wrong. The raw-HTML block comment in the reader (and the matching header in the test file) carried 2026-09-02, which is the date of the declare-spent-bundle-state ratification and of the SPENT declaration's own RULED BY line — not of the variant-B ruling, which is 2026-09-03. plan.md § D7, evidence § L and the quickstart all said 2026-09-03; the comment a future reader reaches first was the sole dissenter.

(b) A doubled word in a user-facing SKIP — TAKEN, and it is this branch's own, not main's. main reads "a SPENT declaration could not be looked for — which is not the same fact as there being none"; the batch-read repair added the bundles the read declined to answer for and produced "could not be looked for for contract-v2.0". That reads as a typo rather than as a fact about a read, which is the opposite of what this skip exists to say. Rewritten into the slot the sentence already had:

contracts/CHANGELOG.md could not be read at the published tip <tip>, so a SPENT
declaration for contract-v2.0 could not be looked for — which is not the same
fact as there being none

Both assertions on that message are on the parts carrying meaning (the tip read, "not the same fact as there being none", and the bundle name), so the rule is unchanged and still pinned.

Gates on 5012fb66

gate result
pytest tests/doc-health -q 1485 passed, 0 failed, 7 warnings, 416.70s
pytest tests/doc-health/test_release_tag_publication.py -q 120 passed
pytest tests/sequenced_after -q 118 passed
scripts/validate-sequenced-after.py . passed — 33 active changes
openspec validate --all --strict 86 passed, 0 failed
proposal-support.py . verify declare-spent-bundle-state ok
verify-commit --commit HEAD 3 mismatches, byte-identical to origin/main's
doc-health.py --single-repo . finding list unchanged; live declaration still entry: contract-v3.0

main advanced again (#606, the add-project-repo-schema ratification) and was MERGED in, never rebased.

(An environment note worth recording, because it is the #338 guard doing its job: between two --single-repo runs main's published tip moved, and the family answered with a SKIP naming the read rather than a finding — contracts/manifest.yaml could not be read at the published tip ee294f9f7. git fetch origin and the output went back to byte-identical. Not fetched is not an answer, in either direction.)

Bot state on this head

Codex: NON-REVIEW. Its reply to the round-10 request, 03:08:52Z, was again "You have reached your Codex usage limits for code reviews." That is a provider non-review on 218b63a7, recorded as such, and it has now reviewed neither 256450f6 (the § K revert), nor e19bb2a4, nor 218b63a7, nor this head. Asking once more below; another usage-limit reply is another non-review and will be recorded that way rather than counted as a clean bill.

Copilot reviewed 218b63a7 (🟡 changes recommended, 2 comments, 19/19 files) — both taken above. No thread on this PR is unresolved: 20 dispositioned and resolved, including the eleven older ones that carried disposition replies but had never been marked resolved.

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

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

The new boundary logic uses str.strip() for “blank line” detection in _paragraph_line, which can treat Unicode whitespace (e.g., NBSP) as blank and reintroduce under-closing paths inconsistent with the module’s CommonMark-focused whitespace rules.

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

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

… str.strip()

`_paragraph_line` used `not line.strip()` to detect a blank line. `str.strip()` is
Python's and strips every Unicode space; CommonMark's blank line is "a line
containing no characters, or a line containing only spaces (U+0020) or tabs
(U+0009)". MEASURED: a line holding only U+00A0 (also U+2028, VT, FF) is
PARAGRAPH CONTENT to CommonMark, so a run of `=` below it is a Setext underline
that CLOSES the entry; read as blank, the underline was not recognized, the
entry never closed, and a declaration below it was ACCEPTED under an entry it
is outside of — an UNDER-CLOSING escape, the direction this guard exists to
close. New `_blank()` = `not line.strip(" \t")`; positive tests for U+00A0,
U+2028, VT, FF alone and inside a paragraph; control that spaces/tabs are still
blank. Evidence § M; quickstart block re-run.

Gates at this commit: family 128 passed; tests/doc-health 1493 passed;
sequenced_after 118 (33 active, no pin moved); openspec --all --strict 86/86;
proposal-support verify ok; live declaration reads entry contract-v3.0.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LAWoydPqwc9TxqDb8bWcWy
Copilot AI review requested due to automatic review settings September 3, 2026 04:42
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d (session openxfactory-42; the round-10 agent died on an auth error mid-fix — the orchestrator verified and landed its measured fix)

Round 11 — Copilot's round-10 finding TAKEN, on head c1b6eb3e

Copilot (_paragraph_line used str.strip() for blank-line detection) — TAKEN, and it was a real UNDER-CLOSING escape: CommonMark's blank line is spaces and tabs only; a line of U+00A0 / U+2028 / VT / FF is paragraph content, so the === below it is a Setext underline that closes the entry. Read as blank, the entry never closed and a declaration below it was ACCEPTED outside its entry. New _blank() restricts the test to " \\t"; positive tests for all four characters alone and inside a paragraph; control that spaces/tabs remain blank. Thread dispositioned and resolved. Evidence § M.

Gates at c1b6eb3e: family file 128 passed; tests/doc-health 1493 passed; sequenced_after 118, validator 33 active / no pin moved; openspec validate --all --strict 86/86; proposal-support verify ok; live declaration reads entry: contract-v3.0, no refusal. Branch level with main.

Codex remains OUT OF QUOTA (two consecutive usage-limit replies on rounds 10); its answer to this request is recorded as a non-review if it repeats. Under the owner's standing ruling ("merge the hardening PR when green", for lane openxfactory-1d's PR #589) this head merges when all five checks are green and Copilot has no unaddressed thread.

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

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.

🔵 Needs a closer look

The new raw-HTML opener detection uses \s in _HTML_ATTR, which can under-recognize openers involving Unicode whitespace (unsafe under the “refuse on raw HTML” policy) and should be corrected before merge.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

scripts/doc_health/release_tag_publication.py:372

  • _HTML_ATTR uses \s inside the unquoted-attribute-value token ([^\s...]). Elsewhere this hardening explicitly avoids \s because it treats Unicode whitespace (e.g., NBSP) as whitespace, which can cause under-recognition of a raw-HTML opener line containing NBSP in an attribute value and let the reader continue past raw HTML (the unsafe direction under variant B). Use the same explicit whitespace class you use elsewhere ([ \t\v\f]) so NBSP is not treated as whitespace here.
    tests/doc-health/test_release_tag_publication.py:1118
  • This test builds a line-indexed splice against the live changelog, but it uses text.splitlines(), while the production parser uses the custom _lines() splitter to match CommonMark line-ending semantics. If the live changelog ever contains a separator that splitlines() treats as a line ending (but _lines() does not), this splice can drift and risk becoming non-vacuous for the wrong reason again. Use rtp._lines(text) to keep the test’s splicing logic aligned with the parser.
  • Files reviewed: 19/19 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

openRepoShape CI and others added 2 commits September 3, 2026 01:18
…'s whitespace class, and the splice test uses the parser's line splitter

The kind-7 unquoted attribute-value token in `_HTML_ATTR` was still
`[^\s"'=<>` `]+`, Python's whitespace class, even though every other
whitespace slot in the same pattern (the separator before an attribute
name, and around `=`) had already been narrowed to CommonMark's
`[ \t\v\f]` in an earlier round, and the comment above the pattern
already claimed that class for the whole thing. Measured on head
`c1b6eb3e` with a kind-7-only tag name (`div` is a kind-6 tag and
matches on the name alone regardless, so it cannot exercise this):

  before: _HTML_OPENER.match('<mytag class=a\xa0b>') -> None
  after:  _HTML_OPENER.match('<mytag class=a\xa0b>') -> a Match

Direction, stated honestly against Copilot's "unsafe direction" framing:
a missed opener does not make the reader ACCEPT anything. It just keeps
reading the lines that follow as ordinary prose instead of stopping;
if one of those lines is heading-shaped, the reader closes an entry on
it the way it would for any other heading-shaped line, which can only
move a real declaration OUT of the entry it belongs in — an over-closed
FALSE REFUSAL, never an accept. So this is a consistency defect against
the module's own stated whitespace rule, not a containment escape, and
it is fixed for that reason regardless of which direction it fails in.

Also switched the live-changelog splice test off `text.splitlines()`
(which breaks on the same eight separators round 4 removed from the
parser's own `_lines`) onto `rtp._lines(text)`, so the splice lands on
a line boundary the parser actually recognizes.

Added one parametrized test (7 cases) pinning the fixed token class:
U+00A0 and U+2028 stay inside an unquoted value (kind-7 opener,
recognized); a plain letter run is the control; a real space, tab, VT
or FF splits the token, and a bare digit right after the split can
never open a new attribute name, so the opener is refused.

Gates: family file 135 passed (128 -> 135), tests/doc-health 1500
passed 0 failed (1493 -> 1500), tests/sequenced_after 118 passed.
Catch-up merge of origin/main (3c237cd, update-standards-body-current-
publications) included; family file re-run clean after the merge.

Lane: openxfactory-1d
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LAWoydPqwc9TxqDb8bWcWy
Copilot AI review requested due to automatic review settings September 3, 2026 05:20
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d

Round 12 — both of Copilot's suppressed comments TAKEN, on head bcd94940

1. The kind-7 unquoted attribute-value token was still Python's \s. In
_HTML_ATTR, the separator before an attribute name and the whitespace
around = were already narrowed to CommonMark's [ \t\v\f] in an earlier
round; the value token alone was still [^\s"'=<>]+. The comment immediately above the pattern already claimed the narrower class for the whole thing — the code just hadn't caught up. Fixed to [^ \t\v\f"'=<>]+.

2. The live-changelog splice test used text.splitlines(). That method
breaks on the same eight separators round 4 removed from the parser's own
_lines (CommonMark line endings only: CR, LF, CRLF). A splice built with
splitlines() could land at a line boundary _lines does not recognize,
testing a document the parser never actually sees. Switched to
rtp._lines(text) — confirmed it exists (release_tag_publication.py:523,
"The document's lines, split on CommonMark's line endings and no others") —
with no other change to the test's behaviour.

Measurement, before fixing, using a kind-7-only tag name (div is a
kind-6 tag and matches on the name alone regardless of the attribute value,
so it can't exercise this fix at all):

before: _HTML_OPENER.match('<mytag class=a\xa0b>')  ->  None
after:  _HTML_OPENER.match('<mytag class=a\xa0b>')  ->  a Match

The control <mytag class=a b> (a real space) matches on both sides,
unaffected. The live contracts/CHANGELOG.md still reads raw_html=None
after the fix.

Direction correction. The review comment called this "the unsafe
direction." Measured, it's the opposite. A missed kind-7 opener does not make
the reader ACCEPT anything — read_changelog never stops at it and just
keeps reading the following lines as ordinary prose. If one of those lines
(content that should have stayed opaque inside the raw HTML block) is
heading-shaped, the reader closes an entry on it the way it would for any
other heading-shaped line — which can only move a real declaration OUT of
the entry it belongs in: an over-closed false refusal, never an accept.
So this is a consistency defect against the module's own stated whitespace
rule, not a containment escape — and it's fixed for that reason regardless of
which direction it happens to fail in.

Added: one parametrized test (7 cases) beside the existing opener-table
tests — U+00A0 and U+2028 stay inside an unquoted value (kind-7 opener,
recognized), a plain letter run as control (recognized), and a real space,
tab, VT or FF split the token (a bare digit right after the split can never
open a new attribute name, so the opener is refused).

Gates: family file tests/doc-health/test_release_tag_publication.py
135 passed (128 → 135); tests/doc-health 1500 passed, 0 failed
(1493 → 1500, the same +7); tests/sequenced_after 118 passed.

Catch-up merge of main included (3c237cd0,
update-standards-body-current-publications) — clean merge, no conflicts,
family file re-run clean afterward.

Evidence appended: specs/027-spent-bundle-state/evidence/hardening-red-first.md
§ N.

@codex review (Codex has answered every round-10/11 request with a usage-limit message; a repeat is recorded as a non-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.

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.

🔵 Needs a closer look

It makes substantial, security-adjacent parsing/containment changes in a core doc-health guard (including new raw-HTML refusal behavior) that merits final human review despite strong tests/evidence.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d (session openxfactory-42)

MERGING — RULING for lane openxfactory-1d's PR #589, Brett Heap, 2026-09-02 ~19:10Z in session: "merge the hardening PR when green"; scope ruled 2026-09-03 ~02:3xZ: "b" (fail closed on raw HTML).

Head bcd94940. All five required/attached checks PASS: pytest-suite run 33718430153 (17m18s), signed-execution-chain-gate 33718430197, wallet-validation 33718430234, openreposhape-pin 33718430336, merge-master-approval 33718428912. --admin satisfies only the review-count rule; no check is bypassed.

Bots at the final head: Copilot reviewed bcd94940 ("needs a closer look", 1 comment — the Skip-message length, REFUSED with a measurement in-thread and resolved); 0 unresolved threads. Codex: NON-REVIEW — every request since round 10 answered with a usage-limit message, recorded as such, never as a pass.

What lands (12 rounds): the SPENT-state containment guard hardened — every structural boundary closes an entry (ATX H1/H2 with CommonMark whitespace, complete bundle token, Setext, empty ATX, indented ATX), fences the only opaque region with correct phase, raw HTML REFUSED rather than parsed (variant B), CommonMark line endings and blank lines (spaces/tabs only), floor gating and orphan sweep aligned, Skip message names both members; family tests 46 → 135, tests/doc-health 1500 green; Speckit specs/027-spent-bundle-state/ with evidence §§ A–N incl. the differential-oracle finding (round 6's bot-endorsed matching-closer rule was a spec error and an escape; reverted, then made moot by B). 21 bot findings: 18 taken, 3 refused with measurements. Re-scopes #584 (closed with pointer).

@brettheap
brettheap merged commit 6da1e1f into main Sep 3, 2026
6 checks passed
brettheap pushed a commit that referenced this pull request Sep 3, 2026
…ME rows kept both sides; the corpus pin re-derived on the merged tree

`main` moved three merges past this branch's base `642ac147` while PR #608 sat
awaiting the convener's merge word — #606 (ratify add-project-repo-schema),
#593 (adopt update-standards-body-current-publications as an ACTIVE draft
change, a new change directory), #589 (SPENT-state containment hardening) — and
GitHub could no longer build the test-merge commit. Force-pushing is forbidden
here, so this is a CATCH-UP MERGE and not a second rebase.

TWO FILES CONFLICTED AND EACH IS RESOLVED BY KEEPING WHAT BOTH SIDES SAID.

`README.md` — BOTH SIDES' "OpenSpec Records" entries are kept, none duplicated
and no marker left behind: main's rewritten `add-project-repo-schema` row (now
`Status: ratified`, still ACTIVE until its bundle is cut) and its new
`update-standards-body-current-publications` row stand exactly as main wrote
them; this branch's rewritten `create-medxchart-overlay-boundary` row stands
exactly as this branch wrote it; and main's `docs/project-repo-schema.md`
lifecycle line is untouched. The two sides never wrote the same row, so the
merged file is the union and the diff against `origin/main` is this branch's
one row and nothing else.

`tests/sequenced_after/test_sweep.py` — MAIN'S PIN BLOCK AND MOVEMENT LOG ARE
THE BASE, and the pin is then RE-DERIVED ON THE MERGED TREE rather than netted
out of the two branches' arithmetic. Main's two new log entries (#593's adoption
and its own catch-up merge with #606) are kept verbatim; this branch's entry is
kept as the chronologically last one, rewritten to the merged-tree readings and
carrying the same substance it always had — that RATIFYING an already-active
change is a THIRD cause of this test's failure, distinct from the authoring
cause and the archiving cause the assertion messages name, and the only shape in
which the co-modified set rises by ONE while the sole set FALLS, because the
change entering one is the change leaving the other. No entry is carried twice.

MEASURED, VIA `python3 scripts/validate-sequenced-after.py . --sweep`:

  merged tree                       34 active + 124 archived = 158 change ids,
                                    109 co-modified, 49 sole modifiers,
                                    22 / 12 active co-modified/sole
  merged tree, with only
  .../create-medxchart-overlay-boundary/specs/domain-descendant-boundary/
  moved aside                       158, 108, 50, 21 / 13
  origin/main at 6da1e1f           158, 108, 50, 21 / 13

The exclusion reproduces main's own reading EXACTLY, and main's own tree
confirms that reading independently, so this branch's single `## MODIFIED
Requirements` delta over `domain-descendant-boundary` is the whole of the
difference between the two trees: +1 `co_modified`, +1 `active_co_modified`,
-1 `sole_modifiers`, -1 `active_sole`, and `change_ids` and `active` not at all.
No third change moved in the window; #589 touches no `openspec/changes/**/specs/`
delta and #606 ratifies a change already counted, so of the three merges only
#593 moved main's pin.

The five pinned values become, all measured and none inferred:

  sweep.co_modified          == 109   (was 109 on this branch, 108 on main)
  sweep.active_co_modified   == 22    (was 22 on this branch, 21 on main)
  sweep.change_ids - 1       == 157   (main's; this ratification holds it)
  sweep.sole_modifiers - 1   == 48    (was 47 on this branch, 49 on main)
  sweep.active_sole - 1      == 11    (was 10 on this branch, 12 on main)

The pin moves in the SAME COMMIT as the corpus, which is that test's own
protocol.

VALIDATION ON THE MERGED TREE:

  openspec validate create-medxchart-overlay-boundary --strict   valid
  openspec validate --all --strict                               87 passed,
                                                                 0 failed
                                                                 (87 items)
  python3 -m pytest tests/sequenced_after -q                     118 passed
  scripts/doc-health.py --single-repo .                          6 critical,
                                                                 6 error,
                                                                 29 warning,
                                                                 14 info,
                                                                 0 new
                                                                 regressions

The doc-health report is BYTE-IDENTICAL to the same run on `origin/main` at
`6da1e1f5` once the checkout directory name is normalised, and zero findings
name this change. The `--all --strict` total moved 86 → 87 because #593 added
one ACTIVE change; this packet adds none.

The two `review/` records still state the pre-merge readings and are corrected
in the commit that follows this one, before capture — capture is the merge of
PR #608, which has not merged.

Lane: openxfactory-max001

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012RQo21NbWtnTVsb6JU67at
brettheap pushed a commit that referenced this pull request Sep 3, 2026
… a second time pre-capture after main moved (#606, #593, #589)

CAPTURE IS MERGE, AND NOTHING IS MERGED. `record-immutability` forbids editing a
`Status: record` document AFTER capture; capture is the merge of the pull
request that establishes it, and PR #608 has not merged. These two records have
therefore never been captured, and correcting them on the branch is lawful. No
capture happened before this merge and none is claimed.

WHAT MOVED, AND WHY. `main` moved three merges past this branch's base
`642ac147` — #606 (ratify add-project-repo-schema), #593 (adopt
update-standards-body-current-publications as an ACTIVE draft change), #589
(SPENT-state containment hardening) — and this branch took the catch-up merge at
`6da1e1f5` in the commit directly below. The race the verification record itself
measured and named on 2026-09-03 duly ran, and #593 was the pull request that
won it. Of the three, only #593 moves the live corpus pin.

COUNTS MOVED, AND ONLY COUNTS:

  openspec validate --all --strict        86/86 -> 87/87
                                          (#593 added one ACTIVE change; this
                                          packet adds none, ratifying a change
                                          that was already active and already
                                          counted)

  this branch's own sweep                 157 / 109 / 48 / 22 / 11
                                          -> 158 / 109 / 49 / 22 / 12
                                          (change ids / co-modified / sole
                                          modifiers / active co-modified /
                                          active sole)

  measured-by-exclusion baseline,         157 / 108 / 49 / 21 / 12
  which is main's own reading             -> 158 / 108 / 50 / 21 / 13

so this packet's contribution, restated from main's new baseline, reads
`co_modified` 108 -> 109, `active_co_modified` 21 -> 22, `sole_modifiers`
50 -> 49 and `active_sole` 13 -> 12 — the same +1 / +1 / -1 / -1 shape it always
had, with `change_ids` and `active` still moving not at all.

MEASURED BY EXCLUSION, NOT INFERRED. The baseline above was proved by moving
`openspec/changes/create-medxchart-overlay-boundary/specs/domain-descendant-boundary/`
aside on the merged tree and re-running
`python3 scripts/validate-sequenced-after.py . --sweep`, and independently
confirmed by running the same sweep on `origin/main` at `6da1e1f5` itself, which
prints the same 158 / 108 / 50 / 21 / 13.

NOTHING ELSE IN THE RECORDS CHANGED. Beyond those counts and the `Captured:`
header naming the second tree it was re-derived on, no governance statement, no
evidence block, no console output, no finding and no citation moved. The
ratification act, its date, its ruler and its quoted words are untouched.

VALIDATION ON THE MERGED TREE, RE-RUN AFTER THESE EDITS:

  openspec validate create-medxchart-overlay-boundary --strict   valid
  openspec validate --all --strict                               87 passed,
                                                                 0 failed
                                                                 (87 items)
  python3 -m pytest tests/sequenced_after -q                     118 passed
  scripts/doc-health.py --single-repo .                          6 critical,
                                                                 6 error,
                                                                 29 warning,
                                                                 14 info,
                                                                 0 new
                                                                 regressions,
                                                                 byte-identical
                                                                 to origin/main

Lane: openxfactory-max001

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012RQo21NbWtnTVsb6JU67at
brettheap added a commit that referenced this pull request Sep 3, 2026
…e follows the HARDENED reader, and the pin is re-derived rather than adjusted

PR #611 was authored 2026-09-03T03:55Z by a sibling session that then ended,
against the `main` of 2026-09-02 (`ee294f9f`). Two commits landed on `main`
before it could merge and it went CONFLICTING; lane openxfactory-1d adopted it
on the owner's word and fixes it forward here. Nothing about the archive act is
redone: the promotion, the README move and the `docs/doc-health.md` retarget are
#611's and stand.

## What landed on `main` in between, and why each one matters here

- PR #593 (`3c237cd0`) ADOPTED `update-standards-body-current-publications` as
  an ACTIVE change and re-baselined three `sequenced_after` pins.
- PR #589 (`6da1e1f5`) HARDENED the SPENT containment guard on top of the
  realization #587 landed, and recorded that hardening under this packet's
  § 2.3 without re-ticking anything.

## Conflict resolutions, each taken deliberately

`openspec/changes/declare-spent-bundle-state/tasks.md` — a delete/modify shape
that git's rename detection resolved into the archived copy, and the result was
CHECKED rather than trusted: the archived
`openspec/changes/archive/2026-09-03-declare-spent-bundle-state/tasks.md` now
carries `main`'s POST-#589 file, § 2.3's thirteen-line hardening note included,
with #611's group-5 ticks re-applied over it.

`tests/sequenced_after/test_sweep.py` — the MOVEMENT LOG conflicted: #611's
entry against #593's two. #611's entry is REPLACED rather than kept beside them,
because the two contradict on the active/archived split, and the replacement
says so in terms. Every pin was RE-MEASURED on both trees with
`python3 scripts/validate-sequenced-after.py . --sweep` rather than adjusted by
arithmetic: `origin/main` at `6da1e1f5` reads `34 active + 124 archived` = 158
change ids, `108` co-modified, `50` sole modifiers, `21 / 13` active
co-modified/sole; this merge reads `33 active + 125 archived` = 158, `108`,
`50`, `20 / 13`. EXACTLY ONE PIN MOVES — `active_co_modified` 21 -> 20 — and
`main`'s own reading is the by-exclusion control, this archive being the only
difference between the two trees. #611's "32 active + 125 archived = 157" prose
was arithmetically stale, not wrong in its reasoning: both addends were one
lower than the corpus now carries, and the TOTAL-unchanged invariant it was
making survives the correction.

`README.md` and `docs/doc-health.md` — both auto-merged and both verified:
#593's new ACTIVE row for `update-standards-body-current-publications` is kept
AND `declare-spent-bundle-state` moves from Active to Archived the way #571 did;
`docs/doc-health.md` carries BOTH sides — #589's two new containment paragraphs
and #611's retarget of the one stale link to the archived path — with the family
count sentences untouched.

## Task 3.1's tick is REVERTED, and that is the one substantive change here

#611 ticked 3.1 on the reading that the DECISION the box posed was made. What
the box names is the PARAGRAPH in `docs/contract-versioning-policy.md`, which is
deliberately owed to the next contract cut under the owner's 2026-09-02 ruling
to CARRY #577's drift. It is un-ticked, #611's note is kept in full, and one
dated sentence records the revert and its reason. The box travels OPEN into the
archived packet the way 3.2 does. Group 5's ticks stand and gain the #589
evidence: run `33719770363` (`success`) on `main` at `6da1e1f5`, the Speckit
feature `specs/027-spent-bundle-state/`, and the family file at 46 -> 135 tests.

## § 5.2 re-verified on the post-#589 tree rather than carried forward

The archived delta's `### Requirement: Release-tag publication` block and the
promoted requirement in `openspec/specs/doc-health/spec.md` were extracted from
the MERGED tree and diffed: ZERO lines of difference, 392 lines, 24 scenarios.
Against `main`'s pre-promotion requirement (129 lines, 11 scenarios): 263 lines
added, ZERO REMOVED, and the canon file's whole-file diff is `263
insertions(+), 0 deletions(-)` over 43 requirements on both sides. #589 touches
`scripts/doc_health/`, `tests/doc-health/` and `docs/doc-health.md` and NOT the
canon spec, so the block could not have moved — checked anyway.

## Gates, on the merged tree

`OPENSPEC_TELEMETRY=0 openspec validate --all --strict`: 86 passed, 0 failed —
one fewer than `origin/main`'s 87, which is the archived change leaving the
active corpus. `python3 scripts/validate-sequenced-after.py .`: passed (33
active, 1 declaring). `pytest tests/sequenced_after`: 118 passed.
`pytest tests/doc-health -p no:cacheprovider`: 1500 passed, 0 failed.
`pytest tests/doc-health/test_release_tag_publication.py`: 135 passed (46 at
#587's `3fa222f3`). doc-health `--single-repo` before and after: 55 findings on
both, 6 critical / 6 error / 29 warning / 14 info on both, and the two finding
lists BYTE-IDENTICAL once the repo-identity string is normalized. No
`health/dispositions.yaml` row is owed and no carriage-ledger or
`modified-block-currency` test names this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants