Commit Graph
34 Commits
Author SHA1 Message Date
timothyandtimothy d4c72697f2 feat(780): commit a ruff config and enforce it in CI (#813)
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 28s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m29s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 5m54s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 5m59s
Build ErsatzTV Image / Build & push image (amd64) (push) Failing after 15s
Python lint here was a property of the operator's laptop: the global instructions
say to run ruff, no workflow ran it, and with no committed config ruff fell back
to whichever ~/.config/ruff/ruff.toml the machine happened to have.

- ruff.toml at the root, pinned ruff==0.12.11 in the script-tests job.
- Both lint steps pass an EXPLICIT population from `git ls-files` with
  `--no-force-exclude`, never `ruff check .` — an `exclude` empties a
  discovery-based run into a GREEN one (top level empties both commands, [lint]
  empties check, [format] empties format --check), and `ruff check .` over zero
  files exits 0 with only a stderr warning. Guarded by an empty-population arm.
- Tree clean: 74 findings at 706674272, 57 fixed in code, 17 per-site noqa with
  reasons inline. S105 deliberately per-site, not a directory blanket. RUF100
  selected so a suppression that suppresses nothing is itself a finding.
- pyright stays ungated; reasoning in the record.

Both steps witnessed red on the runner against the shipped bodies: run 2173 job
9176 (ruff check) and run 2170 job 9163 (ruff format --check).

Docs: new record ci.python-lint-ruff-config-committed, ci.script-tests-job
cross-ref, docs/ci-cd.md (also correcting a stale ~190-tests/~10s figure to the
measured 773 tests / ~4.5 min), docs/defect-shapes-773.md §5.2 resolved.

fixes #780

Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-22 00:33:18 +00:00
timothyandClaude Opus 5 efc34a3481 fix(688): pin p95's inclusivity; drop a stale ratio and hedge the gap width
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 20s
PR Gates / Docs update reminder (pull_request) Successful in 32s
Review verdict / Set review-verdict status (pull_request_target) Successful in 11s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 1m34s
PR Gates / Script tests (pytest) (pull_request) Successful in 1m42s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 19s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 6m24s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 22m10s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 22m46s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
PR Gates / decisions lifecycle (pull_request) Successful in 14s
review-verdict/h10 Review-verdict: MERGEABLE @ efc34a3 (base: main)
Round 7's second reviewer returned MERGEABLE on the previous head after re-measuring
every figure and running a 48-mutant battery — and reported ZERO wrong or unverified
numbers, which ends this branch's five-commit streak of them. It also independently
confirmed the round-6 adjudication: at `f394d6ce`, the sha the record cites, the #620-era
distribution really is n=167, min 2, median 26, p90 52, next value 83. All five figures
correct as written.

This commit clears its four non-blocking items.

- `marks_tail`'s UPPER inclusivity was the last meaningful surviving mutant: `ceiling <=
  p95` mutated to `<` survived the whole suite. Notice-only rather than blocking, but an
  unpinned boundary is how a documented claim quietly stops being true — the same defect
  the previous commit fixed for the coarse band. Both ends now pinned; verified the
  mutant fails.
- "the largest by ~1.6x" was TRUE at `f394d6ce` (230/147 = 1.56) and is stale today
  (230/198 = 1.16). Unlike the consolidation table two paragraphs down, that sentence was
  never scoped to a sha — so rather than re-pin a number that will rot again, it now just
  says "the longest", which stays true however the tail moves.
- The validator docstring asserted the 60->81 gap flatly; a 70-line record existed as
  recently as `8f6d4f443^`, so the gap's WIDTH is more volatile than that implied. Hedged
  to say it is the shape as measured today, not a constant. Nothing asserts it either way.
- Rewrapped a mid-sentence line break left by the previous commit.

Three surviving mutants are accepted and left: the crosscheck's not-a-mapping branch is
unreachable from any fixture, the None -> "" normalisation only matters for an explicit
YAML null no record has, and `_frontmatter_block` returning "" instead of None is a
downstream no-op.

Verification: 432 scripts/tests pass; ruff at baseline parity (47, and `ruff format
--check` at parity 9/9); validator exits 0 with no drift notice; corpus at p90=60, 18/183,
calibrated.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 23:07:15 +02:00
timothyandClaude Opus 5 2ff52d4236 fix(688): make the n oracle dynamic; correct a tense that asserted false history
Review round 6: one MERGEABLE with non-blocking prose, one NOT-MERGEABLE with a real
test defect. Both addressed.

THE n PIN DID NOT PIN ANYTHING. `assert n == 10` was checked against a fixture holding
exactly ten records, so a mutation returning a constant 10 for EVERY input satisfied it —
while changing the live denominator from 183 to 10, which is precisely the production
defect the test was added to close. A single hardcoded count cannot tell "counts the
input" from "returns this number". Now a dynamic oracle at two distinct cardinalities;
verified the constant-n mutation fails it.

"MOVED p90 by 21 lines" asserted a history I had not measured. 21 is TODAY's gap (60 ->
81). The actual #672 event was smaller — at that tree p90 was 60 with the next value 83,
so the 62-line record moved p90 to 62 and reddened CI with a 2-line move. The capability
claim is what matters and is true at both refs; the past tense was not. Changed to "can
move" in the two places that asserted it, which also makes all four sites agree with
docs/ci-cd.md and the validator docstring, both of which already said "could".

A REVIEW FINDING I REJECTED, having measured it. Round 6 called "p90 52" wrong for the
#620-era distribution, measuring 57. That measurement is at `fefd11dff`; the record cites
`f394d6ce`, and at THAT sha p90 is exactly 52 (n=167, min 2, median 26). The number is
correct as written and is unchanged. Recording the disagreement rather than silently
keeping it: the reviewer measured a different tree than the one the claim names.

Also corrected in this branch's own commit message trail: `b24c51ab5` said origin/main
has three 59-line records; it has four 59s and two 60s (HEAD: four and three). The claim
that survives, and the only one the code and docs now make, is that NOTHING sits between
61 and 80 at either ref — verified independently at both.

Cosmetics from the same round: a dangling modifier in ceiling_calibration's docstring, a
test_decisions_lib assertion message that said "field(s) differ" when faults can now also
be rejections, and a sentence in corpus-size-signal that named the replacement test
without saying what it asserts.

Verification: 431 scripts/tests pass; ruff at baseline parity (47); validator exits 0 with
no drift notice; corpus at p90=60, 18/183, calibrated.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 22:35:00 +02:00
timothyandClaude Opus 5 b24c51ab51 fix(688): stop enumerating multiplicities, pin n and the keyless filter, de-couple the vacuity floors
Review round 5. One reviewer returned MERGEABLE with prose findings; the other found four
more, two of them real test gaps. Both are addressed here.

THE MULTIPLICITIES WERE WRONG AGAIN — fourth commit running. The "measured" sequence
59, 59, 60, 60 -> 81 is measured nowhere: origin/main has 59, 59, 59, 60, 60 and HEAD has
four 59s and three 60s. I had even tagged it `(measured)` in a canonical decision record.

So this stops enumerating them. All four sites now state only the load-bearing, stable
fact: the lengths climb to the ceiling and then jump STRAIGHT to 81 with nothing in
between, so one record moves p90 by 21 lines. The multiplicities change with every record
added; the gap is the point. This is the same "fix the boundary, not the site" move the
tests got three rounds ago, applied to prose that had failed four times.

TEST GAPS
- Deleting the over-tight test removed the only pin on CeilingCalibration.n: a mutation
  returning n=1 passed all 19 relevant tests while printing a wrong denominator in the
  drift notice. Pinned.
- The `if r.key` filter was load-bearing in production and unpinned: main() passes the
  UNFILTERED list (194 entries, 11 keyless, one a 106-line "Records formerly in this file"
  scaffolding block), while every test handed the function a pre-filtered list — oracle and
  production agreed only by accident. Pinned.
- The --record-ceiling 0 arm's claim that it "cannot go vacuous for any non-empty corpus"
  was FALSE: an empty record body is validator-valid and record_prose_lines returns 0, so a
  corpus of empty-bodied records has no offender at 0. Now -1, which makes the claim true.
- The three `len(recs) > 100` vacuity floors were themselves growth-coupled — 83 legitimate
  retirements would red them even with the ceiling still calibrated, which is the #688 class
  in the guard rather than the assertion. Lowered to >20 where a floor is meaningful, and to
  plain non-empty on the derived-ceiling test, whose derivations need nothing more.
- test_main_FEEDS_the_crosscheck now compares against `set(record_wing_files())` instead of
  a hardcoded basename, killing the same mutation with zero corpus dependence.

PROSE
- "ordinary growth cannot cross it — NOT immune" contradicted itself in four places. Now:
  no SINGLE ordinary addition can cross it; this is measured headroom, not immunity.
- "trimming or archiving 15" blurred two different denominators. Trimming leaves 3/183 =
  1.64%; archiving leaves 3/168 = 1.79% because the denominator moves too. Both verified,
  both under the floor, now stated separately.

Verification: 431 scripts/tests pass; ruff at baseline parity (47 — a 121-char docstring
line briefly took it to 48 and is rewrapped); validator exits 0 with no drift notice;
corpus at p90=60, 18/183, calibrated; record still 60 lines.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 22:11:25 +02:00
timothyandClaude Opus 5 c56dfdd539 fix(688): delete the last over-tight test, pin the crosscheck's INPUT, fix 4 prose defects
Review round 4, both reviewers. Both report the code path SOUND and the #688 coupling
class analytically gone (rows proved, not merely observed green); one caught 28 of 30
mutations. What blocked was one over-tight test, two unpinned mutations, and prose —
including two defects the PREVIOUS commit introduced while claiming to fix numbers.

TESTS
- Deleted test_adding_ordinary_records_cannot_RED_the_blocking_property. It appended two
  long records to the LIVE corpus and asserted flags_minority on the RESULT, so it crossed
  the cap two records before production does (56/221 vs 54/219) — a test named "cannot RED
  the blocking property" being a tighter tripwire than the property. Fourth instance of the
  #688 defect in this change. Deleted rather than tuned: both its jobs are already covered
  off live data (the synthetic v4/v5 contrast, and the deliberate live guard at the
  production threshold).
- test_main_FEEDS_the_crosscheck_the_REAL_wing_files closes a mutation hole found by
  review: replacing `pyyaml_frontmatter_faults(record_wing_files())` with `...([])` in
  main() left the ENTIRE suite green. Both existing wiring tests monkeypatch the function,
  so they pinned that its RETURN reaches errs, never that its ARGUMENT is the corpus —
  the '#609 marker that printed OK while doing nothing' defect one level up, which is the
  exact thing the new record indicts. Verified: the mutation now fails this test.
- test_main_actually_REPORTS_... went vacuous whenever the ceiling legitimately goes green
  (`False is False` passes with the whole warning branch deleted). Added an arm at
  --record-ceiling 0, which no non-empty corpus can make vacuous.
- Pinned two surviving mutations: ceiling_calibration's n_over boundary (it recomputes the
  count, so oversized_records' exclusivity test does not cover it — `>` vs `>=` differs by
  the 3 records sitting exactly on the ceiling) and p95's quantile (the 95/5 fixture cannot
  tell 0.95 from 0.99).

PROSE — two of these were introduced by the previous commit, whose stated job was fixing
numbers. That is the pattern worth naming, not the individual typos.
- "so ONE new record could move p90 lines" — the previous commit deleted the magnitude and
  left the sentence ungrammatical. Now "by 21 lines".
- It also introduced a THIRD variant of the sequence it was correcting ("60, 60, 60") and
  missed a FOURTH site in ci-cd.md still saying "twenty lines". All four sites now read the
  measured 59, 59, 60, 60 -> 81, and 21 lines.
- 59- and 60-line records were described as "above the ceiling"; they are at or below it.
- "routine growth cannot cross it" overstated the bound: it is deliberately less sensitive,
  not immune. Reworded, and the THIRD and tightest arm is now documented wherever the other
  two appear: consolidating 15 of the 18 offenders drops below the 2% floor (verified:
  3/183 = 1.64%). That is in real tension with test_oversized_records_can_go_green and is
  stated as accepted — at 3/183 the constant genuinely is mis-calibrated — with the remedy
  named: a consolidation PR that large should re-derive the ceiling in the same change.
- Corrected a docstring that called the 999-ceiling failure "silently deleting the
  assertion"; it would go red, not silent.

Verification: 430 scripts/tests pass; ruff at baseline parity (47); validator exits 0 with
no drift notice; corpus at p90=60, 18/183, calibrated. The two new claims were measured,
not assumed: the empty-list mutation fails the new test, and 15 consolidations reaches
1.64%.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 21:47:24 +02:00
timothyandClaude Opus 5 0db56c3ebd fix(688): remove the last live-corpus tripwires and three fabricated/wrong numbers
Review round 3, both reviewers, NOT-MERGEABLE. Nothing needed rework — the code path
was found sound and mutation-sensitive (a 17-mutation battery caught every mutation with
the semantically correct test). What was left were tripwires and prose.

TRIPWIRES
- `assert need > 20` was the tightest live-corpus assertion left in the blocking job:
  it reds after 16 over-ceiling additions, while `flags_minority` — the property #688
  exists to protect — survives to 36. An arbitrary threshold on a live order statistic is
  the ratchet wearing a different hat. Removed; the measured headroom lives in prose,
  where being out of date costs a doc fix rather than someone else's red build. This also
  removes an unbounded `while` loop that HUNG the suite rather than failing it when the
  ratio could not reach the cap.
- test_main_reports_ceiling_drift hardcoded ceiling 999, which is not guaranteed above
  p95: ten valid 1000-line records make 999 calibrated and silently delete the test's only
  assertion. Now derived as max+1, off the tail by definition.
- test_main_actually_REPORTS_the_ceiling_and_the_trend required >=1 over-ceiling record.
  The ceiling is ALLOWED to go green (test_oversized_records_can_go_green says so), so
  that would red the blocking job the day someone consolidates the last offender —
  punishing exactly the work the warning asks for. Restated as an IFF.
- test_no_budget_flag_means_no_retirement_warning asserted no bare "RETIRED" in stderr; a
  legitimate stale record whose TITLE contains the word reds it. Matched precisely now.
- Added the >100-record vacuity guard its siblings carry to the derived-ceiling test.

NUMBERS — all three were mine, and two are the failure mode this repo calls worse than
no note at all (a confident claim that was never measured):
- "the lengths above the ceiling ran 60, 61, 62, 63 then jumped to 81" is FABRICATED. No
  record of 61, 62 or 63 lines exists at origin/main, at the #672 sha, or at the #706 sha.
  Measured, the sequence is 59, 59, 60, 60 then 81 — a 21-line jump, so the conclusion was
  if anything understated. Corrected in all three places it was repeated, including the
  canonical v4 row of docs.corpus-size-signal.
- The crosscheck record called `decisions-guard` a REQUIRED check — introduced by the
  previous commit in the sentence rewritten to fix an overclaim. Verified against Gitea
  branch protection: `main` requires exactly `Build & test (.NET)`, `EF migration
  integrity` and `review-verdict/h10`. NEITHER script-tests NOR decisions-guard is
  required; the record now says so.
- docs.corpus-size-signal said 37 additions "to reach" the cap two paragraphs above 38
  "below the cap" — a same-document numeric inconsistency of exactly the class this change
  set out to remove. Both now state 38 to BREACH, noting 37 lands on 0.25 and passes.
- Also: the old bound's accepted range is 39..229 (not 43..229 — 43 is the NEW bound's
  lower edge); "95% over the ceiling" was 100%; `oversized_records` said the #620
  distribution began at 0 lines where the record itself says 2.

Verification: 428 scripts/tests pass; ruff at baseline parity (47); validator exits 0 with
no drift notice; corpus at p90=60, 18/183 over the ceiling, record trimmed to 60 lines so
main ships calibrated.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 21:26:52 +02:00
timothyandClaude Opus 5 b3a8826281 fix(688): stop asserting live-corpus order statistics anywhere in the suite
Review round 2 (both reviewers, independently) found the round-1 fix incomplete: the
live-corpus coupling survived in two more tests. This is the THIRD instance of one
defect class in this change, so the fix is to remove the coupling rather than patch
another site.

BLOCKER — test_adding_ordinary_records still asserted live order statistics. The
`if before.marks_tail:` guard made the PRECONDITION conditional but left the
CONCLUSION (`assert not after.marks_tail`) an assertion about the live p90. Verified:
appending 16 ordinary 30-line records — nothing long, nothing unusual — makes both
sides true and fires it, reddening the blocking job for an unrelated author. Exactly
what #688 exists to abolish.

The v4-vs-v5 contrast moved to test_v4_would_have_reddened_where_v5_holds, built on a
distribution the test OWNS, reproducing the shape that matters (a sparse gap just above
the ceiling). The real-corpus test now asserts only the robust claims: the additions
were counted, v5 holds, and the measured headroom.

Same treatment for the "bad ceiling" teeth test, which hard-coded that 200/229/230 stay
rejected on the live corpus — three new 200+ line records flip it. Teeth now demonstrated
synthetically; the only live-corpus assertion left is that today's ceiling is accepted,
which needs 38 over-ceiling or 718 short additions to break.

The IFF drift test could lose its quiet branch: one 61-line record makes BOTH the 60 and
999 ceilings drift, at which point an UNCONDITIONAL notice would pass. Both ceilings are
now DERIVED — p90 itself (always calibrated, since p90 <= p90 <= p95) and max+1 (always
off the tail) — so each branch is guaranteed by construction, and the test asserts it
exercised both.

Added the missing regression test for the typed-mapping-key TypeError: removing `key=str`
now fails a test instead of only a manual probe.

Corrected against measurement: the v5 row of the record's own version table still stated
the REJECTED first-draft bound (`0 < f < 1/3`) — the canonical artefact contradicting both
the code and its own next paragraph; accepted range is 43..180, not "roughly 45..150";
breaching the cap takes 38 additions, not 37 (37 lands exactly on 0.25, which passes under
`<=`); "5x headroom below the floor" was inverted; ci-cd.md said four versions "all
ratcheted" when v1 was vacuous and v2 accepted an absurd ceiling; and the crosscheck record
overstated protection — script-tests is NOT a required check, so "no broken record has
reached main" is procedural, not structural.

Evidence the coupling is actually gone: mid-fix the corpus sat at marks_tail=False (an
edit pushed this branch's own record to 61 lines, moving p90) and the suite stayed fully
green. Under the old assertions that state reddened CI. The record is trimmed back to 60
so main ships calibrated and no drift notice nags.

Verification: 428 scripts/tests pass; ruff at baseline parity (47); validator exits 0 with
no drift notice; corpus at p90=60, 18/183 over the ceiling.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 21:02:01 +02:00
timothyandClaude Opus 5 80818aa294 fix(674,688): address independent review — restore the coarse bound's teeth
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 33s
PR Gates / Docs update reminder (pull_request) Successful in 31s
PR Gates / decisions lifecycle (pull_request) Successful in 41s
Review verdict / Set review-verdict status (pull_request_target) Successful in 12s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 1m14s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 1m32s
PR Gates / Script tests (pytest) (pull_request) Successful in 2m8s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 8m53s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 20m30s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 23m19s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Two independent cold reviews (one cross-family) agreed on the top two findings.

1. The #688 fix was defeated by its own complement test. test_main_is_QUIET_about_
   drift asserted the drift notice was ABSENT while running main() over the LIVE
   corpus — whose failure condition is bit-for-bit v4's assertion, in the same
   blocking job, three functions down. p90 sat exactly on 60, so one over-ceiling
   record would have reddened it. Replaced with an IFF test that uses
   ceiling_calibration as its oracle, so it asserts the WIRING rather than the
   corpus's current state, plus a guard that at least one branch fires.

2. The coarse bound was nearly unfalsifiable. `0 < fraction_over < 1/3` accepted
   EVERY ceiling from 39 to 229 on the real corpus — including the ceiling of 200
   my own docstring offered as the case it catches, because one 230-line record
   keeps the count nonzero. That claim was simply false and is corrected. The floor
   is now a FRACTION (2%) and the cap 25%, which rejects 200/229/230 and 20, and
   accepts roughly 45..150. Headroom measured, not estimated: 37 consecutive
   over-ceiling additions, against ONE record to break v4.

3. yaml.safe_load raises a bare ValueError, not a YAMLError, on a well-shaped but
   impossible date (stale-after: 2026-06-31), which escaped as a traceback and
   killed the validator on any machine with PyYAML. The except is now deliberately
   broad, with a test.

4. PyYAML returns TYPED mapping keys, so a stray `1: x` made sorted(set|set) raise
   TypeError. Sorted with key=str.

5. The headroom prose was arithmetically wrong (~42/~40 where the real values are
   63/64; each addition moves numerator AND denominator) and the record counts were
   stale. Corrected against measurement.

6. test_adding_ordinary_records passed identically with its two additions removed.
   It now asserts the additions were counted, and that they break the v4 property
   while leaving v5 satisfied — guarded by `if`, never asserted, since whether v4
   currently holds is a fact about the live distribution and asserting it would
   rebuild the ratchet.

Also recorded honestly in docs.frontmatter-pyyaml-crosscheck: decisions-guard
installs no PyYAML, so in CI the cross-check always skips and script-tests already
caught both hazards — the CI delta is close to zero and the real fix is the local
loop plus the tool/suite agreement. And the new record was trimmed 64 -> 58 prose
lines: at 64 it moved p90 to 64 by itself, i.e. this PR would have reddened the old
blocking job. That is now cited in the test as the live demonstration.

Verification: 426 scripts/tests pass; ruff at baseline parity (47); validator exits
0; corpus back to p90=60, 18/183 over the ceiling, marks_tail and flags_minority
both true.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 20:37:27 +02:00
timothyandClaude Opus 5 9d2b30dc3b fix(674,688): cross-check frontmatter against PyYAML; split the ceiling calibration claim
Two defects in scripts/decisions_validate.py, fixed together because they share the
validator and its pytest suite.

#674 — the validator reported OK on frontmatter PyYAML rejects. The hand-rolled reader
is deliberately dependency-free (decisions-guard and the Husky hooks install nothing),
so it cannot see a bare apostrophe closing a single-quoted scalar. Hit twice in one
session by two independent agents. `pyyaml_frontmatter_faults()` now cross-checks the
parse against PyYAML whenever PyYAML is importable, and is SKIPPED with a ::notice::
when it is not — the read path stays dependency-free.

The two known hazards fail differently and the fix covers both: the apostrophe makes
PyYAML reject the document, while an unquoted ` #` parses fine and silently TRUNCATES
the value. So the check compares parsed results key by key rather than try/except-ing
the load, which is also what makes it generalize past the two known characters. PyYAML
wrote these files, so on disagreement it is authoritative and the file is the defect.
The comparison has one implementation, called by the validator and by the existing
test_decisions_lib agreement test, so the tool and the suite cannot drift.

#688 — test_real_corpus_ceiling_sits_at_the_TAIL_BOUNDARY asserted p90 <= 60 <= p95 in
the BLOCKING script-tests job. p90 sat exactly on the ceiling and the distribution above
it is sparse, so one ordinary record moved p90 by twenty lines and reddened CI for
whoever wrote it; it reproduced twice live (#672, #706) and both times the only in-scope
remedy was trimming the new record to fit the constant.

v5 splits the claim by robustness instead of hunting for a better single assertion. The
blocking test now asserts only the coarse, non-ratcheting property (the ceiling flags a
nonempty proper minority, 0 < fraction_over < 1/3); the fine tail-boundary claim is
measured every run and REPORTED as a ::notice::, on the same reasoning stale_records
already uses — a constant going out of date is the passage of corpus growth, not a
defect in the commit under test. The fine property is still asserted, against synthetic
distributions the test owns. The ceiling stays 60.

Verification: 424 scripts/tests pass; ruff at baseline parity (47 before and after);
the cross-check is clean on all 183 real records; a positive control pins that
record_wing_faults alone still reports both hazard files as clean, so the new red cannot
pass for the wrong reason; and a test demonstrates that appending #672's 62-line and
#687's 107-line records to the real corpus does not red the blocking property.

Docs: new record docs.frontmatter-pyyaml-crosscheck, docs.corpus-size-signal updated for
the v5 split, catalog regenerated, docs/ci-cd.md updated for both.

fixes #674
fixes #688

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 20:15:16 +02:00
timothyandClaude Opus 5 fefd11dffe fix(620): signal corpus size per RECORD; the aggregate becomes an unthresholded trend
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 13s
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 20s
PR Gates / Docs update reminder (pull_request) Successful in 28s
PR Gates / decisions lifecycle (pull_request) Successful in 30s
Review verdict / Set review-verdict status (pull_request) Successful in 12s
PR Gates / Script tests (pytest) (pull_request) Successful in 42s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 1m31s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 18m33s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 21m27s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 22m24s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
review-verdict/h10 Review-verdict: MERGEABLE @ fefd11d
Squashed from 7 commits (4 review rounds) to keep the rebase onto #621 tractable; the
full round-by-round history is on PR #642.

corpus was 5658/5600 — over budget and warning again — 3h35m after #619 put it at 5228,
with nobody consolidating anything.

So this does NOT re-baseline. An aggregate over a monotonically growing corpus can only
ratchet; that is the "permanently red, therefore no signal" state #542 re-baselined away
from, and growth is not even a smooth rate to plan against (the corpus FELL from 5089 to
5042 across four days, then gained 427 in one evening as two large records landed).

Replaces it with a per-record prose ceiling (default 60), non-blocking, naming each
record over it — not monotonic, so it can go red AND green, and it points at a file. The
aggregate is still printed as an unthresholded trend notice, with record prose and
non-record scaffolding reported separately because they are not the same unit. The
GENERATED catalog is no longer counted at all: it gains one row per record and no
consolidation can shrink it, which made the metric partly a record COUNT in a line-count
costume.

The calibration test took FOUR versions, and the failures are the durable lesson:
  v1  true by construction (`max(under) <= 60 < min(over)` over lists built by that test)
  v2  a gap WIDTH — a ceiling of 200 also sits in a wide gap, so it passed
  v3  fraction band + "clear air" vs the nearest record above — hostage to an unrelated
      record: one ordinary 62-line addition reddened it with the ceiling correctly
      placed, and the only remedy was to RAISE the ceiling. That is this very treadmill,
      as a hard failure in what #631 makes a blocking job.
  v4  `p90 <= ceiling <= p95` — the property stated directly and scale-free.
Two rules recorded: a guard test must depend only on the thing it guards, and a threshold
over a growing population must be expressed in that population's own terms.

Candidates: all over-ceiling records assessed, each actioned or declined with a reason.
The largest (scan.libraryfolder-unique-identity, 230 lines) is a legitimate DECLINE — a
dozen-odd distinct traps whose only copy that is. Nothing pruned, so no archive or
supersession was required. An automated redundancy metric is explicitly rejected.

Also: `--budget` is accepted but announces its retirement rather than no-opping silently;
the dead `budget_ok` parameter is gone; and five "untresholded" typos are fixed, one of
which was propagating into the generated catalog row and MemPalace's per-key drawer.

Refs #620

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 13:57:01 +02:00
timothy 3d720a6bc1 fix(621): exempt by exact path, not basename — my "no basename exemption" claim was false
review-verdict/h10 Awaiting review verdict for 3d720a6
Review verdict / Set review-verdict status (pull_request) Successful in 2s
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 14s
PR Gates / Docs update reminder (pull_request) Successful in 14s
PR Gates / decisions lifecycle (pull_request) Successful in 28s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 8m48s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 9s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 7s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 17m57s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 22m0s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Re-review found the basename exemption was not actually removed: the code still dropped
any wing-root README.md, and the docstring defended that with "no such file exists
today; the catalog README lives in TOPIC_DIR". That is false — docs/decisions/archive/
README.md exists and parses to []. So the rule text in the record, the catalog row and
ci-cd.md all asserted something the shipped code contradicted.

It was also a live hole, not just wrong prose: dl.active_files() globs RECORDS_DIR.rglob
with NO filter, so a future docs/decisions/records/README.md would be a corpus source
while exempt from the guard — verbatim the hole this PR cites as the reason to stop
using _NON_DECISION_FILES, reintroduced one directory over.

Now exempt by exact RELATIVE PATH ({archive/README.md}), with a test pinning that the
same basename in the ACTIVE wing is still faulted. Mutation-verified.

DISAGREEING with one review finding, deliberately. It asked for the empty-wing
anti-vacuity check to be symmetric across both wings. The semantics differ: zero ACTIVE
records means the scan measured nothing and any clean result is vacuous, while zero
ARCHIVED records is a normal state — nothing superseded yet, true of any young repo and
every fresh clone before the first supersession. Making it symmetric fails a correct
corpus (it reddened 7 tests). The asymmetry stays, with the reason in the code and a
test pinning it so nobody "fixes" it back.

127 passed.

Refs #621
2026-07-26 12:03:43 +02:00
timothy 98b3e8715b fix(621): close three exemption holes and pin the guard's own wiring, per cold review
An independent cold-context review found the guard could be disabled or bypassed in
four ways, one of them silently.

HIGH — the guard's only wiring was untested. Deleting `wing_faults=record_wing_faults()`
from main() left the ENTIRE suite green (120 passed) while a real block-scalar record
vanished again with `decisions-validate: OK`. Every existing test either called the
collector directly or handed validate() a hand-built list, so nothing pinned that
main() ever invokes it — the #609 "prints OK while doing nothing" defect, one level up,
inside the fix for that same defect. Independently reproduced before fixing. Now pinned
by a monkeypatched sentinel test.

MEDIUM — a record could escape by BASENAME. `_NON_DECISION_FILES` is a set of TOPIC-dir
names ({README, migration-map, retrieval-eval}) and was applied to the wings too, so a
genuine record at records/docs/retrieval-eval.md was skipped. Not hypothetical: the
path<->key rule forces key `docs.retrieval-eval` to that exact filename, and
dl.active_files() applies that filter only to the TOPIC_DIR glob — so the file would be
a corpus source while exempt from the guard. Now nothing is exempt by basename.

MEDIUM — the archive exemption was by LOCATION but justified by IDENTITY. Anything
directly in archive/ was skipped, so a new unparseable archive/foo.md would vanish in
the one directory left unwatched. Now exempt only if it really is a #610 stripped index:
one keyless record with a known generated heading.

LOW — parse-to-WRONG. `rule: >-` with an UNINDENTED continuation containing a colon
parses to one VALID keyed record whose rule is literally ">-", plus a junk key, silently
truncating the real value. PyYAML rejects that input, so the hand reader is more
permissive than the writer. Now faulted via an unknown-frontmatter-key check.

LOW — an absent or empty wing reported clean. Now loud: refusing to certify a corpus
from a scan of nothing.

Doc corrections, all measured rather than asserted: "all 167 records use single quoted
lines" was false (117 of 168 rule: values are unquoted plain scalars — the invariant is
single-LINE); the archive shape in the record, ci-cd.md and the rule: field said
`archive/<area>/` where the code deliberately uses archive/** ; the mutation count is 10,
not five; and the "converts ANY reader limitation" claim is softened to the class it
actually covers.

125 passed.

Refs #621
2026-07-26 12:03:43 +02:00
timothy b42df5f15f fix(621): close a depth blind spot in the record-wing scan
Adversarial self-review: the archive side used `glob("*/*.md")` while records used
rglob. Both exempt the top-level stripped legacy files correctly, but the one-level
glob would ALSO skip anything nested deeper, letting a record at
archive/<area>/<sub>/x.md escape the check entirely.

A path silently escaping the scan is precisely the failure mode this guard exists to
close, so the exemption is now expressed as the actual condition — "directly in
archive/" — rather than a glob shape that happens to match today's layout.

Test added and mutation-verified: reverting to the one-level glob turns it red.
120 passed.

Refs #621
2026-07-26 12:03:43 +02:00
timothy 0f565b1f7e fix(621): make an unparseable decision record loud instead of silently invisible
A file under the record wings that the dependency-free frontmatter reader cannot
parse returned [] and simply vanished from the corpus: decisions_validate.py printed
OK, build_decisions_catalog.py --check said "up to date", the record was absent, and
nothing anywhere errored. Reproduced end-to-end with a YAML block scalar (`rule: >-`),
which is the natural thing to reach for on this corpus's very long rule: values and
which parsed fine under PyYAML before #610's dependency-free reader.

An EXISTING record disappearing was already loud (the no-vanish diff check). The hole
was a NEWLY ADDED record, which that check structurally cannot see — no base state to
diff against — so the author's own PR looks clean. Hence a per-PATH check, not a
per-construct or diff-driven one: asserting "this path yields exactly one keyed
record" turns any present or future reader limitation from silent to loud in one move.

Adds record_wing_files/record_wing_faults to decisions_validate.py, surfaced through
validate() as ERRORS (a file in the record wings that is not a record is a mistake by
definition) and reported first, since a file that failed to parse leaves every
downstream check silently evaluating an incomplete corpus. The five top-level stripped
legacy archive files are exempt — they are generated "Records formerly in this file"
indexes, keyless by construction, and are what keeps older date-based pointers
resolvable.

_read_frontmatter is deliberately NOT extended to accept block scalars; rationale in
the new docs.record-wing-parse-guard record.

8 tests, mutation-verified: with the check neutered 5 go red, restored all 119 pass.
A live-corpus positive control asserts the wings are non-empty so a clean result can
never be vacuous.

Refs #621
2026-07-26 12:03:43 +02:00
timothy 52786a545c feat(610): re-key the body-diff guard to key; enforce path<->key; pin the filesystem invariant
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 16s
PR Gates / decisions lifecycle (pull_request) Failing after 14s
PR Gates / Docs update reminder (pull_request) Successful in 19s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 6m24s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 9s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 7s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 21m19s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 22m41s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Three Done-when items that were genuinely unfinished. I audited the checklist
before ticking it rather than after, and these were not done.

1. BODY-DIFF GUARD RE-KEYED FROM HEADING TO `key`. Heading-keying made a pure
   RENAME look like a removal plus an unrelated addition, so retitling a record
   failed CI as an "unlogged removal" -- a trap that has bitten this repo before.
   Records are now MATCHED by key and REPORTED by heading (a key alone is not
   enough for a human to find the record). Demotion, which is inherently about a
   record losing its key, is detected on the heading axis instead, and a demoted
   record is no longer double-reported as removed. Key-matching is also what lets
   the comparison work straight through the legacy->frontmatter migration, since
   `key` survives both the format change and the move between files.

   Pinned by a test driving the REAL git-backed diff engine: retitle a record,
   same key, byte-identical prose -> removed/rewritten/demoted all empty.
   Mutation-verified: restoring heading-keying makes it fail with exactly
   "a retitle was reported as a removal".

2. PATH <-> KEY ENFORCED BY THE VALIDATOR. The filename is derived from the key,
   which is what makes one-active-per-key a filesystem property rather than a
   check -- but only if the two cannot drift. Now an error when they disagree,
   with legacy multi-record files explicitly exempt (they have no key-derived
   path to match).

3. ONE-ACTIVE-PER-KEY PINNED AS A FILESYSTEM PROPERTY. Two records sharing a key
   derive the same path, so the filesystem refuses the second; the migration
   aborts on a destination collision rather than silently overwriting. Both are
   now tested, the latter end-to-end through `main()`.

Also fixed a vacuous assertion ruff caught in my own new test -- `assert X or
True` is always true.

Note on verification: my first positive control for the guard reported it NOT
firing. That was the probe, not the code -- "load 340" appears in both the
`sources:` frontmatter field and the body, and replace(...,1) hit the metadata
copy, which is correctly token-free. Re-run against genuine body prose, the guard
fires with exit 1.

refs #610
2026-07-25 19:53:08 +02:00
timothy fba5233caf feat(610): split the decision corpus into one YAML-frontmatter file per record
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 11s
PR Gates / Docs update reminder (pull_request) Successful in 16s
PR Gates / decisions lifecycle (pull_request) Failing after 23s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 1m17s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 1m29s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 8m5s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 16m5s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 17m6s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
168 records -> docs/decisions/records/<area>/<topic>.md (163 active, 23 dirs) and
docs/decisions/archive/<area>/<topic>.md (5 archived). The filename IS the key,
so one-active-record-per-key becomes a filesystem property rather than a
validator check, and supersession becomes a `git mv`.

WHY: the monolith was a concurrency problem before an aesthetic one. A
3,900-line append target made parallel sessions collide -- PR #605 and PR #614
both hit append-vs-append conflicts during routine rebases, and hand-resolving
those inside the corpus is exactly the operation the rationale-rewrite guard
exists to police.

HOW IT IS VERIFIED: a ~170-file diff cannot be meaningfully read, so correctness
does not rest on reading it. The parser was taught BOTH formats first, so the
body-diff guard parses the old form at the merge-base and the new form at head --
the migration validates itself, no bypass. The proof is a field-level equivalence
harness: 168 records before and after, zero lost, zero gained, zero field
mismatches, zero rationale bodies differing. Reviewers should scrutinise the
harness; it is the actual evidence.

What measuring caught that reading would not have:

- ~500 lines sit OUTSIDE any record -- decisions.md's lifecycle schema and each
  topic file's preamble, mostly the only copy. Source files are kept and
  stripped, never deleted. They also cannot be filed per-area: topic files hold
  several areas and 4 of 23 areas span several files.
- Archive discovery was a non-recursive glob; after the split it found ZERO
  archived records, surfacing as four bogus "supersedes points to unknown key"
  errors rather than an obvious failure.
- ~32 live docs point into the corpus BY DATE, which the split dangles. Each
  stripped file now ends with a generated "Records formerly in this file" index,
  which also rescues the identical breadcrumbs in old issue comments.
- decisions.md's "In this file:" list was 97 same-file anchor bullets that the
  split makes WRONG, not merely stale. Dropped; the generated index replaces
  them with links that resolve.

The equivalence harness now runs against a checked-in FIXTURE, not the live
corpus. The earlier version migrated the real tree, which made it a one-shot:
the moment the migration landed there was nothing left to move and the tests
failed for reasons unrelated to the code. A fixture keeps them testing the
SCRIPT rather than the repo's current state.

Keys preserved verbatim, warts included: `sched` (12) and `scheduling` (1) remain
two directories for one concept. Renaming a key is not a move -- it changes
identity, breaks the equivalence proof, and invalidates MemPalace's per-key
drawers. Taxonomy normalisation is separate work.

refs #610
2026-07-25 19:45:09 +02:00
timothy 64b65fd2db feat(610): generated where-did-it-go index on each stripped file
Live docs point into the corpus BY DATE -- "see `decisions.md` 2026-07-10" --
about 32 such references across 12 files, plus the same form in historical issue
comments. The split would dangle every one of them.

Each stripped file now ends with a generated "Records formerly in this file"
index: date, title, and a link to the record's new path. A reader following a
date pointer lands on the file it names and resolves from there. That is far
cheaper and less error-prone than rewriting 32 references by hand, and it also
covers the issue-comment breadcrumbs, which cannot be rewritten at all.

Caught while verifying it: the generated `## Records formerly in this file`
heading is itself an H2, so the record parser counted one legacy-unmigrated
record per stripped file -- the notice went 0 -> 6. Same treatment as the
existing `## Index` section: skip it by name. SKIP_HEADINGS moved to
decisions_lib as the single source of truth, since three modules now need it.

Found by reading the validator's notice output on a trial migration, not by
inspection -- the corpus still validated OK, so nothing else would have flagged it.
2026-07-25 19:08:58 +02:00
timothy 1af65b7bee feat(610): budget counts PROSE, excluding YAML frontmatter
The line budget exists to bound how much narrative a reader or agent must get
through. Under the split each record carries ~11 frontmatter lines plus two
fences -- 1789 lines across 166 records -- which are the structured restatement
of what used to be one dense backtick line. Counting them inflates the metric
without any new knowledge being added.

Stated plainly because it flatters the number: this is a change of METRIC, not a
consolidation. It re-measures the same corpus, it does not shrink it. Whole-file
counting put the migrated corpus at 6837 against a 5600 budget; prose-only puts
the same content at ~5048. The consolidation work is still worth doing -- it is
simply no longer being signalled by a warning that was partly measuring
punctuation.

Inert pre-migration: no legacy file has frontmatter, so the branch is never
taken and today's number is unchanged.
2026-07-25 19:08:58 +02:00
timothy ef67be924c feat(610): teach the validator and catalog the split layout
Both surfaced in a trial migration against a disposable copy of the real corpus,
not from reading:

- Archive discovery was a NON-recursive glob. After the split, archived records
  live at archive/<area>/<topic>.md, so every one of them became invisible --
  which surfaced as four bogus "supersedes points to unknown key" errors rather
  than as an obvious "no archive found". rglob at both sites.

- Catalog links: a record is now a FILE, so the link is a plain relative path
  with no anchor -- nothing to slug, nothing to keep in sync with a heading. The
  legacy anchor form is kept for records still living inside a multi-record file,
  so the catalog is correct on either side of the migration.
2026-07-25 19:08:58 +02:00
timothyandClaude Opus 5 e9f4444fec docs(609): qualify two comments as non-merge, matching the implementation
Review Low: the module comment and the _edit_trailer_armed summary still said
"a commit message ... does arm" / "some commit", while the matcher excludes merges.
The decision Rule and catalog already carried the qualification; these two did not.
Comment-only.

fixes #609

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 18:38:58 +02:00
timothyandClaude Opus 5 f00dfde0c5 docs(609): correct the --no-merges rationale — merges are discouraged, not blocked
Review Low x2, both correct and both the stale-comment class:

The claim that prepush-rebase-check.sh forbids merging main into a PR branch is
false. That hook refuses a branch that is BEHIND origin/main; a merge makes
origin/main an ancestor, so the push is allowed. Merging main in is discouraged by
convention only. So --no-merges does cost a real false negative: an author who marks
ONLY a conflict-resolving merge commit gets a legitimate rewrite rejected. Keeping
--no-merges and stating the trade explicitly -- that failure is loud and costs one
extra commit, whereas honoring forge-composed merge bodies disables the guard
silently, which is #609 itself.

The module comment also still claimed a quoted example cannot arm the guard, which
contradicts the residual the decision record now states accurately. Aligned both, and
narrowed the record's Rule line from "some commit" to "some NON-MERGE commit" so the
stated contract matches the implementation.

No logic change -- comments, docstring, record prose and regenerated catalog only.

fixes #609

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 18:36:07 +02:00
timothyandClaude Opus 5 cc9481f541 fix(609): review fixes — exclude merge commits, unfold folded values, correct the fail-posture doc
Cross-family review (High + Medium + Low), all three reproduced before fixing:

High -- on a pull_request event actions/checkout lands on a synthetic merge commit whose
body the forge composes from the PR description, so a description ending in an example
marker armed a guard no author armed. Excluded merge commits from the range; merging main
into a PR branch is separately forbidden, so no author-written commit is skipped.

Medium -- a folded value (`no` + continuation ` yes`) was split into independent lines and
the continuation armed on its own, inverting the value the author wrote. Read with `unfold`
so the value is judged whole.

Low -- the module docstring promised fail-open while marker resolution deliberately fails
closed. The posture is right; the docstring was wrong. Documented as the one exception.

Both new negative controls verified red against the unfixed matcher. Decision record
amended to state the residual honestly rather than overclaim: a quoted example that is the
FINAL paragraph of an ordinary commit is a trailer by git's own grammar and does arm. What
the change buys is that discussing the marker can no longer disable anything.

fixes #609

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 18:29:46 +02:00
timothyandClaude Opus 5 c597c49f02 fix(609): arm the decisions body-diff with a git trailer, not a bare substring
The rationale-edit exemption was a substring test over the whole commit range, so any
message containing the literal marker armed it -- including prose explaining why no
marker was needed, which is how it fired live in PR #605: a green --base/--head run
that was vacuous on the body-diff dimension, in the one PR that hand-resolved a merge
conflict inside the corpus the guard exists to police.

Now read as an affirmative `Decisions-Edit:` git trailer. Git parses trailers only in
the final paragraph, so a quoted example message cannot arm it -- which matters because
this commit and its decision record both quote one. A non-affirmative value (`no`) does
not arm it either; the retired substring arms nothing and gets a ::warning:: nudge.

Tests: negative controls (prose mention, quoted mid-body trailer, `no` value, retired
substring) plus positive controls (trailer, uppercase, alongside Co-Authored-By). All
four negative controls verified red against the old matcher.

fixes #609

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 18:21:12 +02:00
timothy 75139bbf31 fix(603): close four defects found in adversarial review of the stale-after fields
1. `date.fromisoformat` is not a YYYY-MM-DD validator. On Python >= 3.11 it also
   accepts ISO basic format ("20270101") and week dates ("2027-W01-1"), so a
   malformed-looking value passed the blocking check — and which forms parse
   depends on the interpreter, meaning the same corpus could validate differently
   on a dev machine and on the runner (pr-checks.yml pins only python-version
   '3.x'). Knock-on: the catalog's Review-due section sorts on the raw STRING, so
   an accepted "20270101" sorted AFTER "2027-01-15" ('-' < '0'), contradicting the
   section's own "sorted soonest-first" text. Gate on ^\d{4}-\d{2}-\d{2}$ first,
   which fixes both — a fixed-width zero-padded form makes string sort == date sort.

2. A present-but-empty `stale-after:` was collapsed to None by `or None` in the
   parser and then skipped by a truthiness guard in the validator, so it passed as
   "absent" — a field that silently never fires, which is the exact failure mode
   the blocking check exists to prevent. Keep "" distinct from None and test with
   `is not None`.

3. `test_catalog_is_date_independent` was partly vacuous: with no date in either
   render, both sides were trivially equal after the .replace(). It did still catch
   an injected clock-derived marker, but it passed with the feature deleted. Assert
   the dates are present.

4. The malformed-date check ran only over the active set, exempting archive
   records. Staleness is moot there, but a typo is still a typo — check both wings.

Adds regression tests for each, plus a Review-due row for a topic-file record
(pinning the `../decisions.md` vs bare-filename link forms).
2026-07-25 15:22:50 +02:00
timothy 0ad02db651 feat(603): adopt OKF's optional stale-after and Sources decision-record metadata
Evaluated the Open Knowledge Format (GoogleCloudPlatform/knowledge-catalog okf
v0.2, scaccogatto/okf-skills) as a replacement for our decision-record system and
rejected it: its conformance rules are deliberately permissive exactly where ours
are strict (broken links, unknown types and missing fields must all be tolerated;
`deprecated` points at no successor), and its stable identity is the file path,
which the breadcrumb rule tells agents not to trust.

Adopted two of its optional families instead, additively:

- `stale-after: YYYY-MM-DD` on the metadata line — marks a record asserting an
  outside-world fact as due for re-confirmation. Absolute date, no TTL.
- `**Sources:**` in the metadata block — the evidence a record rests on, as
  distinct from `Signals:` (recall keywords).

Neither is required; absence is never an error. A malformed `stale-after` is
blocking (it would silently never fire), but a past-due record is only a
non-blocking `::notice::` — going stale is the passage of time, not a defect in
whatever commit is under test. The catalog's new "Review due" section renders the
date only and never a clock-derived verdict, so it cannot drift `--check` red on a
calendar boundary with no commit touching the corpus.

No backfill: no existing record adopts either field here.

fixes #603
2026-07-25 15:22:50 +02:00
timothy 04d3eb2dbc Merge pull request 'ci(545): require a **Signals:** line on decision records' (#547) from fix/545-signals-required into main
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been skipped
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been skipped
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 7m35s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 20m50s
Build ErsatzTV Image / Build & push image (amd64) (push) Has been cancelled
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Successful in 14m23s
2026-07-21 18:58:03 +00:00
timothyandClaude Opus 4.8 0ef053a209 ci(545): require a **Signals:** line on decision records
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 13s
PR Gates / Docs update reminder (pull_request) Successful in 22s
PR Gates / decisions lifecycle (pull_request) Successful in 37s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 7m23s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 7s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 6s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 19m0s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 15m21s
The decisions-guard validator enforced lifecycle metadata (key/status/since/
supersedes/superseded-by + reciprocal links) but not the **Signals:** line —
which is exactly what MemPalace's keyword recall matches on. A record without
it ingests with weak recall metadata and produces confident false-negatives
for the "MemPalace to find, file to confirm" retrieval workflow.

Add "signals" to REQUIRED_META so a migrated record with a missing or empty
**Signals:** line fails the same way a missing key does. All 114 active + 2
archive records already carry a Signals line, so this is non-breaking on the
current corpus. Archive records are intentionally out of scope (recall targets
the active corpus).

- scripts/decisions_validate.py: signals in REQUIRED_META (+ rationale comment)
- scripts/tests/test_decisions_validate.py: _rec() default + missing/empty/present cases
- docs/decisions.md: header + Enforcement note the requirement and why

fixes #545

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 20:19:10 +02:00
timothy 12e5c3d26f docs(542): record the workflow lore, then prune the kickoff doc to instructions
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 10s
PR Gates / Docs update reminder (pull_request) Successful in 13s
PR Gates / decisions lifecycle (pull_request) Successful in 22s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 16s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 13s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 5m44s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 15m11s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 20m14s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Timothy asked why the kickoff handoff doc stores historical narrative when
it should be instructions. It shouldn't — its own lore section is chartered
as "STANDING workflow/orchestration rules only" with the why belonging in
docs/decisions.md. But an inventory of every bullet against the decision
corpus inverted the premise: only ~8 of ~38 were actually covered. 19 had
no record anywhere and 11 more were half-covered, so that single file was
the ONLY copy of the mandatory review rubric, the whole CI-triage
vocabulary, the build-concurrency policy, the H12 session-end audit, and
the plumbing-merge recipe. Pruning first would have destroyed them.

So the records come first. New topic file docs/decisions/workflow-process.md
carries 32 records (ci.*, process.*, testing.*) covering every NONE and
PARTIAL the inventory found, including the Gitea `?milestones=` no-op bug
whose only copy was the archived selector section this prune deletes.

Only then the prune: HARD CONSTRAINTS and the lore section become one- or
two-line rules, each citing the decision key that holds its evidence, and
the 40-line "Archived — do not follow" section is gone. 636 -> 353 lines,
with every cited key verified to resolve against the corpus.

The aggregate corpus budget is re-baselined 4800 -> 5600 with the reason in
the code: the corpus grew because knowledge MOVED into it, which is the
system working, not drift.

refs #542
2026-07-21 20:04:17 +02:00
timothyandClaude Opus 4.8 fb6720ea27 fix(521): de-dup 6 overlapped records; guard duplicate metadata blocks; exclude retrieval-eval; complete eval bank [decisions-edit]
- Exclude docs/decisions/retrieval-eval.md from active decision parsing
  (_NON_DECISION_FILES); its `## N.` eval-question headings were being
  miscounted as 7 legacy-unmigrated records.
- Add decisions_lib.metadata_line_count() + a decisions_validate guard
  that fails a record with more than one `key:` metadata line, so a
  stacked-metadata-block migration bug (which the parser silently
  tolerated by reading only the first block) can't recur unnoticed.
  TDD: test_duplicate_metadata_block_fails / test_single_metadata_block_passes.
- De-duplicate the 6 docs/decisions.md records left with two stacked
  metadata blocks (scan.getoraddfolder-db-lookup #488,
  scan.musicvideo-reconciliation #494, scan.jellyfin-mixed-content-library
  #489, iptv.logo-drives-bug-preset #67, ffmpeg.qsv-decode-encode-split
  #498, ci.small-lane-git-only server-management#639), merging the union
  of Signals/paths/issues/Mechanics from both blocks and keeping the
  richer Rule wording; rationale prose untouched.
- Fill in the deferred Q6b row in docs/decisions/retrieval-eval.md now
  that startup.parallel-orientation is active in docs/decisions.md,
  scoring it as a real active-vs-superseded question against the
  archived docs.queue-state-gitea-tracker.
- Regenerate docs/decisions/README.md via build_decisions_catalog.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:54:52 +02:00
timothyandClaude Opus 4.8 962dc2a31a feat(520): parallel orientation+selection startup; retire #237 as live state; #642 retrieval bullets [decisions-edit]
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:48:14 +02:00
timothyandClaude Opus 4.8 ab2d80b47a fix(521): reciprocity covers archive<->archive pairs; skip topic-file Contents heading
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 11:14:00 +02:00
timothyandClaude Opus 4.8 f93458c76c fix(521): whole-branch review — correct Gitea anchors, guard archive+demotion, reciprocal links, stale append-only refs, budget warning [decisions-edit]
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 03:00:15 +02:00
timothyandClaude Opus 4.8 7b8ac751d7 fix(521): bound _rationale strip window; restore REQUIRED_META; fail-open _run; archive-placement invariant
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 02:58:58 +02:00
timothyandClaude Opus 4.8 9266437d68 feat(521): decision lifecycle validator
Adds scripts/decisions_validate.py: lifecycle invariant checks (unique
active key, key format, reciprocal supersession, removed-without-archive,
rationale-rewrite-without-token, catalog staleness, corpus budget) plus
git-diff helpers for merge-base-based CI checks. Deviates from the task
brief in one spot: REQUIRED_META narrowed to (key, status) — the brief's
(key, status, since, supersedes, superseded_by) makes its own
test_clean_corpus_passes fail, since since/supersedes/superseded_by
default to None on bare Record() instances built without going through
the markdown parser.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 02:58:58 +02:00