Skip to content

T9: bounded_query_refusal end-to-end memory-invariant acceptance smoke - #551

Merged
philcunliffe merged 1 commit into
integration/bounded-query-executionfrom
task/bounded-query-execution/T9
Jul 31, 2026
Merged

T9: bounded_query_refusal end-to-end memory-invariant acceptance smoke#551
philcunliffe merged 1 commit into
integration/bounded-query-executionfrom
task/bounded-query-execution/T9

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Implements task T9 of bounded-query-execution: the end-to-end memory-invariant gate (@ref LLP 0054#memory-invariant).

Adds hypaware-core/smoke/flows/bounded_query_refusal.js, a bounded_query_refusal acceptance smoke (registered in the README V1 smoke battery). Drives the two known issue-#9 crashers (ORDER BY over the full ~495k-row ai_gateway_messages dataset; COUNT(DISTINCT content_text)) against the real, unconfigured host-default execution budget and asserts a clean typed QueryBudgetExceededError refusal with a bounded high-water mark instead of an OOM crash, plus a now-streaming COUNT(DISTINCT session_id) that completes over the full scan with bounded heap growth. Asserts the internal path via the T8 budget/refusal telemetry (error_kind: 'budget_exceeded', operator, limit, observed), not only the process's return/throw behavior.

Test plan

  • npm test - 1697 passed, 1 skipped, 0 failed
  • npm run lint - clean
  • npm run typecheck - clean
  • npm run smoke -- bounded_query_refusal - ok
  • npm run smoke -- core_boot_noop / s3_query_roundtrip - ok (no regression)

Task-Id: T9

…T9, LLP 0059)
Adds the end-to-end gate that proves LLP 0054's #memory-invariant holds
across every mechanism the bounded-query-execution change set landed:
signal threading (T1), scanColumn streaming (T2-T5), and the execution
budget with typed refusal (T6-T8).
Unlike the tiny synthetic ceilings the unit/kernel-integration tests use
(query-sql-budget.test.js, query-column-scan-aggregates.test.js), this
smoke drives the REAL, unconfigured host-default execution budget
(DEFAULT_EXECUTION_BUDGET, T7) over a fixture shaped and sized like the
actual ~495k-row ai_gateway_messages crasher from
hyparam/hypaware-server#9, composed through the real production stack
(withSchemaColumns(unionSources(...))), the same way T5's own test
proves the streaming path but now asserting the acceptance-level
contract:
- ORDER BY over the full dataset refuses with a typed
QueryBudgetExceededError (operator ORDER BY) instead of buffering
every row and OOM-crashing the process.
- COUNT(DISTINCT content_text) (high-cardinality) also refuses
(operator COUNT(DISTINCT)) even on the streaming column-scan fast
path, since its dedup set is charged per distinct value.
- COUNT(DISTINCT session_id) (low-cardinality) completes over the full
scan with the exact cardinality and bounded heap growth, proving
O(cardinality) memory, not O(rows).
Each refusal's `observed` high-water mark is asserted to trip right at
the ceiling, not anywhere near the full row count - the deterministic,
GC-independent proof of boundedness - backed by a coarse
process.memoryUsage() heap-growth check as a secondary signal. The
assert_telemetry step reads the T8 budget/refusal log/trace records
directly (error_kind: budget_exceeded, operator, limit, observed) so
the internal path is proved, not just the process's return/throw
behavior.
Registered in the README V1 smoke battery (the flow index).
Task-Id: T9
@philcunliffe
philcunliffe merged commit 3ed959d into integration/bounded-query-executionJul 31, 2026
0 of 6 checks passed
@philcunliffe
philcunliffe deleted the task/bounded-query-execution/T9 branch July 31, 2026 21:49
Sign up for freeto 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

@philcunliffe