Repository navigation
cited_to byte reader binds citations to their disposition blocks and applies the production unquoting rule (#851) - #863
Conversation
…block and unquotes it like the production reader (#851) Two P2 findings Codex posted on PR #842's frozen head 5ab762c, deferred to #851 because neither bites on the live pin today, and neither does now. BINDING, NOT EQUAL TOTALS. `citation_lines_in` matched a `cited_to:` key line ANYWHERE in the pin's bytes and stopped a list at the first line that was not an item, with equal GLOBAL counts as its proof of alignment. So a `cited_to:`/`- …` pair quoted inside a folded `why: >-` was admitted as structure while a `#` comment between two real items ENDED the real list — and the two errors cancel: the counts agree, `zip` pairs the wrong lines, a dangling citation after the comment is never opened, and the run exits 0. `citation_lines_by_entry` replaces it: a block scalar's body is skipped whole, a comment or a blank line inside a list is the non-member YAML says it is, the walk stays inside `dispositions:` and counts its entries, and every line comes back BOUND to the entry whose block carries it. `check_citations` compares the SEQUENCE OF ENTRY NUMBERS the two readers produce, so a per-entry disagreement that cancels in the total refuses the field with its own finding instead of classifying anything. `citation_lines_in` survives as the unbound view, for a caller that needs only the text. THE PRODUCTION UNQUOTING RULE. `scripts/validate-openspec-cli-pin.py` passes every `^ - (\S.*)$` item through `_unquote`, so a QUOTED citation scalar carries no quotes in the text the pin's own verifier prints and compares. This reader kept them — which would have made the repair the arm NAMES for a successor (quoting the ` #` and `: ` scalars) leave a permanent divergence WARN behind instead of clearing it. The rule is restated here rather than imported, that file being hyphenated and unimportable, on the same discipline `OWN_REPOSITORY_SPELLINGS` is held to, and a test pins the two equal. AND A FAILING ROW IS NEVER LABELLED OK (Copilot, same PR): the branch for a pin naming no `consumer_entrypoint:` returns the citation arm's verdict, so its line now reads MEASURED where that verdict is False. Eight tests, every one of them RED on the arm as it stood: the bench's decoy + comment case end to end (the decoy names a path that EXISTS, so the old arm exits 0 on it), the same fixture's binding asserted line by line, the three walk rules stated directly, equal totals falling in different entries, a quoted scalar no longer diverging, the unquoting applied to the line, parity with the production `_unquote`, and the OK/MEASURED label. The live pin's verdict is byte-for-byte what it was: exit 0, 21 citations, 7 measured divergences. Refs #842, #840. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…sing clause restored
Neither changes behaviour; both are prose a reader relies on.
`scripts/proposal-support.py` — `OriginRetentionError`'s docstring broke mid
sentence ("… could not be read. What / they share is …"), so the paragraph reads
as a truncated clause. Rejoined and rewrapped, no word changed.
`scripts/doc_health/modified_block_currency.py` — the module summary of
marker-defect GROUND TWO stated the quoted-span predicate without the half that
keeps a correct marker quiet. `suppression()` skips a span the marker ALSO NAMES
("a span the marker also names is a repeat, not a defect"), and the summary said
only that the span matches a promoted unit the block leaves out — so a reader of
the summary alone would expect a finding on a marker that declares the unit
properly and quotes it again in its reason. The clause is restored.
Refs #846, #850.
Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Lane: openxfactory-1 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 ✨
|
Lane: openxfactory-1 (openXfactory-1) @codex review |
There was a problem hiding this comment.
🟡 Changes recommended
The new block-scalar opener regex is narrower than its own stated intent, which can let some block scalar bodies be scanned as structure and reintroduce the decoy class of misbinding.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens the pin-registration citation checker by making the cited_to: byte reader structural (binding each citation line to its dispositions[] entry), applying the production unquoting rule before comparison/classification, and correcting an output label so failing rows are not printed as OK.
Changes:
- Replace global
cited_to:line scanning with a structural walk that skips block scalar bodies, ignores comments/blank lines inside lists, and binds lines to disposition entries. - Apply the production reader’s
_unquotebehavior to citation lines and add parity tests againstvalidate-openspec-cli-pin.py. - Fix the “OK” label emitted for rows without
consumer_entrypoint:so it reflects the citation-arm verdict.
File summaries
| File | Description |
|---|---|
| tests/pin_registrations/test_pin_registration_sweep.py | Adds regression and parity tests covering structural binding, cancellation cases, unquoting, and corrected row labeling. |
| scripts/validate-pin-registrations.py | Implements citation_lines_by_entry, restates/applies _unquote, tightens alignment to per-entry binding, and updates output labeling. |
| scripts/proposal-support.py | Rewraps OriginRetentionError docstring to remove a broken mid-sentence line break. |
| scripts/doc_health/modified_block_currency.py | Repairs the module summary for marker-defect ground two to reflect the “marker also names the span” suppression rule. |
Review details
- Files reviewed: 4/4 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.
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…e house's (#863 bench) Copilot on PR #863: `_BLOCK_SCALAR_KEY` took an identifier-shaped key (`[A-Za-z_][A-Za-z0-9_]*`), which is this corpus's house style and not YAML's. A hyphenated `INV-2: >-` or a quoted `"a: b": >-` opens a folded scalar just as well, and its body would have been walked as STRUCTURE — the decoy class this change exists to close, reintroduced through the key spelling. The key is now any plain scalar up to the `: ` separator or a quoted one, every chomping/indent indicator is admitted in either order, and a trailing comment on the header line is admitted because YAML admits it. ONE BOUNDARY IS DELIBERATE and is stated where the pattern is: a KEYLESS block scalar (`- >-` as a whole sequence entry) is not matched, because a line of that shape inside an open `cited_to:` list is a CITATION under the pin's own production and must be read as one. Such an entry cannot hide a decoy either — it is not a mapping, so it contributes no parsed citation while its body's lines bind to its entry index, and the per-entry comparison refuses the field. Copilot's second half — `key:>-` with no space — is not taken: without a space after the colon YAML reads the whole thing as a plain scalar, so there is no block scalar there to skip. `test_a_block_scalar_is_recognised_by_yamls_key_spellings_not_one_houses` pins the table in both directions and the hyphenated decoy end to end. 60 passed; the live pin's verdict is still byte-for-byte unchanged. Refs #842. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
_BLOCK_SCALAR_KEY still fails to recognise some YAML-legal quoted key spellings (embedded quotes), which can prevent block-scalar bodies from being skipped and risks reintroducing the decoy-as-structure class of bug.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
|
Lane: openxfactory-1 (openXfactory-1) Head has advanced since your last round ( @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aef53f797c
ℹ️ 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".
…here YAML ends it (#863 bench) Codex on PR #863, and it is the correct half of the thread Copilot opened. The previous cut spelled the key as "anything up to a colon", and that is not the separator YAML uses: a key ends at a colon FOLLOWED BY WHITESPACE, so `a:b: >-` is one key carrying an internal colon and `"a\"b: c": >-` is one quoted key carrying both. Neither was recognised as an opener, so a folded body under either would have been walked as STRUCTURE — the decoy class this reader exists to close, reached through the key spelling for the second time. The key is now read NON-GREEDILY up to the first `: ` that is followed by a block-scalar header, which is exactly where YAML ends it, and the quoted alternatives are gone because they were only ever a partial spelling of the same rule. The refusals are unchanged and asserted: `- >-` inside an open list is a CITATION under the pin's own production, `finding: 'x: y'` is a plain scalar, and a citation whose gloss ends in `>` is not an opener. `test_a_block_scalar_is_recognised_by_yamls_key_spellings_not_one_houses` carries the three new spellings, two new refusals, and the hyphenated decoy re-run under `a:b:`. 60 passed; the live pin's verdict is still byte-for-byte unchanged. Refs #842. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openxfactory-1 (openXfactory-1) Head frozen at @codex review |
There was a problem hiding this comment.
🟢 Approval recommended
The behavioral changes are narrowly scoped, thoroughly regression-tested (including production parity for unquoting), and the updated alignment/refusal logic eliminates the previously silent misclassification path.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Lane: openxfactory-1 (openXfactory-1) FROZEN + LANDING PROVENANCE — 2026-09-09T21:22:44Z. Head |
Lane: openxfactory-1 (openXfactory-1)
The two Codex P2 findings recorded on issue #851, plus Copilot's log-label nit
from the same bench, and the two owed docstring repairs Brett's "do 1, then 2"
queued behind #862.
1. The
cited_to:byte reader binds each line to its disposition blockFinding (Codex, #842 review thread on
scripts/validate-pin-registrations.py~L285).
citation_lines_inmatched acited_to:key line ANYWHERE in the pin'sbytes — a folded
why: >-that quotes the field's own grammar included — andstopped a list at the first line that was not an item, so a
#comment betweentwo real items ENDED the real list. Equal GLOBAL counts were the alignment proof
(
scripts/validate-pin-registrations.py:540,len(lines) != len(parsed)→ FAIL,then
zip(parsed, lines)), and the two errors CANCEL: the counts agree,zippairs the wrong lines, and a dangling citation after the comment is never
classified while the run exits 0 — this arm's own silence, in the shape it exists
to end.
What changed.
citation_lines_by_entry(
scripts/validate-pin-registrations.py:250) replaces it with a structural walk:past the key's own column), so nothing written inside a disposition's prose is
ever read as the pin's structure;
is what neither is in YAML either;
dispositions:and counts its entries, so every linecomes back BOUND to the entry whose block carries it.
check_citationsnow compares the SEQUENCE OF ENTRY NUMBERS the two readersproduce, not two totals: a per-entry disagreement that cancels in the total
refuses the field with its own finding (
… do not fall in the samedispositions[]entries (bytes 1x2, structure 1x1, 2x1) …) instead ofclassifying anything. The count-mismatch finding and its wording are unchanged.
citation_lines_insurvives as the unbound view for a caller that needs only thetext. The production grammar is untouched —
^ - (\S.*)$, the line IS thecitation — and
citation_lines_by_entry's docstring carries the originalreasoning with the three new rules stated beside it.
2. The production unquoting rule, applied to the line
Finding (Codex, #842 ~L297).
scripts/validate-openspec-cli-pin.pypassesevery
_SEQ_MAP_LIST_ITEMthrough_unquote(:449,:464), so a QUOTEDcitation scalar carries no quotes in the text the pin's own verifier prints and
compares. This byte reader returned them — so the repair the arm NAMES for a
successor (quoting the live
#/:scalars, the ambiguity it measures) wouldhave left a permanent divergence WARN behind instead of clearing it. A repair
that cannot clear the warning it was made for is not a repair.
What changed.
_unquoteis restated inscripts/validate-pin-registrations.py:250and applied to every citation linebefore comparison and classification. Restated rather than imported —
validate-openspec-cli-pin.pyis hyphenated and unimportable, and this checker isa standalone script — on exactly the discipline
OWN_REPOSITORY_SPELLINGSalready lives under here, with
test_the_unquoting_rule_is_the_production_readers_own_ruleloading theproduction module by path and pinning the two equal over fifteen inputs.
The live pin is NOT quoted, so
test_the_live_pin_carries_lines_the_two_readers_read_differently— which pinsthe divergence WARN on the live pin's unquoted
#/:citations, and whichreds if a successor's re-vendor ever makes the class vacuous — stays green
unchanged. What is new is that quoting a scalar now clears the warning.
3. A failing row is never labelled OK
Finding (Copilot, #842
scripts/validate-pin-registrations.py:730). Thebranch for a pin naming no
consumer_entrypoint:returnscitations_okbutprinted an unconditional
OK …line, so a row failing on a dangling citationcarried an
OKlabel about the assertions that did not apply.What changed. The line reads
MEASUREDwherecitations_okis false. Theinapplicability is still said, which is what the branch is for.
Test evidence
python3 -m pytest tests/pin_registrations -q: 51 passed before, 59 passedafter — eight new tests, and every one of them is RED on the arm as it stood
(measured by swapping
origin/main's checker back in:8 failed, 51 deselected).test_a_folded_decoy_and_a_comment_no_longer_cancel_each_other_outwhy: >-names a path that EXISTS, so the old arm exits 0 on this tree; the dangling citation after the comment is now reported atdispositions[1]and the decoy is never named.test_the_folded_decoy_case_is_bound_line_by_line_to_its_entryparsed_citations_oftest_the_reader_walks_the_structure_and_binds_every_line_to_its_entrytest_equal_totals_that_fall_in_different_entries_refuse_the_field1x2against1x1, 2x1, field refusedtest_a_quoted_citation_scalar_no_longer_divergestest_the_reader_unquotes_the_line_the_way_the_production_reader_does"…"and'…'unquoted; a backquoted span left alonetest_the_unquoting_rule_is_the_production_readers_own_rulevalidate-openspec-cli-pin.py's_unquotetest_a_row_failing_on_a_citation_is_not_labelled_ok_where_it_names_no_entrypointpython3 -m pytest tests/proposal-support -q: 106 passed, 46 subtests passed.python3 -m pytest tests/doc-health/test_modified_block_currency.py -q: 139 passed.The live pin's verdict is unchanged, byte for byte.
python3 scripts/validate-pin-registrations.pybefore and after this branch produceIDENTICAL output (
diffclean): exit 0, 4 dispositions, 21 citations, 17referents, 9 in-tree paths, and the same 7 measured divergences (5 truncated at a
#, 2 read as a single-key mapping).The two owed docstring nits
scripts/proposal-support.py:505—OriginRetentionError's docstring brokemid sentence ("… could not be read. What / they share is …") and read as a
truncated clause. Rejoined and rewrapped; no word changed. refs The origin-retention walk refuses a moved path instead of silently re-basing to the rename commit #846
scripts/doc_health/modified_block_currency.py:64— the module summary ofmarker-defect GROUND TWO stated the quoted-span predicate without the half that
keeps a correct marker quiet.
suppression()skips a span the marker ALSONAMES ("a span the marker also names is a repeat, not a defect",
modified_block_currency.py:1480), so a reader of the summary alone wouldexpect a finding on a marker that declares the unit properly and quotes it
again in its reason. The clause is restored. refs Propose amend-marker-defect-reporting: a marker whose reason quotes an uncarried unit is reported (#729) #850
refs #842 (the arm and the bench round), refs #840 (the arm's origin).
Closes #851
🤖 Generated with Claude Code