Repository navigation
Compare archived spec deltas to promoted specs: the eighteenth doc-health family, advisory at launch - #310
Conversation
… reaches canon `openspec --strict` validates a spec delta's SHAPE, never its ARRIVAL, and the four lifecycle families read a change packet's headers rather than its bodies. So a ratified requirement could archive and silently never reach `openspec/specs/<capability>/spec.md` while every check in the corpus called the repository healthy — which is exactly what happened to codexFactory's `2026-08-08-activate-nightly-sweep-council-clearance` between 2026-08-08 and 2026-08-24, and what `docs/archive-record-discrepancies.md` § FU-DOM-CODEX left open by name after PR #85 applied the delta: "no check yet compares archived deltas to promoted specs, so the class stays unreported." `document-lifecycle` gains the obligation itself, because a checker with no promoted rule behind it is a rule invented in Python. Three clauses, each carrying its own reason: a ratified delta's requirement and every scenario under it reach canon (and a REMOVED one leaves it); a packet whose own proposal does not claim ratification carries archived design evidence instead, which is how C5's `--skip-specs` decision is actually recorded; and the most recent archived delta is the authority for a requirement, because a later ratified change rewriting an earlier one is canon being correct. `doc-health` gains the eighteenth deterministic family and the requirement defining how it checks that obligation — the three resolution rules, the disposition mechanism, and the advisory launch in both of its halves. Co-Authored-By: Claude Fable 5 <[email protected]>
…y's own archive The check runs, and on its first pass over openxFactory it reports two findings — both against the archived, ratified `2026-08-01-add-workbench-branch-sessions`. Its ADDED requirement `Branch-session notebooks` is absent from `openspec/specs/lifecycle-notebook-projection/spec.md` entirely, and its MODIFIED `Corpus scan scope` arrived carrying three of the four scenarios it ratified. Same class as the codex gap, in the neutral repository, found on the first run. Reported and deliberately not fixed: applying a ratified delta to canon is a governance act belonging to its own change, which is what codexFactory PR #85 was. Three resolution rules do the work, and each one is measured against a false positive this corpus really contains rather than reasoned about. Latest writer wins: 478 distinct capability/requirement pairs, 59 written more than once, `doc-health`'s own "Deterministic check families" written TEN times between 2026-07-09 and 2026-08-24 — per-writer checking fires 20 findings where this fires 2, and the other 18 are superseded text canon is right to have moved past. A RENAMED block retires the title it names, because `openspec archive` applies RENAMED before MODIFIED. And a delta is checked only where its own proposal claims ratification, which exempts C5's twelve and nothing else: 88 of 89 delta-carrying archived changes read `ratified`, one reads `draft`. Ties are real — 19 pairs are written twice or more on their latest date — so the tie-break is not decoration. It is the packets' archive-commit order, because folder-name order was measured against it across all 19 groups and disagreed on six; folder name is the disclosed fallback for a checkout with no history, and a test runs one fixture both ways and asserts the two runs disagree, so the fallback's cost is measured rather than assumed harmless. Advisory at launch, in both halves. Every finding is `warning`, and the family is deliberately absent from `FAMILY_RESOLUTION` — a `contested` finding that vanishes between reports becomes an `error` under `uncited-resolution`, so classifying it that way would have gated the nightly the first time anyone promoted a delta this family reported, through the back door and under a family name that does not say what happened. `test_every_family_is_classified_as_reader_or_non_reader` failed loudly on this registration, by name, which is what it was built to do; the eighteenth family is classified a non-reader of the lifecycle scan set and the arithmetic advances from thirteen to fourteen. Co-Authored-By: Claude Fable 5 <[email protected]>
The README's OpenSpec Records block is where an active change announces itself, and the entry carries the measurements rather than the summary: the three resolution rules with the false-positive counts each prevents, the exemption's 88-of-89 tuning, and the two live findings the check raises against this repository's own archive on its first run. 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
Implements the new doc-health deterministic family promotion-fidelity, which detects when ratified archived OpenSpec spec deltas did not fully arrive in the corresponding promoted openspec/specs/<capability>/spec.md (including missing requirements, missing scenarios, and removals that never landed). This closes the prevention gap recorded in the archive discrepancy register and adds supporting contract deltas, registration, and regression fixtures/tests, while keeping the family advisory at launch.
Changes:
- Adds
scripts/doc_health/promotion_fidelity.pyand registers the new eighteenth doc-health family (promotion-fidelity) with WARNING-only launch semantics and dispositions support. - Extends git metadata support with
RealGit.first_commit_timestamp()(andFakeGitshim) to break same-day archive-date ties using archive-commit ordering. - Introduces a comprehensive
tests/doc-healthfixture corpus and test suite covering true positives, false-positive suppressors (latest-writer-wins / RENAMED / Status-based exemption), advisory launch structure, and tie-break fallback behavior.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/doc-health/test_promotion_fidelity.py | New unit/regression suite validating promotion-fidelity findings, suppressors, advisory launch invariants, and tie-break behavior. |
| tests/doc-health/test_lifecycle_scan_set.py | Registers promotion-fidelity as a NON_READER and updates the NON_READERS count arithmetic and assertions. |
| tests/doc-health/conftest.py | Extends FakeGit with first_commit_timestamp() and fixture-controlled timestamps for tie-break tests. |
| scripts/doc_health/promotion_fidelity.py | Implements the new family: delta parsing, promoted parsing, authoritative writer resolution (incl. tie-break), dispositions support, and finding emission. |
| scripts/doc_health/families.py | Imports and registers promotion-fidelity in FAMILIES; updates module docstring to avoid drifting hardcoded counts. |
| scripts/doc_health/corpus.py | Adds RealGit.first_commit_timestamp() to support same-day tie breaking at sub-day resolution. |
| scripts/doc_health/init.py | Adds promotion-fidelity to FAMILY_IDS so it renders its own report section. |
| README.md | Records the active change add-promotion-fidelity-check in the “Active changes” list with rationale and launch semantics. |
| openspec/changes/add-promotion-fidelity-check/tasks.md | Defines and tracks the change’s tasks, including the explicit open box for flipping advisory→enforcing later. |
| openspec/changes/add-promotion-fidelity-check/specs/document-lifecycle/spec.md | Adds the governing lifecycle obligation that ratified deltas must reach promoted specs, with the Status-based exemption rules. |
| openspec/changes/add-promotion-fidelity-check/specs/doc-health/spec.md | Updates doc-health contract to 18 families and adds the promotion-fidelity family requirement + advisory-at-launch constraints. |
| openspec/changes/add-promotion-fidelity-check/proposal.md | Provides the proposal narrative, evidence, orchestrator decisions, and measured impact for the new family. |
| openspec/changes/add-promotion-fidelity-check/design.md | Captures the measured design decisions behind the family (latest-writer, tie-break, exemption, advisory launch). |
| openspec/changes/add-promotion-fidelity-check/.openspec.yaml | Records change metadata for OpenSpec tooling and approval provenance. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/tiebreak/spec.md | Promoted-spec fixture for same-day tie-break behavior (canon reflects archive-commit ordering, not folder-name ordering). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/removed-capability/spec.md | Promoted-spec fixture for REMOVED-direction fidelity (canon incorrectly still contains a removed requirement). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/ontology/spec.md | Promoted-spec fixture for latest-writer-wins and RENAMED suppressor negatives. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/notebook-projection/spec.md | Promoted-spec fixture reproducing a missing-requirement and missing-scenario scenario. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/merge-master-approval/spec.md | Promoted-spec fixture reproducing the historical “missing scenarios” shape (codex regression). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/specs/clean-capability/spec.md | Promoted-spec fixture for a clean negative where the delta fully arrived. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-08-activate-nightly-sweep-council-clearance/specs/merge-master-approval/spec.md | Archived delta fixture containing the six-scenario MODIFIED requirement that canon partially lacks. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-08-activate-nightly-sweep-council-clearance/proposal.md | Marks the archived packet as Status: ratified for inclusion in arrival checking. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-02-rename-workbench-view/specs/ontology/spec.md | Archived delta fixture with RENAMED + MODIFIED to validate title retirement semantics. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-02-rename-workbench-view/proposal.md | Ratified proposal fixture for the rename packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-01-add-branch-sessions/specs/notebook-projection/spec.md | Archived delta fixture containing ADDED + MODIFIED statements that canon fails to fully reflect. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-08-01-add-branch-sessions/proposal.md | Ratified proposal fixture for the branch-sessions packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-30-refine-ontology/specs/ontology/spec.md | Later-writer delta fixture that supersedes an earlier scenario and should suppress findings. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-30-refine-ontology/proposal.md | Ratified proposal fixture for later ontology refinement. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-20-zeta-earlier/specs/tiebreak/spec.md | Same-day tie fixture delta (folder name sorts last but is archived first). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-20-zeta-earlier/proposal.md | Ratified proposal fixture for the earlier archived tie participant. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-20-alpha-later/specs/tiebreak/spec.md | Same-day tie fixture delta representing the later archive act. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-20-alpha-later/proposal.md | Ratified proposal fixture for the later archived tie participant. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-06-remove-requirement/specs/removed-capability/spec.md | Archived REMOVED delta fixture that should have removed a canon requirement but did not. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-06-remove-requirement/proposal.md | Ratified proposal fixture for the removal packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-05-clean-change/specs/clean-capability/spec.md | Archived delta fixture that fully arrives in canon (clean negative). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-05-clean-change/proposal.md | Ratified proposal fixture for the clean packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-02-add-workbench-view/specs/ontology/spec.md | Earlier-writer delta fixture whose title is later retired by a rename. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-02-add-workbench-view/proposal.md | Ratified proposal fixture for the earlier workbench-view packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-01-add-ontology-layer/specs/ontology/spec.md | Earlier-writer delta fixture whose extra scenario is later removed by a rewrite. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-07-01-add-ontology-layer/proposal.md | Ratified proposal fixture for the earlier ontology-layer packet. |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-06-26-enable-live-legacy/specs/live-runtime/spec.md | Archived delta fixture for the Status-based exemption (draft packets are not checked). |
| tests/doc-health/fixtures/promotion-fidelity/alphaFactory/openspec/changes/archive/2026-06-26-enable-live-legacy/proposal.md | Proposal fixture with Status: draft to validate the ratification exemption. |
| tests/doc-health/fixtures/promotion-fidelity-no-archive/betaFactory/openspec/specs/solo/spec.md | Fixture repo with promoted specs but no archive, used to validate skip-with-notice behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…igation is canon The five realization merges are all on main and each was re-verified an ancestor of it at this gate - PRs #310 73766b4, #315 1274b9b, #316 51a875a, #320 055a514, #325 44505d1 - so the merge-plus-green rule the packet declared is satisfied and the archive act is this separate later commit, following govern-openspec-corpus-membership. The gate halted twice before it ran. The first halt found this packet's own doc-health delta restating one scenario of an eight-scenario MODIFIED requirement, which would have destroyed the other seven on promotion. While that was being repaired, main archived add-release-inventory-drift-check (b03b999) - the same defect, found independently the same day and ruled on by Brett, whose account now stands in canon as the CORRECTED 2026-08-25 paragraph. That sibling's delta had been written on top of this change's text, so canon moved: nineteen families, not eighteen, with this change's own amendments already inside it. The branch was reset to the new origin/main and every artefact re-derived against it rather than merged. The faithful MODIFIED block is therefore current canon verbatim - SHA-256 57cfc188905dc9926ebb9a9570db98d5bd419184409a91b83e56045fba27bf0b, all eight scenarios identical scenario-by-scenario and in canon's order. Archived as drafted it would have destroyed the seven scenarios and regressed the enumeration to eighteen, dropping release-inventory drift, its paragraph, its AND bullet, and Brett's CORRECTED paragraph. The act is verified by requirement map rather than by the CLI's summary: doc-health 26 -> 28 requirements and 105 -> 116 scenarios; document-lifecycle 14 -> 15 and 63 -> 68. Nothing removed from either, all 26 and all 14 pre-existing requirements byte-for-byte identical across the act, both promoted files pure additions with zero deletions. Closing symmetry: the enforcing family over openxFactory at --fail-on error reads 0 findings, exit 0, both before and after - the family that reports an unarrived delta says nothing about the delta this act just landed - and the packet's header still parses at its new archived path, Status: ratified with the record-citing Ratified: line clearing approver and date inside the 15-line window. Post-archive gates: openspec validate --all --strict 76 passed 0 failed (one fewer active), pytest tests/doc-health 874 passed 1 failed (the enumerated environment artifact, unmoved), pytest -k workbench 140 passed. The full single-repo report's findings are byte-identical to the baseline and exactly two per-stage numbers moved, both predicted: standard 10851 -> 11102 for docs/doc-health.md's own new words, and promoted specs 121304 -> 123563 for the census taking in what this act promoted. Task 5.2 ticks with its three arrivals; task 5.5 records that promotion fidelity is structurally blind to this damage class, because latest-writer-wins makes a destroying delta look faithful the instant it lands - a named candidate for a pre-archive restatement-completeness check, not built here. Also named, not fixed, and owed to the codex-archive lane rather than to this one: ideation/cross-reference.yaml pins source_revision f13a3b6, PR #322's branch tip, which is not an ancestor of main. The merged commit is 4e57009. Co-Authored-By: Claude Fable 5 <[email protected]>
The commissioning ruling
Brett, in-session 2026-08-24, verbatim: "commission the archived-delta-vs-promoted-spec check".
It takes the prevention
docs/archive-record-discrepancies.md§ FU-DOM-CODEX left open by name when codexFactory PR #85 applied a ratified delta that had sat unpromoted since 2026-08-08:openspec --strictvalidates a delta's SHAPE, never its ARRIVAL, and the four lifecycle families read a change packet's headers rather than its bodies. So a ratified requirement could archive and silently never reach canon while every check in the corpus called the repository healthy.document-lifecyclegains the obligation (ADDED: Ratified spec deltas reach the promoted specification) — because a checker with no promoted rule behind it is a rule invented in Python.doc-healthgains the eighteenth deterministic family (MODIFIED family count + ADDED Promotion fidelity of archived spec deltas) and the implementation lands in-change.FOUR ORCHESTRATOR DECISIONS — FLAGGED FOR VETO
The commissioning ruling covers the decision to build the check and nothing else. The four below were taken by the orchestrating session under standing patterns. They are named here the way codexFactory PR #83 named its two dispositions: taken, applied, reversible on a word.
D1 — Latest writer wins, tie-broken by archive-commit order
For a (capability, requirement title) pair, only the MOST RECENT archived delta is authoritative.
doc-health/ "Deterministic check families", 2026-07-09 → 2026-08-24)The 18 suppressed are superseded text canon is correct to have moved past.
The tie-break is not decoration: 19 pairs are written twice or more on their latest date, and 3 of those are load-bearing (the choice changes whether a finding fires). Folder-name ascending was MEASURED against real archive-commit order across all 19 groups and disagreed on six. It happens to agree on all three load-bearing ones — which is a fact about today's corpus, not a rule, and this corpus has already paid once for resting a rule on "nothing occupies the gap" (
govern-openspec-corpus-membership's ownEVIDENCE_PARTSnote). So the rule is archive-commit order from git, with folder name as the disclosed fallback for a history-less checkout, and a test runs one fixture both ways and asserts the runs disagree — the fallback's cost is measured, not assumed harmless.A
RENAMEDblock retires the title it names (openspec archiveapplies RENAMED before MODIFIED). Without it,ideation-dashboard's "Staging workbench scoped view" fires against all three of its earlier writers.D2 — The exemption is the archived proposal's own
Status:headerA delta is checked for arrival only where its own
proposal.mdreadsStatus: ratified. Not an invented marker — it is how the C5 decision is actually recorded.2026-06-26-enable-live-openxfactorywas archived by Brett's own PR #28 with--skip-specs, and its 2026-08-23 supersession addendum backfilled exactly one line to say so in the corpus's vocabulary:Precisely tuned, not convenient: of 89 archived changes carrying spec deltas, 88 read
ratifiedand exactly ONE readsdraft— C5's. The exemption suppresses 12 would-be findings, all four of C5's capabilities, and nothing else. It is read throughcorpus.parse_status, the ONE lifecycle header reader, so this family does not become the eighth reader of a header seven readers already disagreed about. The reasoning is also honest rather than mechanical: the obligation to promote attaches to a claim of approval, and a packet that never claimed ratification never incurred it.Second exemption: the existing
health/dispositions.yamlmechanism, extended with an optionalrequirement:key in the shape the neutrality lane'scontent_sha256already set. Never a label, title, or prose claim.D3 — Report-only at launch, and BOTH halves of that
Every finding is
warning, so no--fail-onconfiguration can red on this family (staged-topic-templateis the house precedent for exactly this shape).The less obvious half: the family is deliberately absent from
FAMILY_RESOLUTION, so its findings are NOTcontested.report.uncited_resolutionsturns a contested finding that vanishes between reports into anerrorunderuncited-resolution— so classifying it that way would have gated the nightly the first time anyone actually promoted a delta this family reported: enforcement through the back door, on the very run that proves the advisory launch worked, under a family name that does not say what happened.auto-fixableis also defensible on its merits: PR #85 demonstrated the remedy is a byte-level application of already-ratified text ("the packet's delta hashed identical to the archived delta, and the requirement block extracted from canon after promotion diffs identical"). The governance judgement lives in the action line a reader acts on.The flip is
tasks.md§4 — an OPEN box, not a silent later commit, and it raises severity AND adds the contested entry together, because either half alone yields a half-enforcing family nobody chose. §4.3 carries the ordering constraint the campaign established: discharge the standing population first, because "a gate that goes red on the commit that introduces it teaches everyone to route around the gate."D4 — The finding lands on the archived delta's path, not the promoted spec's
The delta is the document that made the claim that went unmet; its path is stable because an archived record does not move, where a promoted spec is edited constantly; and a disposition has to key on something still there next month. The promoted spec is named in the rule text, which is what a reader acts on.
Acceptance evidence, both directions
It fires — including on THIS repository, on the first run
The reconstructed historical true positive.
tests/doc-health/fixtures/promotion-fidelity/freezes the SHAPE of codexFactory's pre-#85 gap — a ratified MODIFIED delta of six scenarios against a promoted spec carrying two — and the family reports it, naming all four absent scenarios. A reconstruction rather than a dependency: this repository cannot read the codex checkout.The real live instance. Run against openxFactory's own archive, the family reports two findings — both against the archived, ratified
2026-08-01-add-workbench-branch-sessions:openspec/specs/lifecycle-notebook-projection/spec.mdcarriesBranch-session notebooks, 5 scenariosCorpus scan scope, 4 scenariosA canon book is offered a branch session's draftsis absentSame class, in the neutral repository, found on the first pass. Reported and deliberately NOT fixed — applying a ratified delta to canon is a governance act belonging to its own change, exactly as PR #85 was. Recorded as
tasks.md§5.1.The known negatives stay quiet
Status: draftpacket declares four requirements across a capability with no promoted spec at all — the loudest possible shape — and the family says nothing. A mutation guard flips that header toratifiedin atmp_pathcopy and asserts the findings appear, so the exemption is provably what does the silencing.test_latest_writer_wins_is_load_bearingmeasures the delta rather than asserting silence: it computes what per-writer checking would report on the same fixture and asserts the two disagree.FAMILY_RESOLUTION).Validator and test output
python3 -m pytest tests/doc-healthpython3 -m pytest tests/ideation-dashboard -k workbenchdoc_healthacrosstests/ideation-dashboard,tests/client-identity-roster,tests/notebooklmOPENSPEC_TELEMETRY=0 openspec validate add-promotion-fidelity-check --strictOPENSPEC_TELEMETRY=0 openspec validate --all --strictSelf-gate — the checker passes its own scan.
python3 scripts/doc-health.py --single-repo . --as-of 2026-08-24, measured on a cleanorigin/maincheckout and again on this branch:The ranked-plan diff is exactly two lines, both the promotion-fidelity findings above. The canon-share headline, the per-stage census, the inventory and the catalog are byte-identical — the family reads archived deltas and promoted specs, so it takes neither document set and moves no measurement. The 4 critical / 8 error are pre-existing and identical in both runs (record-immutability, location-conformance, proposal-origin, status-validity), and
--fail-on errorexits 1 on the baseline too.test_every_family_is_classified_as_reader_or_non_readerfailed loudly on the registration commit, by name — which is what that test was built to do — and the eighteenth family is now classified a non-reader with the arithmetic advanced from thirteen to fourteen.Ships ACTIVE, not archived
code_surfaceis real, so the release-realization rule applies and the precedent isgovern-openspec-corpus-membership: its enforcement landed in7157fa3e/bf0bda01and its archive act was a separate later commit,01ff3434, titled for the merge it followed. This change therefore stays active;tasks.md§6 carries the archive box.Recorded, not fixed
docs/doc-health.md's check-family table stops at twelve; families 13–17 were added by spec delta and never reached it. Not repaired here, on the reasoningscripts/doc_health/__init__.pyalready records for the sectionlessproposal-originfamily.python3 -m pytest tests(the whole directory at once) fails collection on a duplicate basename,test_header_value_readers.pyin two directories. Verified pre-existing on a cleanorigin/maincheckout with no working-tree changes.🤖 Generated with Claude Code