Skip to content

test(runtime): send more tools than the composition names - #4777

Closed
Astro-Han wants to merge 1 commit into
mainfrom
test/prompt-composition-tool-cap
Closed

test(runtime): send more tools than the composition names#4777
Astro-Han wants to merge 1 commit into
mainfrom
test/prompt-composition-tool-cap

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

Summary

Follow-up to a review point on #4722: the chain test that seals a real send into SQLite sent a turn with no tools, so its only assertion about the tool rows was tools.length <= 64 — which holds for a list with none. The cap, the ranking and the remainder crossed the backend, the AgentRun ledger and the SQLite round trip completely untested; the only coverage was the unit fold in request-shape.test.ts, on a composition built in memory.

The turn now carries 69 tools, and the test asserts the rows the context panel actually reads:

  • 64 named, and they are the 64 largest;
  • the remaining 5 carried as a counted remainder;
  • named bytes + remainder bytes = the tool_definitions segment's own byte count, so nothing is dropped by the cap without being accounted for;
  • all of it twice — warm, off the row the send committed, and cold, after reopening the store and folding the ledger.

Test-only. No production code changes.

✅ Verification

  • format, lint clean. test:dist on @maka/runtime: 3,219 tests, 0 failures.
  • The new assertions bite: making the fold report zero remainder bytes (remainder.reduce(...)0 in prompt-composition.ts) fails the test; reverting passes it. The tools.length === 64 assertion is itself the proof the toolset now reaches the sealed row.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — wrote the test changes and ran the verification. Reviewed by me.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes
  • No — test-only

The chain test sent a turn with no tools, so the only thing it said about the
tool rows was that there were at most 64 of them -- true of a list with none.
The cap, the ranking and the remainder crossed the backend, the ledger and the
SQLite round trip untested; only the unit fold covered them, on a composition
built in memory.

It now sends 69, and asserts the same rows the panel reads: 64 named, the five
largest-last carried as a counted remainder, and the two adding up to the tool
bytes the segment claims -- warm off the committed row, and again cold after
reopening the store.

Generated-by: Claude Code
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 4, 2026
@Astro-Han

Copy link
Copy Markdown
Contributor Author

Superseded by #4780 — same commit, opened from a fork branch instead of a branch pushed to apache/maka by mistake.

@Astro-Han Astro-Han closed this Sep 4, 2026
@Astro-Han
Astro-Han deleted the test/prompt-composition-tool-cap branch September 4, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant