Skip to content

PERF.md's prefix budget table is 150 bytes behind the caps the gate enforces, on both arms #1030

Closed

Description

@santoshkumarradha

What happened

Base: dev@56575e062, 2026-09-14.

PERF.md's fixed-prefix budget table states caps that are 150 bytes below the
ones the gate actually enforces, on both arms:

| | weighed | cap | target owed |
| --- | --- | --- | --- |
| full (`fixedPrefixBudget`) | **53,141** | 53,141 | 48,000, **5,141** over |
| lean (`leanPrefixBudget`) | **44,916** | 44,916 | 31,500, **13,416** over |

The code enforces 53,291 and 45,066:

const (
	fixedPrefixWaiver = 5_291
	leanPrefixWaiver  = 13_566
)

over fixedPrefixTarget = 48_000 and leanPrefixTarget = 31_500, with
fixedPrefixBudget = fixedPrefixTarget + fixedPrefixWaiver.

The raise is documented in the code, in the comment directly above those two
constants, and names the commit that made it:

2026-09-12, the merge with #1015. The prompt diet's read-dedupe wave added one
sentence to the shared BELT_FACTS … and paid exactly 150 bytes on both arms
doing it. Both waivers rise by that figure here, in this diff, on purpose

So the constants moved deliberately and the document did not move with them.
CLAUDE.md makes that a law ("the rule that changing any cap changes the doc in
the same commit"), and PERF.md's own paragraph under the table makes it a
stronger one ("a wave that grows the prefix raises a waiver in a diff with its
name on it"). All four numbers in the table are stale: both weighed columns
and both over figures move by the same 150.

This is small in bytes and not small in kind — the table is the only place a
person reads what the prefix is allowed to be, and a wave that budgets against
it today budgets against a figure the gate does not use.

Replication

Deterministic (no model). At any checkout of dev, two greps and a
subtraction — no build, no key, no network:

grep -n '53,141\|44,916' PERF.md
grep -n 'fixedPrefixWaiver\|leanPrefixWaiver\|fixedPrefixTarget = \|leanPrefixTarget = ' \
     internal/session/prefixbudget_test.go

Today that prints 53,141 / 44,916 from the document and 5_291 / 13_566
over 48_000 / 31_500 from the code — 53,291 and 45,066. The document and the
gate disagree by 150 on both arms.

Field (real models). None needed; nothing here depends on a model, a key or
a provider.

Where

  • PERF.md, the fixed-prefix budget table (search fixedPrefixBudget — the
    table is directly under the paragraph beginning "Both caps were weighing a
    conversation nobody has").
  • internal/session/prefixbudget_test.go — the prefixWaivers block holding
    fixedPrefixWaiver and leanPrefixWaiver, and fixedPrefixTarget /
    leanPrefixTarget.

The fix

The table reads the caps the gate enforces:

| | weighed | cap | target owed |
| --- | --- | --- | --- |
| full (`fixedPrefixBudget`) | **53,291** | 53,291 | 48,000, **5,291** over |
| lean (`leanPrefixBudget`) | **44,916** → **45,066** | 45,066 | 31,500, **13,566** over |

and the paragraph under it names the 2026-09-12 raise the way the code comment
already does, so the document carries the same dated waiver history the
constants do.

Acceptance

  • e2e: not applicable — nothing here goes through a door. Stated rather than
    skipped.
  • Unit: a law in internal/session (or beside the existing prefix-budget
    test, which already reads the tree) parses the four figures out of PERF.md's
    budget table and fails the build when any of them differs from
    fixedPrefixBudget, leanPrefixBudget, fixedPrefixTarget or
    leanPrefixTarget. The failure message names the document figure and the
    constant. That is what makes "changing any cap changes the doc in the same
    commit" enforced rather than remembered — it has now been broken once by a
    commit that explained itself carefully in the code and never opened the file.
  • The change entry's invalidates names the figures people have been reading:
    the full cap is 53,291 and the lean cap 45,066, not 53,141 and 44,916.

Drafted with CodeAF · reviewed and owned by the author

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething the code does that it should not

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions