arborist/docs/tickets
russell@unturf.com fc5ba507dc
tests/doc_counts: regression test for numeric claims in docs/ (4x drift fix)
The doc-drift pattern recurred four times today on 2026-05-10
(commits 6cbbf95, 14bcb99, 5c21e83, 30a9488). Each fix was the
same shape: walk a doc, find a count that drifted from live truth
during the hours after the doc was written, refresh it. Cost: ~5
min per drift × 4 = 20 min of manual catching, with no guarantee
the next drift gets caught before someone external reads it.

Per fox's selection: regression test that makes drift loud at
test time instead of relying on visual catching.

== Mechanism ==

`tests/test_doc_counts.py` scans `docs/**/*.md` for AUTOCOUNT
tags of the form:

  <!--AUTOCOUNT:metric:path-->N<!--/AUTOCOUNT-->

Two metrics supported:

- `tests` — pytest collected count for path. Batches every
  tagged path into one `pytest --collect-only` subprocess
  (~0.5s total).
- `fixture-rows` — non-blank-non-comment line count in a JSONL
  fixture.

GitHub and most markdown renderers strip HTML comments, so
readers see only `N`. The tags are invisible in rendered output
but make the claim machine-checkable. Three tests in the file:

1. `test_doc_autocount_claims_match_live` — the core invariant
2. `test_autocount_tags_are_well_formed` — open/close balance
3. `test_autocount_metric_names_are_documented` — fail-closed on
   undocumented metrics (catches typos)

Failure message names the doc file, line number, and the
claimed-vs-live diff. Example:
`docs/foo.md:42 AUTOCOUNT(tests:tests/test_x.py) claims 23, live is 27`

== 29 tags installed across 5 docs ==

While installing tags I had to read the surrounding prose, which
surfaced six stale counts that had drifted same-day:

`docs/soft-hash-channel-analysis.md`:
- L392 14 → 23 tests for phi_alignment_probe
- L417 20 → 27 tests for anchor_prg
- L463 14 → 23 tests for phi_alignment_probe (status section)

`docs/seven-point-program.md`:
- L77 68 → 58 tests for metacognition (drift -10; the file
  shed tests during a refactor and the doc didn't catch up)
- L78 9 tests for `test_dag.py::test_preflight_*` — removed
  count entirely; pytest selector subsets aren't currently
  supported by the AUTOCOUNT metric set (would need a
  `tests-matching` metric; not worth the surface for one claim).
- L110 24 → 33 tests for test_dag.py

`docs/calculator-test-patterns.md`:
- L35 33 → 23 tests for warrant_resolver
- L35 10 → 9 tests for warrant_chain
- L16, L265 51 → 53 tests for t3_bound_calculator (kept
  initial-shipment provenance in prose)

== Coverage installed ==

  calculator-test-patterns.md           3 tagged claims
  soft-hash-channel-analysis.md         5 tagged claims
  warrant-substrate-cookbook.md        14 tagged claims
  seven-point-program.md                3 tagged claims
  tickets/ticket-000006-bench-...      4 tagged claims
                                      ---
                                       29 tagged claims

Every count that drifted today is now tagged. Future drift
fires the regression test at the next pytest run instead of
waiting for human catching.

== Discipline pattern ==

Walk this pattern for any new doc that names a count:

1. Surround the number with the tag pair:
   `<!--AUTOCOUNT:tests:tests/test_foo.py-->N<!--/AUTOCOUNT-->`
2. Run `pytest tests/test_doc_counts.py` (~3.5s)
3. If it passes, the claim is now machine-verified

Aim to tag counts on first authorship. Retrofitting is cheap
but only catches drift after the fact.

== Out of scope ==

Test counts inside source code (docstrings, CLI --help) are not
scanned — would expand the test surface significantly and the
drift pattern hasn't manifested there. Add `**/*.py` scope when
that pattern surfaces.

Alias-row counts and claim-pack-record counts could be tagged
with new `db-rows:<table>` and `db-where:<sql>` metrics; deferred
until the next drift on those numbers (none caught today after
30a9488's cookbook refresh).

== Verification ==

  $ .venv/bin/pytest tests/test_doc_counts.py -v
  3 passed in 3.89s

  $ .venv/bin/pytest -q
  2276 passed, 54 skipped in 153.21s

No new dependencies. No schema changes. No source-code changes.
2026-05-10 16:15:52 -04:00
..
ticket-000001-retrieval-keywords-audit-gap.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000002-reference-frame-polarity-contract.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000003-anchor-class-warrant.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000004-directive-coverage-in-bench.md docs: tickets/ subdir + delete naming-deferral, ref-frame, coverage-audit 2026-05-02 12:51:09 -04:00
ticket-000005-label-ladder-migration.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000006-bench-emergent-findings.md tests/doc_counts: regression test for numeric claims in docs/ (4x drift fix) 2026-05-10 16:15:52 -04:00
ticket-000007-query-layer-hyphen-fold.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000008-broad-quantifier-preflight-guard.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000009-quantifier-preflight-dag-binding.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000010-metacognition-preflight-guard.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000011-soft-preflight-hint-sidecar.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000012-selection-consensus-protocol.md #000012 Phase 1b: Merkle-AGI v8 consensus paper landed 2026-05-10 16:12:00 -04:00
ticket-000013-spatial-temporal-substrate.md #000013 closed: v7-W spatial-temporal substrate paper + namespace 2026-05-09 15:00:05 -04:00
ticket-000014-self-model.md selfmodel: land ticket #000014 (identity record + falsification) 2026-05-07 16:36:34 -04:00
ticket-000015-pi-star-domain-library.md pi_star: land ticket #000015 (π* domain library + composition algebra) 2026-05-07 16:51:33 -04:00
ticket-000016-zk-frontier-proof.md #000016 parked: ZK frontier-proof bench plan + wire protocol 2026-05-09 15:05:08 -04:00
ticket-000017-memory-root-lifelong-learning.md memory: land ticket #000017 (memory-root lifelong learning summary) 2026-05-07 16:46:41 -04:00
ticket-000018-soft-hash-covert-channel.md docs/tickets: open #000034 / #000035 / #000036#000018 follow-ups 2026-05-09 14:50:15 -04:00
ticket-000019-specification-methodology.md docs: land ticket #000019 (spec methodology for π*, V, policy fields) 2026-05-07 16:53:28 -04:00
ticket-000020-capital-cost-ledger.md capital: land ticket #000020 (8-capital-form cost ledger) 2026-05-07 16:41:48 -04:00
ticket-000021-bench-fixtures-5s-5t-5r.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000022-adapter-loss-report.md loss_report: land ticket #000022 (adapter LossReport sidecar) 2026-05-07 17:58:50 -04:00
ticket-000023-5s-phase-1b-syllogism-synthesis-semiotics.md bench: land #000023 + #000024 + #000025 (Phase 1a/1b — Dav1DPrometheus suite) 2026-05-07 20:14:44 -04:00
ticket-000024-5t-phase-1b-and-rename.md bench: land #000023 + #000024 + #000025 (Phase 1a/1b — Dav1DPrometheus suite) 2026-05-07 20:14:44 -04:00
ticket-000025-5f-battery.md #000025 Phase 1e: 5F falsification motif coverage (§10.12 closed) 2026-05-10 16:04:34 -04:00
ticket-000026-real-shard-workload-baseline.md tickets: close #000026 (Phase 3 landed 60b5748) 2026-05-10 15:54:32 -04:00
ticket-000027-canonical-projections-in-providence-cache.md #000027 + #000028: canonical projections persist; STRICT-WITNESSED reachable 2026-05-09 11:37:06 -04:00
ticket-000028-multi-modality-witness.md ticket #000028 §2.6 sketch: refresh stale TODO post-#000027 2026-05-10 07:52:54 -04:00
ticket-000029-claim-pack-source.md ticket #000029: claim-pack source for axiom/theorem JSON bundles 2026-05-09 11:44:08 -04:00
ticket-000030-math-pi-star-expansion-sympy-substrate.md fan-out: close #000030 · composition fixtures · witness end-to-end 2026-05-09 13:29:59 -04:00
ticket-000031-surface-ingest-cited-textbooks.md docs: refresh stale alias counts (residual 40/54 → 74) 2026-05-10 12:27:23 -04:00
ticket-000032-combinatorics-pi-star.md ticket #000032: combinatorics@v1 π* (pure-integer counting kernel) 2026-05-09 13:20:29 -04:00
ticket-000033-claim-pack-pillar-vii-combinatorics.md ticket #000033: pillar VII (combinatorics) live in shard 000 2026-05-09 15:42:40 -04:00
ticket-000034-hessian-alignment-phi-linear.md ticket #000034 Phase 1a: φ_linear alignment probe + KAT fixture 2026-05-10 10:23:38 -04:00
ticket-000035-prg-choice-phi-prg.md refactor: arborist/v7+v8 → arborist/substrate (single topic dir) 2026-05-10 08:57:04 -04:00
ticket-000036-t3-per-window-bound.md ticket #000036 Phase 1: T3 per-window covert-channel bound + calculator 2026-05-10 10:32:50 -04:00
ticket-000037-prometheus-sigma-recursive-falsification-controller.md ticket #000037: David review applied — bicameral substrate amendments 2026-05-10 09:29:12 -04:00
ticket-000038-phase-4-content-acquisition.md docs: refresh stale citation-alias counts (40 → 54 → 74) across 4 surfaces 2026-05-10 10:41:07 -04:00
ticket-000039-sqlite-vec-optional-backend.md ticket #000039 §13.5: amend test plan with CLI subprocess coverage 2026-05-10 13:19:53 -04:00
ticket-000040-phase-5-resolver-content-tokens.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000041-citation-aliases-table.md docs: refresh stale citation-alias counts (40 → 54 → 74) across 4 surfaces 2026-05-10 10:41:07 -04:00
ticket-000042-term-aliases-table.md docs: 100% claim-pack warrant resolution recorded across tickets 2026-05-10 08:40:35 -04:00
ticket-000043-t3-bound-constant-tightening.md ticket #000043: open empirical-tightening sub-ticket for T3 bound constants 2026-05-10 11:55:36 -04:00