Repository navigation
Harden the SPENT-state containment guard: every structural boundary closes an entry, fences are opaque, and the floor holds - #589
Conversation
…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]>
There was a problem hiding this comment.
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]>
There was a problem hiding this comment.
🟡 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.
|
Lane: openxfactory-1d All four checks GREEN on
|
| 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)inscripts/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_floorare 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
There was a problem hiding this comment.
💡 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]>
There was a problem hiding this comment.
🟡 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
|
Lane: openxfactory-1d Round 2 — both Codex round-1 findings and Copilot's TAKEN, on head
|
| 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
There was a problem hiding this comment.
💡 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]>
There was a problem hiding this comment.
🔵 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
|
Lane: openxfactory-1d Round 3 — both round-2 findings TAKEN, on head
|
| 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
There was a problem hiding this comment.
💡 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]>
There was a problem hiding this comment.
🟢 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
|
Lane: openxfactory-1d Round 4 — Codex's round-3 P1 TAKEN, on head
|
| 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
There was a problem hiding this comment.
💡 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]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟡 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
…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]>
Lane: openxfactory-1d
|
Lane: openxfactory-1d Round 10 fixes — both of Copilot's findings TAKEN, on head
|
| 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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟡 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
|
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
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🔵 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_ATTRuses\sinside the unquoted-attribute-value token ([^\s...]). Elsewhere this hardening explicitly avoids\sbecause 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 thatsplitlines()treats as a line ending (but_lines()does not), this splice can drift and risk becoming non-vacuous for the wrong reason again. Usertp._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
…'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
|
Lane: openxfactory-1d Round 12 — both of Copilot's suppressed comments TAKEN, on head
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🔵 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
|
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 Bots at the final head: Copilot reviewed 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 |
…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
… 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
…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
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, whichmaindoes 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-stateaccepts 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
errorthis family exists to raise is replaced by aninfo. Seven of the ten escapes below are that class.The escapes, each measured against
main's code before a line was writtenProbed through
main's ownparse_spent_declarations/check_repo, not inferred from the finding text. Full transcripts:evidence/hardening-red-first.md.main## Deprecationsdoes not close the entryentry=contract-v3.0— wrongly ACCEPTEDentry=None— refused## contract-v3.0.1/## contract-v3.0-notesopencontract-v3.0's entry (\bis not a complete-token test)entry=None;## contract-v3.01still opens its own, being a real name#heading does not close the entry###+ still does NOT close, which is load-bearingmain: "NO FENCE TRACKING, deliberately")contracts/CHANGELOG.mdalready carries a fence===/---) do not close##alone) is not a boundarycontracts/CHANGELOG.mdis SKIPPED entirely (the guard sat aboveparse_bundle)[]— answered as it always was; the guard is gated on in-scope-nessSkipnames only the manifest though both were readwarningTen 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 —mainphrases 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_stateand_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
startswithlooks 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
maingreen. So the live read is a test: it readscontracts/CHANGELOG.mdfrom disk, pinsentry == 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 separatespent_refusal; porting that would have rewritten a module that landed hours earlier and made the repair unreviewable inside it.Tests
tests/doc-healthorigin/main47f90080+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 answersls_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
mainand 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
de4f96a7pytest tests/doc-healthpytest tests/sequenced_aftervalidate-sequenced-after.py .openspec validate --all --strictproposal-support verify declare-spent-bundle-stateverify-commit --commit HEADcontracts/CHANGELOG.mdanddocs/contract-versioning-policy.md— byte-identical to the same command atorigin/main, therefore inherited. This branch edits no inventory member--single-repo, base vs head, same--as-of6 critical, 5 error, 29 warning, 14 info). Whole report diff is 20 lines: canon share 34.3% → 34.4% and thestandardstage's words 14482 → 14675, from the one paragraph added todocs/doc-health.md. No new finding, none removedThe live-corpus read that matters most is the ACCEPTED
infoitself, unchanged oncontracts/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 inopenspec/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.mdgains one paragraph saying what "inside the entry" means; family counts are untouched. The027-spent-bundle-statebranch 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, andevidence/test-counts.mdcarries a correction against itself — #584's family count was 66, not the 69 it published.