Skip to content

test(ratchet): read the buffer and the ceilings from the gate, not from prose beside it - #1341

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-1335-ratchet-copies-read-the-producer
Aug 27, 2026
Merged

test(ratchet): read the buffer and the ceilings from the gate, not from prose beside it#1341
os-trump merged 1 commit into
mainfrom
claude/issue-1335-ratchet-copies-read-the-producer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes #1335

Three restatements of the source token ratchet's ruled figures had no
producer-side pin. One of them called itself a reuse while being a hand copy,
and one had already rotted against a ceiling that moved eleven days ago.

What changed

1. test/docs-readme-token-figures.test.tsTOLERANCE imports BUFFER.
It was const TOLERANCE = 0.05 under a comment calling it "the ratchet's own,
reused"
. The comment is the reason the copy survived: a reader who checks a
literal against its stated source, and finds the claim already made, stops
looking. It now imports BUFFER from the gate, exported for exactly this since
PR #1334. The value is unchanged.

2. The same file's docstring band table — corrected and pinned.
The table stated ceiling 42,000 for the interaction layer. That ceiling has
been 40,000 since PR #1320 re-anchored it, and the paragraph under the table
reasoned from the stale number, concluding that this rule was the tighter of
the two and fired ~1k early. Both halves are corrected: the row now reads
ceiling 40,000, and the paragraph states what is true of both layers today —
the band's upper edge sits past the committed ceiling, so on growth the ratchet
fails first, and the direction this rule owns alone is shrinkage.

The table is now derived rather than transcribed. A new describe block reads
this file's own docstring and asserts, per row:

field producer it is read back off
banner ~81k the README banner, via the same CLAIMS patterns the rest of the file uses
band edges banner ± BUFFER, imported
ceiling CEILINGS.get(label), imported
the paragraph's claim band upper edge > the row's ceiling, pinned as the relation it argues from

Nothing in the block is calibrated against today's constants, so a re-anchoring
moves the constant and the row follows it or fails.

3. scripts/check-source-token-ratchet.mjs header — reflowed, not yet pinned.
The sentence recording the two re-anchorings that were declined as raises stated
both anchor() outputs mid-paragraph, wrapped across a comment line break. Both
are correct today (re-derived: anchor(82,489) = 87,000 against a committed
85,000; anchor(133,840) = 141,000 against 140,000). It is reflowed into one
worked line per declined re-anchoring, in the shape of the table above it, so
each figure sits on one line beside the reading it comes from and the ceiling it
would have raised. It is deliberately left unpinned — see below.

Why pinning here, when last week's card deleted its figures instead

Both are the same rule applied to different inputs. A figure whose producer is
one import away gets pinned; a hand-maintained count with no producer gets
deleted, because a corrected copy of it is just the next one to go stale. Every
figure in item 2 has a producer: CEILINGS, BUFFER, and the README banner.

Why item 3 is not pinned in this PR

Not a difficulty with the reflow — the reflow is done and the sentence is now in
a shape a single-line regex reads cleanly. The obstacle is where the pin
belongs
. Its natural home is test/source-token-ratchet.test.ts, which
already pins the header table beside it and already holds every helper such a
pin needs (source(), num(), ceilingOf(), and the RUN / RUN_READINGS
pair that ties a row's reading to the anchoring run it came from). That file is
outside this card's declared file surface, and writing the pin into the
README-figures file instead would mean copying that machinery into a second
file — a second parser for one artefact, which is the defect class this card is
about. So the reflow lands and the pin is reported as a follow-up rather than
bolted into the wrong file.

Reverse verification — four legs, each mutation proved on disk

Every literal in this card is green on today's constants, so a passing suite
proves nothing. Each leg records the HEAD blob hash, proves the mutation landed
by blob hash and by counting the removed and injected text, reads the
verdict only then, restores with git checkout HEAD -- PATH, and proves the
restore by an empty git diff HEAD plus a blob hash back at HEAD. All four
restores verified.

leg mutation predicted measured
A CEILINGS interaction 40000 -> 41000 the ceiling assertion red red: "the row restates a ceiling the gate no longer commits (it commits 41,000)" — 1 failed, 9 passed
B BUFFER 0.05 -> 0.02 the band-edge assertion red, and the tolerance case red both red — 2 failed, 8 passed
C README banner ~81k -> ~82k the banner assertion red red: "the row works from a banner figure the README does not state (the README says ~82k)" — 1 failed, 9 passed
D the docstring row back to its pre-fix ceiling 42,000 ceiling assertion red, and the paragraph's claim red both red — 2 failed, 8 passed

Leg B is the proof that item 1 is real wiring and not a renamed copy: the
tolerance case "is within the ruled 5% buffer of what the gate measures today"
goes red under a moved BUFFER, which a hand-copied 0.05 could not have done.

Leg D is the proof against the actual history: restoring exactly the prose this
PR corrects turns the guard red, naming the row —

test/docs-readme-token-figures.test.ts docstring row:
  *   interaction layer   banner ~39k -> band 37,050-40,950 · ceiling 42,000
the row restates a ceiling the gate no longer commits (it commits 40,000).
This is the #1320 rot, recurring: correct the row rather than the constant.

so the eleven days of silent falsehood could not repeat.

Leg A reddens exactly one assertion by design: the paragraph's claim is read
against the row's ceiling, not the committed one, because the assertion
above it already ties the row to CEILINGS. One cause, one red, with the second
firing next — when the row has been corrected and the paragraph over it has not.

Gates

pnpm verify green end to end on bc3ddd1, the commit this PR ships:

✓ source hygiene clean
✓ source token ratchet clean
✓ i18n lint gate: 0 `i18n/missing-*` issues
Test Files  142 passed (142)
Tests  3002 passed | 1 skipped (3003)

tsc --noEmit --listFiles confirms both edited files are in the typecheck
program, so the green typecheck covers these edits rather than skipping them.

Nothing measured changed: the gate still reads business semantics ~82,489,
interaction layer ~37,431, authored total ~133,854. No ceiling, no BUFFER, no
README banner, and no scripts/check-source-hygiene.mjs byte was touched. The
changeset carries empty frontmatter — comment and test-guard text only,
releasing nothing to HotCRM users.

Generated by Claude Code


Generated by Claude Code

…om prose beside it

Three restatements of the source token ratchet's ruled figures had no
producer-side pin, and one of them had already rotted.

- `TOLERANCE` in the README-figures rule was a hand copy of 0.05 under a
  comment claiming it was the ratchet's own, reused. It imports `BUFFER` now;
  the value is unchanged.
- That file's docstring band table said `ceiling 42,000` for the interaction
  layer, eleven days after #1320 re-anchored it to 40,000, and argued from the
  stale number that this rule was the tighter of the two. Corrected, and pinned:
  every field of both rows is derived from the README banner, `BUFFER` and
  `CEILINGS`, and the paragraph's claim is pinned as the relation it draws on.
- The gate header's two declined `anchor()` re-anchorings are reflowed onto one
  worked line each, beside the reading and the ceiling they come from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ED4cusQ7pxZ7d7TCLKrZb
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hotcrm Ignored Ignored Aug 27, 2026 2:00am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline

Projects

None yet

2 participants