Skip to content

doc-health nudges staged topics toward the outline template, and never blocks - #193

Merged
brettheap merged 1 commit into
mainfrom
build/staged-topic-template-nudge
Aug 15, 2026
Merged

brettheap merged 1 commit into
mainfrom
build/staged-topic-template-nudge

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Builds tasks 2.1-2.3 of the ratified add-staged-topic-outline-template: a
staged-topic-template family that reports a primary fragment missing the
three required sections, or an open question missing any of its four
sub-fields.

NEVER GATE-BLOCKING, deliberately and by construction. Q2's ruling was
"doc-health treats non-conformance as a nudge, never a gate-blocking finding",
so every finding is WARNING even where conformance is REQUIRED. The
required/opt-in distinction lives in the rule TEXT — which is what a reader
acts on — rather than in a severity that would fail a run under
--fail-on error. The code says escalation needs a new ruling rather than a
judgement call, test_non_conformance_is_never_gate_blocking asserts it, and
the real corpus proves it: the full run exits 0 with 29 new warnings and no new
errors.

OBLIGATION FOLLOWS THE STAGING DATE, which needed a new git primitive.
last_commit_date is the wrong signal by exactly the failure task 2.2 names —
editing an opt-in topic for an unrelated reason would silently make it
required. Added first_commit_date: age uses the last touch, obligation uses
the first. An unknown date is treated as opt-in, never required.

THE SELECTOR IS MIRRORED, NOT REINVENTED. _primary_fragment reproduces
primaryFragmentPath from wheel-model.js exactly — the exact <topic>.md
first, else the shallowest markdown, path-only and never content-sniffed — so
the checker and the wheel cannot disagree about which file a topic's outline
IS. That one-path rule is the property Q1 preserved rather than extended.

FENCE-AWARE, for the third time this week. The canonical template ships as a
copy-pasteable FENCED skeleton, so a fragment that merely quotes it has not
adopted it; headings and sub-fields are read outside fences only. A test pins
that a quoting fragment is still reported for all three sections.

Measured against the real corpus, which is the useful validation:

  • notebook-projection-identity — the first topic authored to the template —
    is CLEAN, 0 findings;
  • 28 pre-existing topics report opt-in;
  • exactly 1 reports REQUIRED (substantive-review-lane-questions, staged
    today after ratification, missing idea-notes and conflicts).

Gates: pytest tests/doc-health tests/proposal-support 668 passed / exit 0;
doc-health full run exit 0, errors unchanged at 6, warnings 30 -> 59 (all 29
this family's own, enumerated above rather than counted); openspec validate --all --strict 61/61.

The change stays ratified-but-unrealized: tasks 1 (the contract text) and 3
(the outline tab) are still open, so no Realized: line is claimed.

Co-Authored-By: Claude Opus 5 [email protected]

🤖 Generated with Claude Code

…r blocks

Builds tasks 2.1-2.3 of the ratified `add-staged-topic-outline-template`: a
`staged-topic-template` family that reports a primary fragment missing the
three required sections, or an open question missing any of its four
sub-fields.

NEVER GATE-BLOCKING, deliberately and by construction. Q2's ruling was
"doc-health treats non-conformance as a nudge, never a gate-blocking finding",
so every finding is WARNING even where conformance is REQUIRED. The
required/opt-in distinction lives in the rule TEXT — which is what a reader
acts on — rather than in a severity that would fail a run under
`--fail-on error`. The code says escalation needs a new ruling rather than a
judgement call, `test_non_conformance_is_never_gate_blocking` asserts it, and
the real corpus proves it: the full run exits 0 with 29 new warnings and no new
errors.

OBLIGATION FOLLOWS THE STAGING DATE, which needed a new git primitive.
`last_commit_date` is the wrong signal by exactly the failure task 2.2 names —
editing an opt-in topic for an unrelated reason would silently make it
required. Added `first_commit_date`: age uses the last touch, obligation uses
the first. An unknown date is treated as opt-in, never required.

THE SELECTOR IS MIRRORED, NOT REINVENTED. `_primary_fragment` reproduces
`primaryFragmentPath` from wheel-model.js exactly — the exact `<topic>.md`
first, else the shallowest markdown, path-only and never content-sniffed — so
the checker and the wheel cannot disagree about which file a topic's outline
IS. That one-path rule is the property Q1 preserved rather than extended.

FENCE-AWARE, for the third time this week. The canonical template ships as a
copy-pasteable FENCED skeleton, so a fragment that merely quotes it has not
adopted it; headings and sub-fields are read outside fences only. A test pins
that a quoting fragment is still reported for all three sections.

Measured against the real corpus, which is the useful validation:

  * `notebook-projection-identity` — the first topic authored to the template —
    is CLEAN, 0 findings;
  * 28 pre-existing topics report opt-in;
  * exactly 1 reports REQUIRED (`substantive-review-lane-questions`, staged
    today after ratification, missing idea-notes and conflicts).

Gates: `pytest tests/doc-health tests/proposal-support` 668 passed / exit 0;
doc-health full run exit 0, errors unchanged at 6, warnings 30 -> 59 (all 29
this family's own, enumerated above rather than counted); `openspec validate
--all --strict` 61/61.

The change stays ratified-but-unrealized: tasks 1 (the contract text) and 3
(the outline tab) are still open, so no `Realized:` line is claimed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 15, 2026 16:11

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

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@brettheap
brettheap merged commit 93f4241 into main Aug 15, 2026
1 check passed
@brettheap
brettheap deleted the build/staged-topic-template-nudge branch August 15, 2026 16:11

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.

Pull request overview

This PR adds a new doc-health family (staged-topic-template) that nudges staged topics toward a ratified outline template by emitting WARNING-only findings for missing required sections and incomplete open-question sub-fields, while ensuring it never becomes gate-blocking. It also introduces a new git primitive (first_commit_date) so “REQUIRED vs opt-in” is determined by the topic’s original staging date rather than its last edit.

Changes:

  • Add staged-topic-template family to detect missing outline sections and missing open-question sub-fields (fence-aware, primary-fragment selection aligned with the wheel’s selector).
  • Add first_commit_date() to git facts to distinguish “first staged” from “last touched” and wire it into the new family.
  • Add doc-health tests covering conforming fragments, warning-only severity, staging-date obligation behavior, and fenced skeleton behavior; update the change tasks checklist.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/doc-health/test_families.py Adds fixture-style tests for the new staged-topic-template family (including “never gate-blocking” and fence-aware parsing).
tests/doc-health/conftest.py Extends FakeGit to support first_commit_date() for hermetic tests.
scripts/doc_health/families.py Implements the staged-topic-template family, including primary fragment selection and template-gap detection.
scripts/doc_health/corpus.py Adds RealGit.first_commit_date() using git history to detect the first appearance of a relpath.
openspec/changes/add-staged-topic-outline-template/tasks.md Marks doc-health tasks 2.1–2.3 as completed and records the implementation notes.

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

Comment on lines +154 to +160
out = self._run(repo, "log", "--reverse", "--format=%cs", "--", relpath)
if not out:
return None
for line in out.splitlines():
if line.strip():
return date.fromisoformat(line.strip())
return None
"""Mirror of `primaryFragmentPath` in wheel-model.js: the exact
`<topic>.md` first, else the shallowest markdown file. Path-only, never
content-sniffed — the one-path rule this template contract preserves."""
mds = sorted(p for p in topic.rglob("*.md"))
brettheap pushed a commit that referenced this pull request Aug 21, 2026
The README row and the PR description disagreed about which PRs realized this
change. Neither list was right, so neither was adopted: the answer was
re-derived mechanically from gh pr view --json files, asking of every
candidate whether it edits a file under
openspec/changes/add-staged-topic-outline-template/.

Eight PRs pass that test and are this change's own chain: #193, #195, #198,
#208, #211, #217, #224, #227. The PR description omitted the first three -
they predate the session handoff it was written from - and wrongly claimed
#215, #221 and #222, which fail the test: each touches only its own change's
documents and code, so each belongs to align-demote-to-round-trip-rule,
refine-demote-round-trip-mechanics and align-status-reader-to-real-lines
respectively, all three of which already have archive records carrying their
own evidence. What #217 contributes here is task 4.2 and the archiving of the
first of them, not the fix.

The README row, the proposal banner and the tasks.md evidence section now
state the two categories explicitly and name the test, so the chain can be
re-derived rather than trusted. One exception is recorded rather than left to
surprise a reader: #228 also edited this change's tasks.md, to repoint 5.3 and
6.3 after the doxbench topic exited staging - a cross-change bookkeeping
repoint that discharges no task here.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
The README row and the PR description disagreed about which PRs realized this
change. Neither list was right, so neither was adopted: the answer was
re-derived mechanically from gh pr view --json files, asking of every
candidate whether it edits a file under
openspec/changes/add-staged-topic-outline-template/.

Eight PRs pass that test and are this change's own chain: #193, #195, #198,
#208, #211, #217, #224, #227. The PR description omitted the first three -
they predate the session handoff it was written from - and wrongly claimed
#215, #221 and #222, which fail the test: each touches only its own change's
documents and code, so each belongs to align-demote-to-round-trip-rule,
refine-demote-round-trip-mechanics and align-status-reader-to-real-lines
respectively, all three of which already have archive records carrying their
own evidence. What #217 contributes here is task 4.2 and the archiving of the
first of them, not the fix.

The README row, the proposal banner and the tasks.md evidence section now
state the two categories explicitly and name the test, so the chain can be
re-derived rather than trusted. One exception is recorded rather than left to
surprise a reader: #228 also edited this change's tasks.md, to repoint 5.3 and
6.3 after the doxbench topic exited staging - a cross-change bookkeeping
repoint that discharges no task here.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap added a commit that referenced this pull request Sep 2, 2026
…ed (2026-09-02 nightly), promoted (#571)

* Archive govern-sibling-added-modified-deltas: realized (#558), measured (2026-09-02 nightly), promoted

The archive act for `govern-sibling-added-modified-deltas`, ratified 2026-08-31
by direct ruling and realized on `main` by one Speckit branch carrying both of
its features. No behaviour changes: this promotes three deltas into canon, moves
the packet into `openspec/changes/archive/`, ticks the two gate sections that are
now true, and repairs the one link the move broke.

## § 8.1 — merged, re-verified from `main` rather than read off a PR page

Both landings re-confirmed ancestors of their own `origin/main` with
`git merge-base --is-ancestor` (exit 0 on each):

| what | merge | landed |
| --- | --- | --- |
| F1 + F2, in ONE feature branch | **`5af63d91`** (PR #558, 2026-09-01) | the `Modified over` marker form and its pairing class, the added-over-canon collision class, their class-map registrations, and two exact-set self-gate assertions each with its own positive control |
| the aggregation re-pin | **`9427a4df`** (xFactory root PR #193, 2026-09-01) | what put the two classes in front of the estate, and what made § 5's read possible |

## § 5 — the population read, from the aggregation and not from a local run

`doc-health-nightly` run **33574220723** (`opensoft/xFactory`, head `72562233`,
2026-09-02T00:10:32Z, conclusion `success`), report artifact
`doc-health-report-2026-09-02`, ten repositories in its `Repo-Identity` line.

| repository | sibling-pairing declaration | added-over-canon collision |
| --- | --- | --- |
| OpsxFactory | **2** | 0 |
| the other nine (openxFactory, codexFactory, AdxFactory, HealthLinc, LedgerxFactory, MedxChart, MedxEHR, MedxFactory, MedxPractice) | 0 | 0 |
| **estate** | **2** | **0** |

The two pairs are `adopt-bc-extension-owned-deploy` over
`widen-business-central-extension-lifecycle`'s addition of 'An install is done
only when a read proves it', and `amend-rider-heartbeat-secret-channel` over
`add-cloudpc-worker-fleet-management`'s addition of 'Ratified pilot
authentication, signing, and secret delivery'. **Brett Heap ruled the routing on
2026-09-02**: archive now on merged-and-green realization evidence, the
OpsxFactory population tracked as OWNER TASKS and NOT blocking this gate. No
per-repository issue was opened from the read — § 5.3 forbids that without a
ruling, and the ruling asked for the other route. **openxFactory's zero is D4's
sequencing holding, not an absence of shape**: § 6's marker sweep ran BEFORE the
class existed (`3a6a16e9`, PR #538), so the class launched at a population of
zero and the `+4 warning` figure was unreachable by construction.

## § 8.1 — green, measured before and after the act on base `bbbbeda9`

| gate | before the act | after the act |
| --- | --- | --- |
| `python3 -m pytest tests/doc-health -q` | **1384 passed, 0 failed** | **1384 passed, 0 failed** |
| `OPENSPEC_TELEMETRY=0 openspec validate --all --strict` | **83 passed, 0 failed** (30 active + 53 specs) | **82 passed, 0 failed** (29 active + 53 specs) |
| `doc-health.py --single-repo . --family modified-block-currency` | 0 critical, 0 error, **0 warning**, 8 info; 0 new regressions | 0 critical, 0 error, **0 warning**, 8 info; 0 new regressions |
| `--family promotion-fidelity` (basis: the pinned checkout) | — | **no findings** |
| full `doc-health.py --single-repo .` | 6 critical, 7 error, 29 warning, 14 info | 6 critical, 7 error, 29 warning, 14 info |

`-1` on `validate` is exactly what promoting one change predicts; the spec count
does not move because all three deltas land in specifications canon already
carries. **The gated family moves in NO band.** The whole diff of its report
either side of the act is FOUR lines and not one of them is a finding: canon
words 249830 -> 263957 (+14127), governance words 750121 -> 764248 (the same
+14127, moving from active-change prose into promoted prose), canon share
33.3% -> 34.5%, and the promoted-specs row. The FULL 23-family run says the same
thing at estate scale: normalising the repository label (the `before` run is a
detached worktree at `origin/main`, so it derives a different basename), the
whole report diff is TWO lines — the canon share and the promoted-specs word
count — and no finding moves in any family. All seven finding classes are
identical across the act — scenario-title 0, carriage ledger 8, title resolution
and ordering 0, marker defects 0, sibling-pairing 0, added-over-canon collision
0, unplaced-finding drift 0 — so `_LEDGER_SUBJECTS` and `_PAIRING_SUBJECTS` each
gain and lose no row and no `_moved()` message fires. **THE ORDER TAKEN WAS § 6
FIRST, so the figure this gate reads is `0 warning`, and that is what both
measurements returned** — the same figure PR #558 recorded either side of the
landing that introduced the classes.

Figures that moved since the packet was authored, recorded rather than smoothed:
PR #558's own gate line read `validate` **79** and `pytest` **1364 passed, 1
failed** (the `add-chain-attestation` carriage-ledger subject that had landed on
`main` without its `_LEDGER_SUBJECTS` row, since named there). The corpus moved
under both numbers; what is invariant is `0 failed` and the `0 warning` movement.

## § 8.3 — promotion verified per requirement, byte-for-byte, in all three capabilities

The check a packet about lossy promotion owes itself. Requirements were sliced
from `### Requirement:` to the next `### ` or `## ` heading and compared as
bytes.

| capability | requirements | scenarios | delta | verdict |
| --- | --- | --- | --- | --- |
| `release-realization` | 7 -> 7 | 18 -> 24 | 1 MODIFIED | the block REPLACED 'Ordered deltas and branch vocabulary' byte-for-byte; the other 6 requirements byte-identical, order unmoved |
| `document-lifecycle` | 17 -> 18 | 79 -> 87 | 1 ADDED | a PURE APPEND — canon-before is a strict byte PREFIX of canon-after |
| `doc-health` | 41 -> 43 | 196 -> 220 | 2 ADDED + 1 MODIFIED | the MODIFIED block replaced its requirement IN PLACE byte-for-byte; the 2 ADDED appended in delta order; the other 40 byte-identical, order unmoved |

**Nothing was dropped, nothing was reordered, and nothing needed a hand fix.**
`doc-health`'s canon-before is NOT a byte prefix of canon-after, and correctly
so: its MODIFIED block replaces the 39th of 41 requirements in place, so the
prefix test is the wrong test there and the per-requirement one is the right one.

Inside the `release-realization` replacement the promoted content is carried
whole and measured rather than asserted: the one promoted body paragraph and
BOTH promoted scenarios are byte-identical and still FIRST in their original
order, with SEVEN new body paragraphs and SIX new scenarios after them — exactly
the counts the delta's own preamble declared.

Inside the `doc-health` replacement, 33 of the 35 promoted units are restated
byte-identical and the other TWO are declared by a
`Removed from canon by govern-sibling-added-modified-deltas (2026-08-31):`
marker — the sentence asserting the family's absence from `FAMILY_RESOLUTION`
and the scenario bullet resting a MUST on it, both superseded inside the same
block. A declared deletion is not a carriage defect, which is why the currency
arm reads zero against this packet rather than eight, at the gate as at § 4.2.

`--family promotion-fidelity` returns no findings over the archived packet, and
that silence carries a POSITIVE CONTROL rather than being taken on trust:
renaming ONE promoted scenario title of the block this act promoted made the
family emit by name — `[error] …/2026-09-02-govern-sibling-added-modified-deltas/specs/release-realization/spec.md`,
*"requirement 'Ordered deltas and branch vocabulary' reached
openspec/specs/release-realization/spec.md without 1 of its 8 ratified
scenarios"* — and the perturbation was reverted, the tree re-read clean. The
control also fixes that family's REACH: it compares requirement and scenario
TITLES, not bodies, so it corroborates the byte-for-byte table above rather than
replacing it.

## What this act does NOT do

`Closes #502` — the three measured holes that issue named are now canon. The
FOUR questions are not all closed and this does not claim they are: § 7 travels
out open, with **OQ-4 the one exception, SPENT** — ruled 2026-08-31 as (a), one
sweep, and discharged by § 6 — and OQ-1, OQ-2, OQ-3 and OQ-5 still open. § 1's
two boxes describe a §7.4 sitting that was declined and do not tick; § 4.5 and
§ 4.6 record what the packet DECLINED to supersede. The band flip for both new
classes stays RESERVED (§ 7.4) and this archive does not take it.

One repair the move itself made necessary, on the precedent of `ded8b9f1`:
`docs/doc-health.md` linked the packet at its active path, which this commit
removes in the same act; retargeted to the archived packet, spelled with its
archive date as that document spells its other archived references.

Closes #502

Co-Authored-By: Claude Fable 5 <[email protected]>

* Move the sequenced-after sweep pin: 18 -> 17 active co-modified (this archive)

The pin this archive falls due on, moved by the route the assertion's own
message prescribes: re-derive with the shipped sweep, move the number, and
record in the MOVEMENT LOG which subject moved and why. ONE ROW MOVES AND NO
OTHER, and the docstring says which and on what evidence rather than the number
being silently re-typed.

`tests/sequenced_after/test_sweep.py::test_the_live_sweep_reproduces_the_AUTHORING_measurement`
went red on PR #571's `pytest-suite` (`assert 17 == 18`). Its message named the
cause in advance: "archiving a co-modified ACTIVE change lowers this count while
leaving `co_modified` untouched, and that is the EXPECTED cause of this
failure". That is exactly what happened.
`govern-sibling-added-modified-deltas` carried TWO `## MODIFIED Requirements`
blocks — over `release-realization`'s 'Ordered deltas and branch vocabulary' and
`doc-health`'s 'A modified-block-currency finding its own class map cannot place
is itself a finding' — so it was an ACTIVE co-modifier, and the archive moved it
out of the active corpus into the archived one. Same shape as #563's move on
2026-09-01, and for the same reason.

MEASURED ON BOTH SIDES rather than inferred from the failure —
`python3 scripts/validate-sequenced-after.py . --sweep`:

| reading | change ids | co-modified | sole | ACTIVE co-mod / sole |
| --- | --- | --- | --- | --- |
| `bbbbeda9` (`origin/main`) | 153 (30 active + 123 archived) | 104 | 49 | **18** / 12 |
| `da5882b4` (this branch) | 153 (29 active + 124 archived) | 104 | 49 | **17** / 12 |

EXACTLY ONE of the test's pins moves. Every other assertion re-derives
unchanged and was checked one by one, not assumed: `co_modified` 104,
`change_ids == active + archived`, `sole_modifiers == change_ids - co_modified`,
`change_ids - 1 == 152`, `sole_modifiers - 1 == 48`, `active_sole - 1 == 11`,
3 prose headers (3 archived), 1 declaration
(`add-sequenced-after-substrate`), 0 root claims, deepest chain 1.
`active_sole` is untouched at 12 — the archive removed a CO-modified active and
never a sole one — so the `- 1` still subtracts `add-sequenced-after-substrate`
alone and still recovers the authoring 11. The corpus-wide totals hold because
an archive moves a change between buckets without changing the population.

`python3 -m pytest tests/sequenced_after -q`: 118 passed, 0 failed.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants