cc-os/plugins/os-doc-hygiene/examples/golden/CONTEXT.md

3.2 KiB

examples/golden/

Two distinct families of golden fixtures live here. Do not conflate them.

Family Location Maps Consumed by Purpose
Schema-shape fixtures valid_report.json, invalid_report.json (a hand-authored report) → accept / reject scripts/validate_report.py Pin the frozen machine-report schema contract.
Classifier goldens classifier/<n>-<name>/ input doc-tree (input/) → expected classification (expected.json) hermetic tests/test_classifier_golden.py + a live model-regression harness Layer-2 reversion protection for the classifier — pin which subtype + op-kind + tier a given doc-tree should yield.

Both families are reversion-protection artifacts; changing either is human-gated per the META-RULE in invariants.md.

Schema-shape fixtures

Hand-authored machine-report JSON files used to verify the schema-validator script (scripts/validate_report.py).

Contents

File Purpose Expected validator result
valid_report.json Well-formed machine report exercising a realistic spread of entry types: deterministic delete-range (confirm), deterministic move-to-archive (auto), deterministic insert-frontmatter (auto, no anchor — exercises the no-anchor path), and a generative distillation entry (confirm). Exit 0 (accepted)
invalid_report.json Malformed report with a safety-critical invariant #10 violation: a delete-range entry (destructive, irreversible) that records safety_tier: "auto" when the derivation yields "confirm". All other fields are otherwise valid so the validator reports only this specific violation. Exit 1 (rejected), one violation on entries[0].safety_tier

Invariants exercised

  • Invariant #10 (safety_tier derivation): invalid_report.json is the canonical fixture for this invariant — it is structurally sound except for the safety-tier mismatch.
  • Invariant #11 (op_typeexact_edit biconditional): both fixtures include deterministic entries with exact_edit and a generative entry without one, exercising both directions of the biconditional.

Classifier goldens (classifier/)

Input doc-tree → expected classification. See classifier/README.md for the full case table, the two harnesses (hermetic unit + live model-regression), and the regeneration recipe. Five cases, each pinning one taxonomy edge to a distinct exact_edit.kind (plus one generative case) so the suite covers the kind table + tier derivation:

Dir class / subtype kind tier scanner signal
1-orphaned stale / orphaned delete-range confirm broken_reference
2-superseded stale / superseded move-to-archive auto stale_name_location
3-completed-in-place stale / completed-in-place insert-frontmatter auto archive_to_live_ratio
4-duplicated stale / duplicated dedupe auto stale_name_location (no dedicated dup signal — see case notes)
5-distill bloat / distill (none, generative) confirm archive_to_live_ratio

Enforced hermetically by tests/test_classifier_golden.py (no model, no network).