Skip to content

test(query): make the memory-truncation path reachable (#540) - #630

Merged
EVWorth merged 1 commit into
mainfrom
test/memory-guard-floor
Sep 11, 2026
Merged

EVWorth merged 1 commit into
mainfrom
test/memory-guard-floor

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #629.

MemoryGuard compared against a literal 512 and execute built the guard itself, so nothing could choose the floor. Provoking the real one means starving the machine of RAM, which no test should do — and the block that turns a tripped guard into a partial result was the only path through the executor no test reached.

Everything around it was covered: truncation_for picks the reason, truncationMessage renders it, the banner tests assert both variants, and integration tests confirm the row-limit reason survives a round trip. The block joining them up was not.

The floor is now a field on QueryExecutor, defaulting to the same 512. A test setting it above the machine's free memory trips the guard on its first check and gets to assert what the user would actually see:

A third test covers both caps applying at once: the row limit stopped the read first, and it is the one the user can act on.

All three pass against live MySQL 8.

Closes #540

🤖 Generated with Claude Code

@EVWorth
EVWorth changed the base branch from feat/results-types-and-null to main September 11, 2026 05:16
`MemoryGuard` compared against a literal 512 and `execute` built the guard
itself, so nothing could choose the floor. Provoking the real one means
starving the machine of RAM, which no test should do — and the block that
turns a tripped guard into a partial result was the only path through the
executor no test reached (#540).

Everything around it was covered: `truncation_for` picks the reason,
`truncationMessage` renders it, the banner tests assert both variants, and
integration tests confirm the row-limit reason survives a round trip. The
block joining them up was not.

The floor is now a field on QueryExecutor, defaulting to the same 512. A test
setting it above the machine's free memory trips the guard on its first check
and gets to assert what the user would see: a partial result that admits it is
partial, carrying MemoryGuard rather than RowLimit — telling someone to lower
a row limit that was never binding sends them somewhere that cannot help
(#413) — and still a result set, with its columns.

The third test covers both caps applying at once: the row limit is the one
that stopped the read first, and the one the user can act on.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the test/memory-guard-floor branch from a959bb7 to d4a4999 Compare September 11, 2026 05:25
@EVWorth
EVWorth merged commit 21a927d into main Sep 11, 2026
12 checks passed
@EVWorth
EVWorth deleted the test/memory-guard-floor branch September 11, 2026 05:26
@EVWorth EVWorth mentioned this pull request Sep 11, 2026
48 tasks
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.

[P2][test] MemoryGuard's 512 MB floor is hardcoded, so the memory-truncation path cannot be tested

1 participant