fix(620): signal corpus size per RECORD; the aggregate becomes an untresholded trend #642

Merged
timothy merged 1 commits from fix/620-corpus-budget into main 2026-07-26 20:17:29 +02:00
Owner

fixes #620

The premise had already expired

#620's concern was that after #610 the budget went quiet at 5228/5600 without the underlying condition changing — a check that stops complaining because it started measuring something else.

Measured on main at f394d6ce: the corpus is 5658/5600 — over budget and warning again, four days after #619 put it at 5228. It did not stay quiet. It went quiet and loud again inside one working week with nobody consolidating anything.

That is the finding, and it changes the answer.

Why this does not re-baseline

The aggregate measures a monotonically growing quantity. A healthy project's decision corpus only gets bigger, so any fixed total is a ratchet that must periodically be raised — the "permanently red, therefore no signal at all" state #542 re-baselined away from. Measured growth over 2026-07-21..25 was ~100 prose lines/day; any plausible new threshold would have been re-crossed within days.

#620 asked for "a threshold that can actually go red again". The honest answer is that this one can never go durably green, which is the same defect wearing the opposite sign.

Two further defects in what it counted:

  1. The generated catalog (189 of the 5658 lines) was added on top — it gains exactly one row per record and no consolidation can shrink it, making the metric partly a record count in a line-count costume, and pointing the reader at work that cannot be done.
  2. An aggregate names no file. "58 lines over" is not actionable.

The replacement

A per-record prose ceiling (--record-ceiling, default 60), non-blocking ::warning::, naming every record over it. Not monotonic — it measures the shape of individual records, so it can go red and green, and it points at a file.

The aggregate is still printed every run as an untresholded ::notice:: trend, so the number stays visible without pretending to be a gate.

60 is calibrated, not round: records run 0..59 prose lines (median 26, p90 52) then jump straight to 83, nothing in between. test_real_corpus_ceiling_is_calibrated_to_the_distribution asserts that gap still exists, so the rationale fails loudly rather than rotting into a stale comment.

Candidates: assessed, not deferred

All 8 over the ceiling are given a verdict in the record rather than punted to another issue that doesn't exist. The headline result:

scan.libraryfolder-unique-identity (230 lines, the largest by ~2x) is a legitimate DECLINE — it is thirteen distinct hard-won traps (MySQL utf8mb4_bin PAD SPACE, create-the-composite-index-before-dropping-its-predecessor, per-fixture connection-pool clearing, lazy hash healing that must never abort a scan…). Shortening it would delete the only copy of most of them — the exact trap #620 flags via docs.tracker-comment-retrofit.

That is why the warning's wording invites a redundancy check and explicitly blesses "this is all distinct, moving on" as an outcome: length is a proxy, and the proxy is demonstrably wrong. Two rows (scan.projection-failure-sweep-guard, sched.weighted-shuffle) are left listed as genuine candidates — merging records changes key identity and invalidates MemPalace's per-key drawers, so that is a call for the owning area, not a drive-by edit inside a metric change.

Nothing was pruned, so no archive/supersession was required (Done-when box 4).

Explicitly rejected

  • An automated redundancy metric — noisy, unfalsifiable, and would fire hardest on the adjacent-but-distinct records the corpus exists to keep apart. Real redundancy is handled by the lifecycle (supersede + git mv to archive/), a positive act with a reciprocal link.
  • Making either signal blocking (unchanged, #520).

Verification

Mutation-verified: re-adding the generated catalog to the total, and making the ceiling inclusive, each turn a test red. 116 passed. Demonstrated bidirectional: --record-ceiling 500 → 0 flagged (green), --record-ceiling 40 → 36 flagged (red). --budget still accepted and ignored for back-compat.

Note the new record is itself 62 lines and appears in its own warning — declared in the record as a checked-and-declined case, because cutting further to hit the number is precisely the target-chasing the rule forbids.

Independent-review note: Python + docs only — below every process.independent-review-rubric trigger; reviewed cold against the diff in-session.

fixes #620 ## The premise had already expired #620's concern was that after #610 the budget went quiet at 5228/5600 *without the underlying condition changing* — a check that stops complaining because it started measuring something else. Measured on `main` at `f394d6ce`: the corpus is **5658/5600 — over budget and warning again**, four days after #619 put it at 5228. It did not stay quiet. It went quiet and loud again inside one working week with nobody consolidating anything. That is the finding, and it changes the answer. ## Why this does not re-baseline The aggregate measures a **monotonically growing** quantity. A healthy project's decision corpus only gets bigger, so any fixed total is a ratchet that must periodically be raised — the "permanently red, therefore no signal at all" state #542 re-baselined away from. Measured growth over 2026-07-21..25 was **~100 prose lines/day**; any plausible new threshold would have been re-crossed within days. #620 asked for "a threshold that can actually go red again". The honest answer is that this one can never go durably **green**, which is the same defect wearing the opposite sign. Two further defects in what it counted: 1. The **generated catalog** (189 of the 5658 lines) was added on top — it gains exactly one row per record and no consolidation can shrink it, making the metric partly a record **count** in a line-count costume, and pointing the reader at work that cannot be done. 2. An aggregate **names no file**. "58 lines over" is not actionable. ## The replacement A **per-record prose ceiling** (`--record-ceiling`, default 60), non-blocking `::warning::`, naming every record over it. Not monotonic — it measures the shape of individual records, so it can go red **and green**, and it points at a file. The aggregate is still printed every run as an untresholded `::notice::` **trend**, so the number stays visible without pretending to be a gate. **60 is calibrated, not round:** records run 0..59 prose lines (median 26, p90 52) then jump straight to **83**, nothing in between. `test_real_corpus_ceiling_is_calibrated_to_the_distribution` asserts that gap still exists, so the rationale fails loudly rather than rotting into a stale comment. ## Candidates: assessed, not deferred All 8 over the ceiling are given a verdict in the record rather than punted to another issue that doesn't exist. The headline result: **`scan.libraryfolder-unique-identity` (230 lines, the largest by ~2x) is a legitimate DECLINE** — it is thirteen distinct hard-won traps (MySQL `utf8mb4_bin` PAD SPACE, create-the-composite-index-before-dropping-its-predecessor, per-fixture connection-pool clearing, lazy hash healing that must never abort a scan…). Shortening it would delete the only copy of most of them — the exact trap #620 flags via `docs.tracker-comment-retrofit`. That is why the warning's wording invites a **redundancy check** and explicitly blesses "this is all distinct, moving on" as an outcome: length is a proxy, and the proxy is demonstrably wrong. Two rows (`scan.projection-failure-sweep-guard`, `sched.weighted-shuffle`) are left listed as genuine candidates — merging records changes `key` identity and invalidates MemPalace's per-key drawers, so that is a call for the owning area, not a drive-by edit inside a metric change. Nothing was pruned, so **no archive/supersession was required** (Done-when box 4). ## Explicitly rejected - An **automated redundancy metric** — noisy, unfalsifiable, and would fire hardest on the adjacent-but-distinct records the corpus exists to keep apart. Real redundancy is handled by the lifecycle (supersede + `git mv` to `archive/`), a positive act with a reciprocal link. - Making either signal **blocking** (unchanged, #520). ## Verification Mutation-verified: re-adding the generated catalog to the total, and making the ceiling inclusive, each turn a test red. 116 passed. Demonstrated bidirectional: `--record-ceiling 500` → 0 flagged (green), `--record-ceiling 40` → 36 flagged (red). `--budget` still accepted and ignored for back-compat. Note the new record is itself 62 lines and appears in its own warning — declared in the record as a checked-and-declined case, because cutting further to hit the number is precisely the target-chasing the rule forbids. Independent-review note: Python + docs only — below every `process.independent-review-rubric` trigger; reviewed cold against the diff in-session.
timothy force-pushed fix/620-corpus-budget from 95815ab954 to 61877d7659 2026-07-26 12:03:28 +02:00 Compare
timothy force-pushed fix/620-corpus-budget from 61877d7659 to 7671975428 2026-07-26 12:46:36 +02:00 Compare
timothy force-pushed fix/620-corpus-budget from 7671975428 to fefd11dffe 2026-07-26 13:57:23 +02:00 Compare
Author
Owner

Review-verdict: MERGEABLE @ fefd11d

Four independent cold review rounds; rounds 3 and 4 both ended MERGEABLE for this PR after their blockers were fixed. Round 3 BLOCKED on the calibration test being reddened by an unrelated 62-line record with the only remedy being to raise the ceiling — the very ratchet this PR abolishes; round 4 BLOCKED on a residual vacuous half and a false claim in a commit message. The test is now on v4, asserting p90 <= ceiling <= p95, swept in both directions (40/50/111/200 fail, 60/70/96 pass). Every historical number in the record was independently reproduced by the reviewer: 5658 and 189 at f394d6ce, 5228 at 8e84191a, the 3h35m interval, the 5089->5042->5469 series, 628 scaffolding lines, and all candidate-table line counts. Rebased onto merged #621 and #631; 225 tests green; CI green except the h10 status this comment posts.

Review-verdict: MERGEABLE @ fefd11d Four independent cold review rounds; rounds 3 and 4 both ended MERGEABLE for this PR after their blockers were fixed. Round 3 BLOCKED on the calibration test being reddened by an unrelated 62-line record with the only remedy being to raise the ceiling — the very ratchet this PR abolishes; round 4 BLOCKED on a residual vacuous half and a false claim in a commit message. The test is now on v4, asserting p90 <= ceiling <= p95, swept in both directions (40/50/111/200 fail, 60/70/96 pass). Every historical number in the record was independently reproduced by the reviewer: 5658 and 189 at f394d6ce, 5228 at 8e84191a, the 3h35m interval, the 5089->5042->5469 series, 628 scaffolding lines, and all candidate-table line counts. Rebased onto merged #621 and #631; 225 tests green; CI green except the h10 status this comment posts.
timothy merged commit 34591c3ef6 into main 2026-07-26 20:17:29 +02:00
timothy deleted branch fix/620-corpus-budget 2026-07-26 20:17:29 +02:00
Sign in to join this conversation.