Repository navigation
doc-health: match ## Exit as a heading family + require a positive exit-statement signal - #505
Conversation
…ive exit-statement signal (#453) _staged_exit_changes (families.py, feeding location-conformance's "staged material already cites proposal ..." error) had two defects. Defect (a): `in_exit = line.strip().lower() == "## exit"` was an exact match, but `## Exit path` is the MAJORITY heading across ideation/staging/ (20 occurrences vs 12 of `## Exit`, counted 2026-08-29: `grep -rhoE '^## Exit.*' ideation/staging | sort | uniq -c`). Every exit section under the majority spelling was never scanned; only the Exit:/Exits via: line-prefix fallback could catch those topics, and it rarely fires in practice. Fixed by `_is_exit_heading`: a `##` heading whose text, lowercased, is `exit` or starts with `exit `/`exit:` — a family match instead of one string, covering both observed spellings and future variants (`## Exit criteria`, ...). Defect (b): the docstring promised "change ids used as lifecycle exits, not evidence citations", but the implementation included ANY known change id appearing anywhere inside the Exit-heading section, regardless of what the sentence said. signed-execution-chain's own `## Exit path` section repeats two of its four `## Conflicts`-section dependencies in that same dependency voice ("Consumes `add-wallet-carried-review- authority`'s realized issuer anchor...", "...and `implement-openxpki- install-repo` to issue the controller certificate") — fixing only defect (a) would have turned these into new false positives. Rather than blocklist every dependency phrasing (the corpus already uses at least five distinct ones — "Consumes", "blocked on", "cannot propose until", "depends on", "must not assume before it exists" — with more inevitable), the fix requires the POSITIVE signal instead: _EXIT_STATEMENT_RE matches `exits via`, `exits to`, `exit taken`, `promoted by`, `raised as ... change`, or a `→` pointer — phrasings actually used across ideation/staging/** to state an exit ("the topic exits via `<change>`", "Exit TAKEN 2026-08-28. Proposed the same day as...", INDEX.md's "EXIT 1 IS RAISED as the active change `<change>`"). A change id inside an Exit-heading section that isn't on a line stating the exit this way is excluded by default — silence rather than a blocklist miss. Tests added (tests/doc-health/test_families.py): a majority-spelling regression that would have stayed silent under the exact old match; a direct heading-family unit test across all observed/plausible spellings; and a signed-execution-chain-shaped dependency-citation exclusion test (both real dependency phrasings, in both the Conflicts and Exit-path sections). Full suite: 1336 passed (was 1333), all previously-pinned EXPECTED_ACTIONS untouched. Real-corpus location-conformance run (`--single-repo .`), before vs after: 2 "already cites proposal" findings -> 0. - avatar-pilot-hardening.md: "already cites proposal qualify-avatar-live-voice" — REMOVED. False positive: the citing text is "It cannot propose until `qualify-avatar-live-voice` publishes... it is the last successor, and is blocked on both of those" — a blocking-predecessor dependency, not this topic's own exit statement. - openxwallet-neutral-home.md: "already cites proposal create-ledgerxwallet-overlay-boundary" — REMOVED. False positive: the citing text is "The first domain descendant is `LedgerxWallet`, via `create-ledgerxwallet-overlay-boundary`, on the descendant standard this change ratifies" — a downstream-descendant reference to a different repo's change, not this topic's own exit (which is `split-openxwallet-repo`, already archived and outside the active set scanned here). No new findings appeared despite the heading fix newly scanning 20 previously-invisible `## Exit path` sections — none of them states an exit into a currently-active change without also being caught by the positive-signal filter's design intent. Closes #453 Co-Authored-By: Claude Fable 5 <[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 ✨
There was a problem hiding this comment.
Pull request overview
This PR fixes a doc-health false-negative/false-positive combination in the location-conformance family by (1) matching Exit headings as a “family” (covering both ## Exit and the more common ## Exit path), and (2) tightening staged exit detection so only lines that positively state an exit can contribute change IDs (avoiding dependency-citation false positives). It also adds targeted unit tests covering the regression cases described in issue #453.
Changes:
- Add
_is_exit_heading()to treat## Exit*headings as a family rather than requiring an exact## Exitmatch. - Require a positive “exit statement” signal (
_EXIT_STATEMENT_RE) before counting change IDs inside an Exit section, reducing dependency-citation false positives. - Add tests covering the majority heading spelling and dependency-citation exclusion behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/doc_health/families.py | Broadens Exit heading detection and requires positive exit-statement phrasing before counting cited change IDs in Exit sections. |
| tests/doc-health/test_families.py | Adds regression/unit tests ensuring Exit heading variants are detected and dependency citations in Exit sections do not trigger findings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes #453.
Defect (a) — heading match was exact, missed the majority spelling
_staged_exit_changes(scripts/doc_health/families.py) matched the Exitheading with
line.strip().lower() == "## exit"— exact string only. But## Exit pathis the majority heading inideation/staging/(20 vs 12 of## Exit, confirmed viagrep -rhoE '^## Exit.*' ideation/staging | sort | uniq -c). Fixed with_is_exit_heading: a##heading whose text,lowercased, is
exitor starts withexit/exit:— a family matchcovering both observed spellings plus future variants.
Defect (b) — any known change id counted, not just exit statements
The docstring promised "change ids used as lifecycle exits, not evidence
citations", but the implementation flagged any active change id appearing
anywhere inside the Exit-heading section — including dependency, predecessor,
or downstream-descendant mentions. Fixing only (a) would have introduced a
false positive on
signed-execution-chain, whose own## Exit pathsectionrepeats two of its four
## Conflicts-section dependencies in the identicaldependency voice ("Consumes
add-wallet-carried-review-authority's realizedissuer anchor...", "...and
implement-openxpki-install-repoto issue thecontroller certificate").
Rather than blocklist every dependency phrasing (the corpus already uses at
least five distinct ones — "Consumes", "blocked on", "cannot propose until",
"depends on", "must not assume before it exists"), the fix requires a
positive exit-statement signal instead.
_EXIT_STATEMENT_REmatchesexits via,exits to,exit taken,promoted by,raised as ... change,or a
→pointer — phrasings actually used acrossideation/staging/**tostate an exit. A change id inside an Exit-heading section that isn't on a
line stating the exit this way is excluded by default.
Tests
Added to
tests/doc-health/test_families.py:## Exit path) regression that would have stayedsilent under the exact old match;
_is_exit_heading/_staged_exit_changesunit test across everyobserved spelling plus a plausible unobserved one (
## Exit criteria);signed-execution-chain-shaped dependency-citation exclusion test,covering both real dependency phrasings in both the
## Conflictsand## Exit pathsections.Full suite: 1336 passed (was 1333 baseline + 3 new), all previously
pinned
EXPECTED_ACTIONSuntouched.Real-corpus check
python3 scripts/doc-health.py --single-repo . --family location-conformance,before vs after: 2 "already cites proposal" findings → 0.
avatar-pilot-hardening.md: "already cites proposalqualify-avatar-live-voice" — REMOVED, false positive. Citing text: "It
cannot propose until
qualify-avatar-live-voicepublishes... it is thelast successor, and is blocked on both of those" — a blocking-predecessor
dependency, not this topic's own exit statement.
openxwallet-neutral-home.md: "already cites proposalcreate-ledgerxwallet-overlay-boundary" — REMOVED, false positive. Citing
text: "The first domain descendant is
LedgerxWallet, viacreate-ledgerxwallet-overlay-boundary, on the descendant standard thischange ratifies" — a downstream-descendant reference to a different repo's
change, not this topic's own exit (
split-openxwallet-repo, alreadyarchived and outside the active set scanned here).
No new findings appeared despite the heading fix newly scanning 20
previously-invisible
## Exit pathsections.What was skipped
Nothing from the assigned scope. Both defects (a) and (b) are implemented;
the exclusion rule uses a positive-signal requirement rather than a
dependency-phrase blocklist, since the latter would be unreliable against
the corpus's actual variety of dependency phrasings (documented in the code
comment and commit body).
🤖 Generated with Claude Code