instar 1.3.972 → 1.3.974

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,147 @@
1
+ # Side-Effects Review — honest denominators, part two: the standards-enforcement audit
2
+
3
+ ## Summary of the change
4
+
5
+ Five honesty defects in ONE instrument — the standards enforcement-coverage audit — all found by
6
+ the convergence-towards-coherence audit (2026-07-25) while measuring the instrument that measures
7
+ our constitution. Live evidence: `GET /conformance/coverage/health` on this machine returned
8
+ `{converged: true, total: 22, enforcedRatio: 0.0455}` while `docs/STANDARDS-REGISTRY.md` in the
9
+ source repo carries **81** article headings. Re-run over the real registry: `total: 80`,
10
+ `enforcedRatio: 0.5375`. The reported figure was 12× more alarming than reality and was quoted to
11
+ the operator as fact.
12
+
13
+ **A. `enforcedRatio` fabricated a ratio with no denominator.** `total === 0 ? 0 : …` returned `0`
14
+ — "0% of standards enforced", a measurement nobody had taken. Now `number | null`, with the type
15
+ telling callers not to coerce.
16
+
17
+ **B. Family detection was a hardcoded five-name allowlist**
18
+ (`The Root|The Substrate|Building|Shipping|Interaction`). The registry has SIX standards families;
19
+ every article under `## The Fractal — the framework that develops itself` was silently dropped
20
+ (currently the Self-Hosting standard). Replaced with structural detection: a `##` section is a
21
+ family iff ≥1 `###` under it carries a `**Rule.**`. The prose sections (Why this exists, Genesis,
22
+ Two layers, How a new standard joins, The Stakes) carry no rule lines and are excluded
23
+ automatically — same exclusion the allowlist achieved, with no list to maintain.
24
+
25
+ **C. The parse canary's floor could not detect a fourfold collapse.**
26
+ `MIN_EXPECTED_ARTICLES = 15`, commented "far below the real ~21", never moved as the registry grew
27
+ to 81 — so it would pass while 65 of 81 articles vanished. Added a completeness check:
28
+ `droppedHeadings` (headings inside a detected family with no rule line) fails the canary and names
29
+ each loss. The floor is retained, documented as a coarse backstop only.
30
+
31
+ **D. `converged: true` sat bare beside the ratio.** It only ever meant "the deterministic pass is
32
+ stable on unchanged inputs". Added `convergedMeans` so the meaning travels with the field.
33
+
34
+ **E. An unreadable registry hashed identically to an empty one** in `computeInputHash`
35
+ (`catch { registry = '' }`) — absence and emptiness sharing a cache slot, the same shape one layer
36
+ down. Now distinguishable via an explicit marker.
37
+
38
+ Supporting surface: `parseStandardsRegistryDetailed` / `loadStandardsRegistryDetailed` return
39
+ `RegistryParseDiagnostics`; `runRegistryCanary(articles, diagnostics?)` reports `articleHeadings`
40
+ and `completenessAssessed`; `CoverageSummary` gains `assessmentTrustworthy` + a `registry`
41
+ provenance block.
42
+
43
+ ## Decision-point inventory
44
+
45
+ - `computeCoverage` — an OBSERVE-ONLY reporter. Gates nothing, blocks nothing, has no authority
46
+ over any pipeline. The change alters what it *reports*, never what anything *does*.
47
+ - `runRegistryCanary` — a state-detector whose verdict is returned as DATA. Both call sites
48
+ (`specReviewRoutes` HTTP handler and `runConformanceCheck` for the CLI) attach it to the
49
+ response; neither throws on it. A stricter canary therefore cannot newly block anything.
50
+ - `parseStandardsRegistry` — pure function. Behaviour change: it now returns MORE articles
51
+ (the previously-dropped family).
52
+ - `GET /conformance/coverage/health` — read-only, dev-agent-gated, `X-Instar-Request` gated.
53
+ Response gains fields; `enforcedRatio` changes type.
54
+
55
+ No gate, hook, reaper, sentinel, or scheduler path is touched.
56
+
57
+ ## 1. Over-block
58
+
59
+ The audit has no blocking authority, so it cannot over-block. The two adjacent risks:
60
+
61
+ **The canary becoming stricter.** `runRegistryCanary` now fails when a heading inside a family
62
+ carries no `**Rule.**`. Verified against the REAL registry: 80 headings, 80 parsed, zero dropped —
63
+ so the live document passes. A future editor adding a non-article `###` inside a standards family
64
+ WOULD trip it. That is intended (the failure names the heading and is trivially resolved by adding
65
+ a rule or moving the subheading), and it is signal-only: the verdict rides in a response body,
66
+ where no consumer treats it as a block. Checked all call sites for a throw-on-canary — none.
67
+
68
+ **The conformance gate seeing more standards.** `StandardsConformanceReviewer` now receives the
69
+ previously-dropped family, so a spec review may raise findings against Self-Hosting that it
70
+ silently could not raise before. That is the defect being fixed, not a side effect to mitigate:
71
+ the article was always in the constitution. The reviewer is signal-only per its own spec.
72
+
73
+ ## 2. Under-block
74
+
75
+ **The stale-copy defect is NOT fixed here and is deliberately not bundled.** The running server
76
+ reads `<projectDir>/docs/STANDARDS-REGISTRY.md` — the agent-home snapshot — and
77
+ `PostUpdateMigrator.migrateFeatureMaturationGate` only overwrites that file when its hash is in a
78
+ known `prior` set. Our copy has drifted out of that set, so it is classified "customized — left
79
+ untouched" and stays frozen at 22 articles forever. Fixing it is install-base migration work with
80
+ a real risk (overwriting a genuinely customised registry on someone's machine) and deserves its
81
+ own review rather than riding along here.
82
+
83
+ What this change buys in the meantime is that the stale read is no longer SILENT: the same
84
+ 22-article read now returns `assessmentTrustworthy: false` with `registry.parsed: 22` and the
85
+ canary failures attached, instead of a bare confident `0.0455`.
86
+
87
+ Tracked, not deferred-and-forgotten: <!-- tracked: CMT-1035 --> (tier-one closeout commitment,
88
+ topic 29723) — the migration is the next item on the same tier and the completion condition of the
89
+ registered autonomous run `run-ms13zzrz-78576404` requires the LIVE figure to be computed over ≥80
90
+ standards, so this cannot be quietly dropped.
91
+
92
+ ## 3. Blast radius
93
+
94
+ `enforcedRatio: number → number | null` is the one breaking-shaped change. Every consumer in the
95
+ repo was checked:
96
+
97
+ - `src/server/routes.ts` — spreads `report.summary` into the response; no arithmetic.
98
+ - `tests/unit/standards-enforcement-auditor.test.ts`, `tests/e2e/standards-coverage-lifecycle.test.ts`
99
+ — assert on real (non-empty) registries where the value stays a number; both still pass.
100
+ - `grep -rn "enforcedRatio"` across `src/`, `scripts/`, `tests/` — no other reader, no CI ratchet,
101
+ no dashboard tile consumes it.
102
+ - `docs/`/CLAUDE.md prose mentions it descriptively only.
103
+
104
+ `family` string values are unchanged for the five pre-existing families: the new
105
+ `familyName()` truncates at the first dash separator, so `## The Substrate — the model-level
106
+ truths …` still yields `The Substrate` (asserted in the updated unit test). `The Fractal` is
107
+ additive.
108
+
109
+ ## 4. Rollback plan
110
+
111
+ Single-commit revert; no state migration, no persisted artifact, no config key. The audit is
112
+ recomputed from disk on every request behind an `inputHash` cache that lives in a route-local
113
+ variable, so a revert takes effect on the next server start with nothing to clean up. No dark flag
114
+ is needed: the change makes a read-only report more honest and cannot alter behaviour.
115
+
116
+ ## 5. Test coverage (all three tiers, per the Testing Integrity Standard)
117
+
118
+ - **Unit** — `tests/unit/standards-conformance-gate.test.ts` (+4 cases): structural family
119
+ detection incl. an invented family and `The Fractal` present; canary reports its denominator and
120
+ says `completenessAssessed: false` when it cannot check; the silent-drop case that the old floor
121
+ passed and the completeness check now names.
122
+ `tests/unit/standards-enforcement-auditor.test.ts` (+3): `enforcedRatio` null over an empty
123
+ registry; provenance + trustworthiness on a real pass vs a truncated fragment; unreadable ≠
124
+ empty in `computeInputHash`.
125
+ - **Integration** — `tests/integration/conformance-dev-gate-route.test.ts` (+4): the HTTP response
126
+ returns `null` not `0`, carries the registry provenance, never presents `converged` bare, and
127
+ yields a real ratio with a visible denominator on a populated registry.
128
+ - **E2E** — `tests/e2e/standards-coverage-lifecycle.test.ts` (+2): the live route assesses the
129
+ WHOLE constitution (denominator equals the document's own heading count, families include
130
+ `The Fractal`), and a truncated registry cannot present itself as trustworthy.
131
+
132
+ Every one of the three "has it refused something?" demonstrations in the ELI16 is an assertion in
133
+ this set, not a manual check.
134
+
135
+ ## 6. Two mistakes made while building this, recorded rather than tidied away
136
+
137
+ **The test that was protecting the bug.** `standards-conformance-gate.test.ts` asserted that every
138
+ parsed family is one of exactly five names. It failed the moment `The Fractal` started parsing —
139
+ the test existed to confirm the exclusion of prose sections, but it had frozen the bug in place as
140
+ a specification. Rewritten to assert the prose sections are excluded (the real intent) plus a
141
+ regression guard for the dropped family. This is the second time in one day a passing test was
142
+ found protecting the defect it sat next to.
143
+
144
+ **The alarming number was passed on unchecked.** Every other instrument found in this audit failed
145
+ by *flattering* us; this one failed by *damning* us, and it was relayed to the operator without
146
+ checking its denominator. A frightening figure is the one least likely to be questioned — which is
147
+ why the denominator now travels with the number rather than being available on request.