Skip to content

test(identity): no one document crowds out the rest - #18

Merged
tentpegbob merged 1 commit into
mainfrom
test/no-one-document-crowds-out-the-rest
Oct 25, 2026
Merged

tentpegbob merged 1 commit into
mainfrom
test/no-one-document-crowds-out-the-rest

Conversation

@tentpegbob

Copy link
Copy Markdown

What

Milestone 2 asks for a document set with per-document caps. They are
applied:

room = min(
    IDENTITY_DOCUMENT_BUDGET.get(document.name, 2000),
    IDENTITY_BUDGET_CHARS - spent,
)

And nothing tested them:

$ grep -rn "IDENTITY_DOCUMENT_BUDGET" tests/
(nothing)

Why the aggregate test could not catch it

The case beside this one asserts the total:

assert len(rendered) <= IDENTITY_BUDGET_CHARS + 500

The aggregate alone is satisfied by a single document eating all of it.
Drop the per-document ceiling and a 40000-character SOUL.md fills the whole
24000 — STYLE and MEMORY are left out of the prompt entirely, and the total
still checks out.

That is precisely the failure the budgets exist to prevent, and the only test
over them was blind to it:

$ # room = IDENTITY_BUDGET_CHARS - spent
× no one document crowds out the rest
  AssertionError: assert ('T' * 100) in 'SSSS…SSSS\n\n[truncated]'
  (and test_identity_stays_inside_its_budget still passes)

The assertion

The budgets are "proportional to how much it changes what the work looks
like"
, so: all three documents reach the prompt, and the first took roughly
its own slot rather than the whole of it.

tests/sdk/context/   439 passed (1 new)
ruff format          clean

HUMAN:

Issue Number

None. Issues are disabled on this fork.

🤖 Generated with Claude Code

Milestone 2 asks for a document set with per-document caps. They are
applied — `min(IDENTITY_DOCUMENT_BUDGET[name], budget - spent)` — and
nothing tested them.

The test beside this one asserts the aggregate, and the aggregate alone
is satisfied by a single document eating all of it. Drop the
per-document ceiling and a 40000-character SOUL.md fills the whole
24000: STYLE and MEMORY are left out of the prompt entirely, and the
total still checks out. That is the failure the budgets exist to
prevent, and the only test over them could not see it.

Proved by reverting: the new case fails on the missing STYLE while the
aggregate case keeps passing, which is the gap in one run.

The budgets are "proportional to how much it changes what the work looks
like", so the assertion is that all three documents reach the prompt and
that the first took roughly its own slot rather than the whole of it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tentpegbob
tentpegbob merged commit f7acf29 into main Oct 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant