Skip to content

doc-health: ratified-provenance reads a ratification record's subject; the corpus enumerator reaches the root-level governed products (#878, #869) - #890

Merged
brettheap merged 6 commits into
mainfrom
fix/doc-health-record-subject-and-root-products
Sep 10, 2026
Merged

brettheap merged 6 commits into
mainfrom
fix/doc-health-record-subject-and-root-products

Conversation

@brettheap

@brettheap brettheap commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1 (openXfactory-1)

Two doc-health defects, one branch. Both were found the same way — a reviewer, not the checker, caught the drift the checker exists to catch — and both are single-site fixes with the tests that pin them.

Surface: scripts/doc_health/families.py, scripts/doc_health/corpus.py, and four files under tests/doc-health/. Nothing under openspec/, no canon document, no archived record.


1. ratified-provenance reads a review record's SUBJECT, not only its Status: value (#878)

What was wrong. fam_ratified_provenance scoped its whole loop on doc.status != "ratified": continue — the header's VALUE. The scenario it enforces, document-lifecycle's A review record records a ratification, binds on the document's SUBJECT: "WHEN a review/ document under a change packet records that the change was ratified, THEN it MUST carry Status: ratified and one ratification citation in a sanctioned spelling". A ratification record filed Status: record is therefore exactly the document the scenario governs and exactly the document a value-scoped family never opened.

What it cost, measured. Fourteen archived ratification records out of contract with zero findings (#877), and PR #870's first encode (d0ddb126) reproduced the drift while doc-health reported clean.

The fix.

  • scripts/doc_health/families.py:254-255 — the two recognizers, ratification- (file name) and # Proposal Ratification: (H1).
  • scripts/doc_health/families.py:258 _h1 — the document's first # real line WITHIN the fifteen-line header window, split on the same real-line rule corpus.parse_status uses (align-status-reader-to-real-lines: a title read on a different splitting rule than the status beside it is the divergence that ruling exists to prevent). Bounded on purpose — a # Proposal Ratification: line quoted in prose far below the header is not this document's title, and a family that read it as one would fire on a record ABOUT ratification records.
  • scripts/doc_health/families.py:277 _is_change_review_record — openspec/changes/**/review/<file> and nothing else. _lifecycle_scope concatenates the scan set with the GOVERNED CORPUS, so a docs/ratification-policy.md is in this family's scope too; the scenario reaches review/ documents under a change packet, so the path SHAPE is checked, not the file name alone.
  • scripts/doc_health/families.py:291 _records_a_ratification — the subject test, disjunctive over the two recognizers.
  • scripts/doc_health/families.py:308-317 — the rule and action strings. The rule QUOTES the scenario it enforces, because the remedy is a governance act and a reader who cannot find the rule cannot perform it.
  • scripts/doc_health/families.py:639 — the arm itself, inside the doc.status != "ratified" branch, at the family's existing CRITICAL severity.

Why two recognizers and not one. The corpus writes the subject two ways. Every record follows the packet template's review/ratification-<date>.md naming, which is the load-bearing arm; the H1 arm catches a record whose author named the file something else. A title-ONLY test would miss a third of the standing population — five of the records #877 measured open # Ratification — <date> or # Ratification record — <change> instead.

What keeps it narrow. The neighbouring scenario, A review record is not about a ratification, exempts a review/ record whose subject is a finding, a disposition or a captured review round. Seventy-odd of those sit in this corpus and every one stays silent. The existing status-value logic — the citation count, the change-id resolution, the three-way floor — is untouched, and test_the_existing_status_value_logic_is_untouched pins that.

A missing header reaches the arm too, deliberately: doc.status is None is not "ratified", and the scenario's THEN is "MUST carry Status: ratified", which an absent header fails as squarely as a wrong value. Such a document also draws a status-validity finding; the two say different things — that family asks for A taxonomy value, this one names WHICH. This corpus holds exactly one (disposition-codexfactory-declared-renames/review/ratification-2026-09-05.md).

Severity and the archive are deliberately not touched. This arm FIRES on the standing population by design. The remedy for the archived records is a governed act (record-immutability, govern-archived-record-edits) and belongs to #877 — not to a lowered severity and not to an archive exclusion here. The finding keeps the family's default auto-fixable class, as every other ratified-provenance finding does including the ones already landing on archived records on main; the shared action string names BOTH repair routes so an archived record is never sent down the wrong one.

2. The corpus enumerator reaches the root-level governed products (#869)

What was wrong. corpus.discover_repos enumerated openxFactory plus xFactories/* and nothing else. ROOT_LEVEL_GOVERNED_PRODUCTS (scripts/doc_health/corpus.py:64) has named openAvatar and openXwallet as governed repositories since split-openxwallet-repo § 11.2, and two widened sites read it — this enumerator, the one that decides which repositories an aggregation-rooted sweep actually MEASURES, was not one of them.

What it cost, measured. On the 2026-09-09 estate runs (refs #765, #731, #859) doc-health.py --repo-root <aggregation> reached neither product, and both had to be measured by separate --single-repo invocations to be measured at all. Today that costs little; openXwallet is the only repository in the estate besides openxFactory with a contract-bundle surface, so the day it adopts the graded bundle shape is the day the nightly would grade every repository except the one that changed.

The fix.

  • scripts/doc_health/corpus.py:127 _is_materialized_repo — the xFactories/* materialization check, extracted so the two sources cannot drift apart. .git is a FILE in a submodule worktree and a directory in a plain clone, hence exists().
  • scripts/doc_health/corpus.py:178 — discover_repos yields each allowlisted product present under the aggregation root, under that SAME check. Absent or unmaterialized is skipped silently: admitting an empty directory would put a repository into repo_paths, capabilities and the report that contributes no document — a repository the run claims to have measured and did not.

The id is the BARE NAME, never xFactories/<name>. ideation_routing._governed_repo_ids anticipated this widening and tolerates an allowlisted name in repo_paths unprefixed for exactly this reason — "a silent xFactories/openXwallet would be a repository that exists nowhere" — and test_corpus_discovery.py pins the round trip through it so the two sites agree by construction rather than by coincidence.

openxFactory keeps its laxer is_dir() admission, pinned as a deliberate asymmetry: it is the aggregation's anchor rather than one repository among many, and every fixture aggregation in this suite is a plain directory tree with no .git anywhere.

No canon change. The products list already exists and is the declared source. xFactories/* behaviour is unchanged and pinned unchanged.

3. Two test defects in the two commits above, fixed here

The one that mattered. test_the_subject_arm_reaches_active_packets_as_well_as_archived_ones asserted that the real tree still carries at least one UNREPAIRED ACTIVE ratification record. Six do today, so it passed — and it would go red the day that population is discharged, which is the outcome the change exists to provoke. pytest-suite is a REQUIRED check here and runs pytest tests/, so the failure would have landed on whichever lane repaired the last active record. That is the trap ISSUE_877_FOURTEEN's biconditional was written to avoid, sprung by the test standing beside it.

The claim is now pinned SYNTHETICALLY (test_the_subject_arm_draws_no_line_at_the_archive_boundary) — one record's exact text at an active packet path and at an archived one, both reported — where no merge can move it. The real-tree measurement is GENERALIZED rather than narrowed: the independent walk and the equality it feeds now cover active packets and the archive together, so the active reach is measured rather than sampled, and the assertion follows the corpus wherever it goes.

The prose one. Commit 9e513816 cited three sites as having "anticipated this widening" and left them asserting the widening cannot happen. The two inside this surface are corrected, assertions untouched: test_governed_repo_ids_admit_root_products_with_no_checkout_in_scope justified a still-correct assertion with "discover_repos can never place a root-level product in repo_paths" (now false), and test_governed_repo_ids_never_prefix_a_root_product_with_xfactories described as hypothetical the thing the commit beside it had just done. Both assertions were right and stay right for a reason that survives the widening: the allowlist is a claim about the aggregation's TOPOLOGY, which a single-repo self-gate and an unmaterialized pin both need and neither can derive from repo_paths.

Named, not fixed — deliberately out of surface. scripts/doc_health/ideation_routing.py:240-242 (_governed_repo_ids' docstring) carries the same stale claim: "discover_repos enumerates openxFactory plus xFactories/* and nothing else, so a root-level product can never appear in repo_paths". That sentence is false as of commit 9e513816. It is a comment-only correction outside this pull request's declared surface, recorded here so it is not lost.


Evidence

Tests

python3 -m pytest tests/doc-health -q

tree result
origin/main @ 9784e38a (baseline, in a detached worktree of this clone) 1659 passed, 0 failed, 0 skipped, in 330s
this branch @ 1954b0b1 1680 passed, 0 failed, 0 skipped, in 328s

+21 tests, 0 failures, 0 skips added. Twelve in tests/doc-health/test_ratification_record_subject.py (new), nine in tests/doc-health/test_corpus_discovery.py (new); tests/doc-health/test_families.py gains the fifth ratified-provenance action string to its verbatim pin.

On the full python3 -m pytest tests/ -q -m "not postgres" that the required pytest-suite check runs, this change is additive in the only two directions that check measures: MIN_SELECTED: 7090 and MIN_PASSED: 7070 are FLOORS, and +21 passing tests raises both margins; EXPECT_SKIPPED: 21 is an EXACT pin, and no test added here can skip (there is no pytest.skip, no skipif, and no conditional fixture in either new file — the one assertion in the adopted suite that could have degraded into "retire me" was the corpus-population assertion §3 replaces). The run in CI on this pull request is the authority for that check and is reported in the comments; a local full run was started and abandoned when main advanced under its worktree mid-run, which would have made its counts unreadable.

The single-repo delta

python3 scripts/doc-health.py --single-repo . --skip-family notebook-projection-drift, run on both trees and diffed with the repo-name field normalized:

-Findings: 11 critical, 5 error, 47 warning, 13 info. New regressions vs previous report: 0.
+Findings: 32 critical, 5 error, 47 warning, 13 info. New regressions vs previous report: 0.

+21 critical and NOTHING else. Not one error, warning or info finding moved; no path left the report; every added line carries the same new rule string.

The normalized diff carries exactly two other lines, and they are the same release-tag-publication SKIP NOTICE naming a different unresolvable version (contract-v1.47 on one side, contract-v1.45 on the other). It is an artifact of resolving published refs offline in this sandbox, not a property of either tree: nothing in this branch touches contracts/ or that family, and two further runs of the IDENTICAL branch tree emitted no such notice at all. It is a skip notice, not a finding — the finding counts above are unaffected by it.

The rule and action, quoted once verbatim (identical on all 21):

- severity=critical family=ratified-provenance repo=openxFactory path=<path> rule="a review record that records a ratification must carry Status: ratified and one citation — document-lifecycle, *A review record records a ratification*" action="set Status: ratified and add one ratification citation in a sanctioned spelling (Ratified by: <change>, otherwise Ratified: naming an approver, a date, or a resolvable record path); on an archived record the repair takes the archived-record edit route" class="auto-fixable"

Twenty-one, not fourteen — and every one a true positive of the same defect class. #877's list is a measurement of the ARCHIVED population at a moment in time, not of the whole population. The three groups:

(a) #877's fourteen archived records — the list on refs #877, reproduced exactly:

openspec/changes/archive/2026-09-04-add-per-change-sweep-ledger/review/ratification-2026-09-04.md
openspec/changes/archive/2026-09-04-create-medxchart-overlay-boundary/review/ratification-2026-09-03.md
openspec/changes/archive/2026-09-04-create-medxpractice-overlay-boundary/review/ratification-2026-09-03.md
openspec/changes/archive/2026-09-05-add-release-tag-gate/review/ratification-2026-09-05.md
openspec/changes/archive/2026-09-05-amend-published-tip-unreadable-scenario/review/ratification-2026-09-05.md
openspec/changes/archive/2026-09-05-amend-unreadable-read-sibling-scenarios/review/ratification-2026-09-05.md
openspec/changes/archive/2026-09-06-amend-marker-reason-boundary/review/ratification-2026-09-06.md
openspec/changes/archive/2026-09-07-amend-absent-changelog-is-an-answer/review/ratification-2026-09-07.md
openspec/changes/archive/2026-09-08-publish-openspec-cli-pin-as-contract-member/review/ratification-2026-09-07.md
openspec/changes/archive/2026-09-09-add-openspec-cli-pin/review/ratification-2026-09-04.md
openspec/changes/archive/2026-09-09-amend-marker-defect-reporting/review/ratification-2026-09-09.md
openspec/changes/archive/2026-09-09-bump-openspec-cli-pin-to-1.12/review/ratification-2026-09-05.md
openspec/changes/archive/2026-09-09-pin-openspec-cli-dependency-closure/review/ratification-2026-09-09.md
openspec/changes/archive/2026-09-09-refresh-install-repository-enumerations/review/ratification-2026-09-09.md

(b) one archived record that did not exist when #877 measured — #877 measured main at 2026-09-10T00:26Z; this record landed at 62935437 on 2026-09-10T00:38Z, twelve minutes later, carrying # Proposal Ratification: and Status: record:

openspec/changes/archive/2026-09-10-adopt-codexfactory-repository-identity/review/ratification-2026-09-07.md

(c) six ACTIVE change packets, which #877 never enumerated — its measurement was "of 32 archived review/ratification-*.md records", so the active population was outside its frame, not absent from the corpus. Each is a review/ record under a change packet whose subject is the ratification and whose Status is record (or, in the last case, absent entirely):

openspec/changes/adopt-configured-notebook-hosting-identity/review/ratification-2026-09-08.md
openspec/changes/amend-mirror-floor-regeneration-merge-authority/review/ratification-2026-09-08.md
openspec/changes/extend-merge-master-envelope-to-floor-bot-lanes/review/ratification-2026-09-07.md
openspec/changes/mirror-floor-regeneration-automation/review/ratification-2026-09-06.md
openspec/changes/relocate-review-authority-floor-mirror/review/ratification-2026-09-08.md
openspec/changes/disposition-codexfactory-declared-renames/review/ratification-2026-09-05.md

These six are the CHEAP half of the remedy: an active packet's record is repaired by editing it, no archived-record edit route required. They are reported here and repaired by their own lanes; nothing in this pull request edits them.

The count is derived, not typed: an independent walk of openspec/changes/**/review/*.md restating the subject rule in its own code finds exactly the same 21 (6 active, 15 archived), and test_the_subject_arm_reports_exactly_the_packet_population_this_tree_carries asserts the two agree on every run.

#869, end to end

A synthetic aggregation root (openxFactory/, openXwallet/ with a .git file, xFactories/MedxFactory/), swept with --repo-root:

main    Repo-Identity: MedxFactory, openxFactory
branch  Repo-Identity: MedxFactory, openXwallet, openxFactory

and on the branch the product's own document is actually graded:

- severity=critical family=ratified-provenance repo=openXwallet path=docs/wallet-note.md rule="ratified header carries no citation in either sanctioned spelling" ...

The runner integrates the new repository cleanly — validator entrypoint reported as (none), families that need an OpenSpec archive skip with their usual notice.

The CI gate reading

doc-health is NOT a required pull-request check in this repository, and the 21 new findings turn nothing red.

  • .github/workflows/doc-health-reusable.yml is on: workflow_call ONLY. No workflow in openxFactory/.github/workflows/ runs doc-health on pull_request or push.
  • Its fail-on input (doc-health-reusable.yml:21, "Optional gate severity (critical or error); empty = report-only") defaults to "", and is consumed at :2091/:2141.
  • Its only caller is the aggregation's xFactory/.github/workflows/doc-health-nightly.yml (on: schedule + workflow_dispatch), which does not pass fail-on at all — so the nightly runs REPORT-ONLY and delivers through a rolling PR.
  • The required checks on main come from four active rulesets and are: signed-execution-chain-gate, lane-line (21957695), openspec-cli-pin (22551797), wallet-validation, pytest-suite, release-tag-gate (21538893). None runs doc-health.
  • pytest-suite IS required and runs python3 -m pytest tests/ -q -m "not postgres" — which is why §3 above matters, and why the counts are reported against its floors.

The findings therefore land in the nightly report, where #877's disposition can be applied to them, and nowhere else.


Refs #877, #870, #765, #731, #859.

Closes #878
Closes #869

🤖 Generated with Claude Code

Summary by Sourcery

Make doc-health enforce ratification-record status requirements and measure materialized root-level governed products during aggregation sweeps.

New Features:

  • Extend aggregation-root repository discovery to include materialized allowlisted root-level governed products while preserving existing repository identifiers and checkout behavior.

Bug Fixes:

  • Ensure ratification provenance checks identify review records by subject, including records with non-ratified or missing status headers, without affecting existing citation validation.
  • Prevent unmaterialized or unrelated root-level directories from being reported as governed repositories.

Tests:

  • Add coverage for ratification subject recognition, active and archived packet handling, scope boundaries, and preservation of existing provenance rules.
  • Add repository discovery tests covering root-level products, materialization requirements, allowlist enforcement, identifier round trips, and existing xFactories behavior.

Brett Heap and others added 5 commits September 9, 2026 22:42
…, not only its Status value (#878)

`fam_ratified_provenance` scoped itself on `doc.status != "ratified":
continue` — the header's VALUE. The scenario it enforces,
`document-lifecycle`'s *A review record records a ratification*, binds on
the document's SUBJECT: "WHEN a `review/` document under a change packet
records that the change was ratified, THEN it MUST carry `Status: ratified`
and one ratification citation in a sanctioned spelling". A ratification
record filed `Status: record` is therefore exactly the document the scenario
governs and exactly the document a value-scoped family never opened.

Measured consequence: fourteen archived ratification records out of contract
with zero findings (#877), and PR #870's first encode (`d0ddb126`)
reproduced the drift while doc-health reported clean — a reviewer, not the
family, caught it.

The subject arm recognizes a `review/` record under a change packet whose
file name opens `ratification-` OR whose H1 opens `# Proposal Ratification:`,
and reports it at the family's existing CRITICAL severity with a rule that
quotes the scenario. Two recognizers because the corpus writes the subject
two ways: five of the records #877 measured open `# Ratification — <date>`
or `# Ratification record — <change>`, so a title-only test would miss a
third of the standing population.

The neighbouring scenario *A review record is not about a ratification* is
what keeps the arm narrow: a `record`-status review whose subject is a
finding, a disposition or a captured review round stays silent, and
seventy-odd of those sit in this corpus. The existing status-value logic —
the citation count, the change-id resolution, the three-way floor — is
untouched.

This finding FIRES on the standing population by design. The remedy for the
archived records is a governed act (`record-immutability`,
`govern-archived-record-edits`) and belongs to #877, not to a lowered
severity or an archive exclusion here.

Refs #877, #870.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ducts (#869)

`corpus.discover_repos` enumerated `openxFactory` plus `xFactories/*` and
nothing else. `ROOT_LEVEL_GOVERNED_PRODUCTS` (`corpus.py:64`) has named
`openAvatar` and `openXwallet` as governed repositories since
`split-openxwallet-repo` § 11.2, and two widened sites read it — this
enumerator, the one that decides which repositories an aggregation-rooted
sweep actually MEASURES, was not one of them.

Measured on the 2026-09-09 estate runs (#765, #731, #859):
`doc-health.py --repo-root <aggregation>` reached neither product, and both
had to be measured by separate `--single-repo` invocations to be measured at
all. Today that costs little; openXwallet is the only repository in the
estate besides openxFactory with a contract-bundle surface, so the day it
adopts the graded bundle shape is the day the nightly would grade every
repository except the one that changed.

`discover_repos` now yields each allowlisted product present under the
aggregation root, under the SAME materialization check the `xFactories/*`
children get (`_is_materialized_repo`, extracted so the two sources cannot
drift apart); an absent or unmaterialized one is skipped silently. The id is
the BARE NAME, never `xFactories/<name>`:
`ideation_routing._governed_repo_ids` anticipated this widening and tolerates
an allowlisted name in `repo_paths` unprefixed for exactly this reason, and
the new suite pins the round trip through it so the two sites agree by
construction. `openxFactory` keeps its laxer `is_dir()` admission, pinned as
a deliberate asymmetry: it is the aggregation's anchor, and every fixture
aggregation in this suite is a plain directory tree with no `.git` anywhere.

No canon change: the products list already exists and is the declared source.

Refs #765, #731, #859.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…opulation, and the widened-enumerator prose stops claiming the widening cannot happen

Two defects in the two commits this branch adopted, both in the tests, both
of a kind that reds a REQUIRED check on somebody else's pull request.

FIRST, `test_the_subject_arm_reaches_active_packets_as_well_as_archived_ones`
asserted that the real tree still carries at least one UNREPAIRED ACTIVE
ratification record. Six do today, so it passed — and it would go red the day
that population is discharged, which is the outcome the whole change exists to
provoke. `pytest-suite` is a required check on every pull request in this
repository (ruleset 21538893) and it runs `pytest tests/`, so the failure
would land on whichever lane happened to repair the last active record, with
a message telling them their green change had "served its purpose". That is
precisely the trap `ISSUE_877_FOURTEEN`'s biconditional was written to avoid,
sprung by the test standing beside it.

The claim is now pinned SYNTHETICALLY — one record's exact text at an active
packet path and at an archived one, both reported — where no merge can move
it, and the docstring says why the population is not the claim. The real-tree
measurement is generalized instead of narrowed: the independent walk and the
equality it feeds now cover ACTIVE PACKETS AND THE ARCHIVE TOGETHER, so the
active reach is measured rather than merely sampled, and the assertion follows
the corpus wherever it goes. It reproduces exactly the 21 records the family
reports on this tree (6 active, 15 archived: #877's fourteen plus
`2026-09-10-adopt-codexfactory-repository-identity`, archived twelve minutes
after #877's 00:26Z measurement).

The walk mirrors the family's fifteen-line header window rather than scanning
whole documents for a title. The window is part of the RULE, not an
implementation detail an oracle may honestly vary — `_h1`'s docstring binds it
to `align-status-reader-to-real-lines`' wide ruling that every reader of a
header splits lines the same way — so the oracle restates the SUBJECT logic
independently and shares the window deliberately.

SECOND, the enumerator widening (`9e513816`) cited three prose sites as having
"anticipated this widening" and left them asserting the widening cannot
happen. Two are in this surface and are corrected here:
`test_governed_repo_ids_admit_root_products_with_no_checkout_in_scope`
justified a still-correct assertion with "`discover_repos` can never place a
root-level product in `repo_paths`", now false; and
`test_governed_repo_ids_never_prefix_a_root_product_with_xfactories` described
as hypothetical ("if `discover_repos` is ever widened") the thing the commit
beside it had just done. Both keep their assertions untouched — the
assertions were right, and right for a reason that survives: the allowlist is
a claim about the aggregation's TOPOLOGY, which a single-repo self-gate and an
unmaterialized pin both need and neither can derive from `repo_paths`.

The third site, `scripts/doc_health/ideation_routing.py`'s
`_governed_repo_ids` docstring ("`discover_repos` enumerates `openxFactory`
plus `xFactories/*` and nothing else, so a root-level product can never appear
in `repo_paths`"), carries the same stale claim and is DELIBERATELY NOT
touched here: it is outside this pull request's declared surface. It is named
on the pull request so the correction is not lost.

Refs #877, #878, #869.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings September 10, 2026 03:58

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 21 hours and 2 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

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

@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR fixes two doc-health blind spots: ratification provenance now scopes records by their review subject rather than only by Status, and aggregation sweeps now discover materialized allowlisted products at the repository root. The implementation preserves existing validation and repository enumeration semantics, with targeted tests covering active/archive records, parser boundaries, false-positive exclusions, materialization rules, and repository ID integration.

Flow diagram for subject-aware ratification provenance checks

flowchart TD
    A[Lifecycle-scoped document] --> B{Review record under openspec/changes/**/review/?}
    B -- No --> Z[Existing checks]
    B -- Yes --> C{Filename starts ratification- or header starts Proposal Ratification?}
    C -- No --> Z
    C -- Yes --> D{Status is ratified?}
    D -- Yes --> E[Run existing citation and change-id validation]
    D -- No --> F[Emit critical ratified-provenance finding]
    F --> G[Set Status: ratified and add sanctioned citation]
Loading

File-Level Changes

Change Details Files
Make ratified-provenance identify ratification records by subject before applying status and citation validation.
  • Added bounded H1 and filename recognizers for ratification subjects.
  • Restricted subject detection to review documents under change packets, covering active and archived paths.
  • Added a critical finding with scenario-linked rule and repair guidance when status is missing or not ratified.
  • Preserved the existing ratified-status citation validation path and pinned all action strings.
scripts/doc_health/families.py
tests/doc-health/test_ratification_record_subject.py
tests/doc-health/test_families.py
Extend aggregation repository discovery to include materialized root-level governed products.
  • Extracted the shared materialized-submodule check for root products and xFactories children.
  • Enumerated allowlisted root products using bare repository IDs while silently skipping absent or unmaterialized checkouts.
  • Retained openxFactory's laxer directory admission and existing xFactories behavior.
  • Added discovery, allowlist, ID round-trip, and asymmetry coverage.
scripts/doc_health/corpus.py
tests/doc-health/test_corpus_discovery.py
tests/doc-health/test_ideation_routing.py
Strengthen regression coverage around corpus-wide subject detection and repository enumeration.
  • Replaced unstable active-population assumptions with synthetic active/archive boundary tests and an independent whole-corpus equality check.
  • Added coverage for filename-only and title-only recognition, header-window bounds, non-ratification exclusions, missing status, and unchanged status-value behavior.
  • Pinned the new operator-facing ratified-provenance action text.
tests/doc-health/test_ratification_record_subject.py
tests/doc-health/test_corpus_discovery.py
tests/doc-health/test_families.py
tests/doc-health/test_ideation_routing.py

Assessment against linked issues

Issue Objective Addressed Explanation
#869 Update discover_repos to consult ROOT_LEVEL_GOVERNED_PRODUCTS and enumerate materialized root-level products such as openXwallet and openAvatar during aggregation-rooted sweeps. ✅
#869 Add regression coverage proving that present root-level governed products are discovered, while absent or unmaterialized products are skipped and existing openxFactory and xFactories/* behavior remains intact. ✅
#878 Make fam_ratified_provenance inspect review/ documents whose subject identifies them as ratification records, regardless of whether their Status is ratified, so records with a non-ratified status produce a critical finding requiring Status: ratified and a ratification citation. ✅
#878 Keep non-ratification review records and documents outside change-packet review/ paths out of the new ratification rule, while preserving the existing citation checks for records already carrying Status: ratified. ✅

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

New/modified tests embed host-absolute path literals (e.g., Path("/nonexistent")), which conflicts with the repository constitution’s “no host-absolute paths in committed files” rule.

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

Pull request overview

This PR fixes two doc-health coverage gaps: (1) ratified-provenance now flags ratification records based on their subject (even when Status: is wrong/missing), and (2) aggregation-root repo discovery now includes materialized root-level governed products (e.g., openXwallet, openAvatar) in addition to openxFactory and xFactories/*.

Changes:

  • Extend fam_ratified_provenance with a subject-based recognizer for ratification review records and emit a dedicated critical finding when those records are not Status: ratified.
  • Teach corpus.discover_repos to enumerate materialized root-level governed products using ROOT_LEVEL_GOVERNED_PRODUCTS and a shared materialization predicate.
  • Add/adjust tests to pin the new family arm and the expanded discovery behavior.
File summaries
File Description
scripts/doc_health/families.py Adds subject detection for ratification review records and emits a new finding/action when status is not ratified.
scripts/doc_health/corpus.py Expands aggregation repo discovery to include materialized root-level governed products and centralizes the materialization check.
tests/doc-health/test_ratification_record_subject.py New test suite covering subject-based ratification record detection (active + archived) and preserving existing value-scoped behavior.
tests/doc-health/test_corpus_discovery.py New tests ensuring discover_repos includes root-level governed products only when materialized and keeps existing ordering/behavior.
tests/doc-health/test_families.py Updates pinned action-string coverage to include the new subject-arm action.
tests/doc-health/test_ideation_routing.py Updates commentary/docs in tests to reflect the widened discovery semantics and preserve allowlist-vs-materialization distinctions.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread tests/doc-health/test_families.py Resolved
…ory root resolved at runtime, not an absolute literal

Taking both of Copilot's findings on PR #890. The constitution's § IV is
explicit — "Committed files MUST NOT contain host-absolute paths; use
repo-relative paths or runtime resolution"
(`.specify/memory/constitution.md`) — and `Path("/nonexistent")` is an
absolute literal however deliberate its non-existence.

One definition in `tests/doc-health/conftest.py`, which both callers already
import from, rather than a copy per file: a second copy is a second thing that
can quietly become a real directory, and the sentinel only works while nothing
of that name exists.

NON-EXISTENCE IS THE POINT AND SURVIVES THE FIX. These cases build a `Context`
by hand because what is under test is exact header content; the families they
run may not reach the filesystem at all — `fam_ratified_provenance` reads
`doc.text` and `ctx.change_ids` and nothing else — so a root that cannot
resolve is how that is ASSERTED rather than assumed. `tmp_path` would be the
wrong instrument for the same reason: it exists.

The second finding is on a line this branch did not author
(`test_families.py`'s `run()` helper, which predates it and which this branch
touched only to widen the signature). Taken anyway: it was the estate's ONLY
other occurrence, so the two together leave `grep -rn 'Path("/'` over
`tests/doc-health/` with nothing to report.

No assertion moves. 126 tests across the four files this branch touches pass
unchanged.

Refs #878, #869.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 04: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.

🔵 Needs a closer look

_is_change_review_record’s path-shape predicate is currently broader than its stated intent and can misclassify nested .../review/... paths, risking future false positives.

Review details

Suppressed comments (1)

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

scripts/doc_health/families.py:288

  • _is_change_review_record claims to match only openspec/changes/<packet>/review/<file> (active) and openspec/changes/archive/<dated-packet>/review/<file> (archived), but the current predicate (parts[-2] == "review") would also treat deeper nested paths like openspec/changes/<packet>/specs/review/<file> as in-scope. Tightening the shape check to the two intended layouts avoids future false positives and makes the implementation match the docstring.
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

Frozen at 98b4a56a. All eleven checks terminal and green; no unresolved threads.

The required pytest-suite, on the frozen head

Run 34436702794, 20m6s, success — the counts the workflow measures, against its own floors:

selected=11012 passed=10991 skipped=21 failures=0 errors=0
freshness verifier (tests.review_lane_pin.test_floor_snapshot.TheFreshnessVerifier::test_the_snapshot_is_byte_identical_to_the_pinned_core): passed
vector replay (tests.review_lane_pin.test_floor_snapshot.TheVectorReplay::test_every_vector_replays): passed
floors: selected>=7090 (margin 3922) passed>=7070 (margin 3921) skipped==21

10832 passed, 21 skipped, 338 deselected, 159 subtests passed in 1170.58s.

This is what the pull request body said this comment would carry. MIN_SELECTED/MIN_PASSED are floors and the change raises both margins; EXPECT_SKIPPED is an EXACT pin and lands on 21 unchanged — nothing added here can skip. Both separately-watched named verdicts ran and passed.

Locally, on the same tree

python3 -m pytest tests/doc-health -q — 1680 passed on this branch against 1659 passed on origin/main @ 9784e38a in a detached worktree of the same clone. +21 tests, no failures, no skips added.

The two review findings, both taken

Copilot raised the same .specify/memory/constitution.md § IV violation twice ("Committed files MUST NOT contain host-absolute paths; use repo-relative paths or runtime resolution"). Both taken in 98b4a56a, replied on their threads and resolved. The second was on a line this branch did not author — test_families.py's run() helper predates it — and was taken anyway because it was the estate's only other occurrence: grep -rn 'Path("/' tests/doc-health/ now returns nothing.

Codex

@codex review was requested at 03:59:01Z and answered at 03:59:08Z with a usage-limit refusal, not a review. Recorded as an ABSENCE, not as a clean bill. No Codex finding exists on this pull request either way.

Sourcery posted its reviewer's guide and raised no finding; SonarCloud's quality gate passed with 0 new issues.

Standing disclosure

The ratified-provenance subject arm reports 21 findings on this tree, not the fourteen refs #877 lists: #877's fourteen, one archived record that landed twelve minutes after its measurement, and six ACTIVE change packets its measurement never framed. Every one is a true positive of the same class, enumerated with its group in the pull request body. doc-health is not a required pull-request check here and its nightly caller passes no fail-on, so these land in the nightly report and nowhere else — the reading is in the body under "The CI gate reading".

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

FROZEN + LANDING PROVENANCE — 2026-09-10T04:43:14Z. Head 98b4a56a (#878 subject arm 659ef11d; #869 root-level products 9e513816; test hardening db374d60 — the population-dependent assertion replaced with a synthetic pin so the suite cannot go red when the last active record is repaired; constitution §IV host-path sentinels 98b4a56a; two merges from main). Brett's words: "do 1, then 2" (02:1xZ) and "land 1 when green" (02:28Z). Guard on live values: six required checks SUCCESS on 98b4a56a (pytest-suite run 34436702794: selected 11012, passed 10991, skipped 21, both named verifiers passed); merge-master-approval = SUCCESS; unresolved review threads 0 (Copilot ×2 TAKEN); closingIssuesReferences = #869, #878 and the body's closing keywords name exactly those; no openspec/changes/ file touched; no other lane's LANDING open; main 15ebb37d (decided=success@9784e38 pending=1). Effect disclosed: doc-health single-repo gains exactly +21 CRITICAL, all true positives of the new subject arm — #877's fourteen archived records, one archived after #877's measurement (2026-09-10-adopt-codexfactory-repository-identity), and six ACTIVE packets #877 never framed (adopt-configured-notebook-hosting-identity, amend-mirror-floor-regeneration-merge-authority, extend-merge-master-envelope-to-floor-bot-lanes, mirror-floor-regeneration-automation, relocate-review-authority-floor-mirror, disposition-codexfactory-declared-renames); doc-health is report-only (no PR workflow runs it; fail-on defaults empty; nightly passes none), so no check turns red. Codex: usage-limit refusal = ABSENCE, not clearance; Copilot final "Approval recommended"; Sonar quality gate passed. Out-of-surface residue named on the PR: scripts/doc_health/ideation_routing.py:240-242 comment still claims a root-level product can never appear in repo_paths. Admin merge with provenance: authored as brettheap, self-approval cannot clear the review requirement (B2 pattern).

@brettheap
brettheap merged commit 804a917 into main Sep 10, 2026
13 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

LANDED — lane openxfactory-1, 2026-09-10T04:43:26Z, PR #890 → 804a9170 on opensoft/openxFactory main. Origins #878: CLOSED; #869: CLOSED.

brettheap added a commit that referenced this pull request Sep 10, 2026
… newly-promoted rule; add the exit-code and merge addendum

PR #890 landed on main (804a917, 2026-09-10T04:43:17Z) while
review/ratification-2026-09-10.md was being written: document-lifecycle's
"A review record records a ratification" is now promoted and requires a
review/ record whose SUBJECT is a ratification to carry Status: ratified
plus one citation, not Status: record. Caught by re-running
`doc-health --family ratified-provenance` after merging main (previous
commit): it named exactly this file, critical, "a review record that
records a ratification must carry Status: ratified and one citation."

Fixed in the same shape a sibling packet's ratification record was
independently corrected into a few hours earlier the same morning
(archive/2026-09-10-amend-neutral-product-pin-interim-copy-vocabulary/
review/ratification-2026-09-09.md, re-derived on Brett Heap's own ruling of
the identical defect): H1 "# Proposal Ratification: <change>", Status:
ratified, Kind: report, Decision date:, Ratifier:, and a Ratified: citation
line carrying the actual word. Nothing normative moves — the ratifier, the
verbatim word, the head, and everything ratified by this record are
unchanged; only this record's own standing metadata is corrected.

Also folds in two other corrections found while re-verifying, both already
named in the file's own Addendum: the ratification commit's message
mis-stated `openspec validate --all --strict`'s exit code as 0 (a piping
bug in the verifying command swallowed the real code; it is 1, this
repository's standing baseline, unchanged by this diff — 98 passed/3
failed post-merge vs 97 passed/3 failed on origin/main alone, same three
pre-existing unrelated failures); and the prior commit's merge-from-main
to resolve a README.md adjacency conflict with the newly-archived
amend-neutral-product-pin-interim-copy-vocabulary row.

Re-verified: doc-health --family ratified-provenance no longer names
anything in this packet (28 pre-existing/unrelated critical findings
remain elsewhere, down from 29 with this file's own fixed); --family
status-validity unchanged (1 pre-existing/unrelated, not this packet);
openspec validate accept-sequenced-after-header-line --strict exit 0.

Lane: codexfactory-1
Co-Authored-By: Claude Sonnet 5 <[email protected]>
brettheap added a commit that referenced this pull request Sep 10, 2026
origin/main moved 804a917 -> b91af6e while the ratification encode was being
written and verified, and the pull request went CONFLICTING. Taken here so the
re-measure is owed at THIS act and not at landing.

ONE CONFLICT, IN THE README OpenSpec Records BLOCK, AND IT IS PURE ADJACENCY.
main archived amend-neutral-product-pin-interim-copy-vocabulary (removing its
row) and added accept-sequenced-after-header-line's row at the top of Active
changes; this branch had replaced the amend-modified-block-currency-standing
row's content in the same region. RESOLVED BY KEEPING BOTH ROWS -- main's new
row first, byte-for-byte as main states it, then this branch's ratified row
byte-for-byte as the ratification commit c95b9e5 wrote it. Neither row's text
is edited by this merge, and the archived packet's row stays removed as main
removed it. tests/sequenced_after/corpus-ledger.yaml auto-merged: both sides
added one row and both rows are present (accept-sequenced-after-header-line
moved_by #886, amend-modified-block-currency-standing moved_by #887).

WHAT main BRINGS THAT THIS BRANCH DID NOT HAVE, and why the re-measure matters:
#890's doc-health change (the ratified-provenance SUBJECT arm, issue #878) and
#886's realization of scripts/proposal-support.py, scripts/sequenced_after.py
and scripts/frontmatter_strict.py. Every gate figure in
review/verification-2026-09-10.md was taken against the pre-merge versions of
those, so all of them are re-run on this merged tree and the result is recorded
as an ADDENDUM to that capture rather than as an edit to its figures -- the same
shape f8b3b79 used on main earlier today for a same-day re-measure of a dated
one-shot record.

NOTHING OF THIS PACKET MOVES IN THIS COMMIT: no delta byte, no promoted
specification, no record body, no .openspec.yaml field, no task box.

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
brettheap added a commit that referenced this pull request Sep 10, 2026
…own path (#887)

origin/main moved 804a917 -> b91af6e while the ratification encode c95b9e5
was being written and verified, and the pull request went CONFLICTING. The merge
was taken at 2e84325; this commit records what the gates say on the merged tree.

A SECOND RUN WRITES A DIFFERENT PATH. Both runs fall on 2026-09-10, so the paths
are distinguished by suffix rather than by date:
review/verification-2026-09-10.md is PRESERVED BYTE-FOR-BYTE as c95b9e5 wrote
it -- it is the record of the pre-merge tree, keeps Status: record, and is
neither superseded nor deleted -- and the current measurement is
review/verification-2026-09-10-post-merge.md. The first capture gains an ADDENDUM
that only POINTS at the second and answers its own forward-looking "merge from
main: NONE OWED" row; not one measured figure in it is edited. That is
document-lifecycle's one-shot-capture rule (#870 bench T7/T9) applied literally.

THE RE-MEASURE WAS NOT A FORMALITY: main moved three of the gates themselves.
#890 (804a917) added ratified-provenance's SUBJECT arm (#878), which reads a
review/ratification-* record whatever status it carries -- the pre-merge tree's
doc_health predated it, so the first capture's ratified-provenance figures were
taken WITHOUT the arm that scores this packet's own new ratification record.
#886 rewrote scripts/proposal-support.py (+657 lines), scripts/sequenced_after.py
and scripts/frontmatter_strict.py, and added one sweep-ledger row.

RE-RUN FROM ZERO ON 2e84325: openspec validate
amend-modified-block-currency-standing --strict valid, exit 0; --all --strict
exit 1 with 99 passed / 3 failed (102 items) and the failure SET IDENTICAL to
origin/main b91af6e's 98 passed / 3 failed (101) -- same three pre-existing
items, this change the one extra and it PASSES; proposal-support verify ok
against main's NEW implementation; validate-sequenced-after passed (40 active,
10 declaring) with the ledger consistent at 193 rows and both sides' rows
present; --ledger-diff clean; validate-scope-globs passed; doc-health
--single-repo exit 0, 32 critical / 5 error / 47 warning / 14 info, 0 new
regressions, this change named 0 times; ratified-provenance 28 critical, NONE
this change, of which 21 are the #878 subject arm on OTHER packets' records --
this packet's ratification record enters that population and CLEARS it, having
carried Status: ratified plus exactly one citation from its first commit;
record-immutability 4 critical (all docs/), status-validity 1 error, neither
this change; modified-block-currency all seven classes 0 on this block with
marker defects: 0; pytest tests/sequenced_after tests/scope_globs
tests/doc-health 2036 passed, and tests/proposal-support 128 passed / 67
subtests, run because main rewrote the gate that suite covers.

THE CONTROL THAT CARRIES THE ATTRIBUTION. The critical count rose 11 -> 32
between the two captures and NONE of the rise is this packet's: it is main's own
standing population, newly VISIBLE rather than newly created (#877 measured
fourteen archived records out of contract with zero findings). Proven by running
doc-health on d5d8a2f3 -- ab8247f with b91af6e merged in and the README
resolved identically, i.e. the DRAFT packet on the SAME main -- and diffing the
finding lines: IDENTICAL, 98 lines on both sides. The encode adds zero findings
and removes zero.

NOTHING OF THE PACKET MOVES IN THIS COMMIT EITHER: no delta byte, no
.openspec.yaml field, no citation line, no task box's state. tasks.md gains 4.9
naming the second capture, the README row's records list cites both, and no box
opens or closes. tasks.md section 5 and 6.1-6.2 stay OPEN.

Refs #857, refs #858

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

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

The out-of-surface residue named in this PR's landing provenance (scripts/doc_health/ideation_routing.py _governed_repo_ids docstring still says a root-level product can never appear in repo_paths) is FILED UNCLAIMED as #901 (2026-09-10T15:16Z, Brett Heap's word "file the two residues as unclaimed").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants