feat(querier): prove B2 — template-exact work tracks result, not corpus (slice 3) - #89
Conversation
…us (slice 3) RFC0007.2 (B2, the inverted-index-collapse claim) is now a live, deterministic test instead of a flaky wall-clock latency bench. For a fixed-result template-exact query, the work the engine does — `row_groups_scanned` and `bytes_read` — stays flat across an ~8× larger corpus; the growth is absorbed entirely by row-group pruning (`row_groups_pruned` grows, scanned does not). `rfc0007_2_template_exact_work_scales_with_result_not_corpus` builds two corpora sharing the same target file (5 rows of template 1) but differing ~8× in size via filler templates, each its own row group, and asserts scanned/bytes_read are identical while pruned grows. The criterion latency-vs-corpus bench RFC 0007 §5 mentions is supportive evidence, tracked separately — a structural QueryStats assertion is the gate because it is deterministic where a wall-clock median would be flaky. RFC 0007 stays `specified` (RFC0007.3/.4 still need tests + RFC 0002). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR activates the RFC0007.2 B2 work-scaling test by updating crate documentation to reflect execution slice 3, redirecting the ignored acceptance test to a new live execution test, and implementing test infrastructure and assertions to verify that row-group pruning scales efficiently with corpus growth while keeping query work flat for static template queries. ChangesRFC0007.2 B2 Work-Scaling Test Activation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Slice 3 of the querier flips RFC0007.2 (B2) from an ignored red-gate stub to a live integration test. It proves structurally — via QueryStats rather than wall-clock latency — that a template-exact query's scanned work (row_groups_scanned, bytes_read) stays flat as the corpus grows ~8×, with the growth fully absorbed by pruning.
Changes:
- Added a
corpus_with_fillerhelper plus the liverfc0007_2_template_exact_work_scales_with_result_not_corpusintegration test. - Replaced the RFC0007.2 ignored acceptance stub with a pointer comment explaining the structural-vs-latency methodology.
- Updated crate-level docs to reflect "execution slice 3" with B2 now live.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/ourios-querier/tests/execution.rs | Adds B2 corpus helper and live test asserting scanned work is flat across an ~8× larger corpus. |
| crates/ourios-querier/tests/acceptance.rs | Removes the RFC0007.2 ignored stub; replaces with note about live structural test + supportive criterion bench. |
| crates/ourios-querier/src/lib.rs | Bumps status to slice 3 and documents B2 as live + tested. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/ourios-querier/tests/execution.rs (1)
273-301: ⚡ Quick winAssert the exact scanned row-group count.
These assertions only prove the scan work is equal across the two corpora. If the planner regressed to scanning one extra fixed row group in both cases, this test would still pass even though the fixture is built so only the target row group should be read. Adding an exact
row_groups_scanned == 1check would close that false-positive gap.Suggested tightening
assert_eq!(s.rows, 5); assert_eq!(l.rows, 5, "result size is fixed regardless of corpus"); + assert_eq!( + s.stats.row_groups_scanned, 1, + "small corpus should scan only the target row group; stats={:?}", + s.stats, + ); + assert_eq!( + l.stats.row_groups_scanned, 1, + "large corpus should scan only the target row group; stats={:?}", + l.stats, + ); // The headline: the work scanned for the fixed result is FLAT🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ourios-querier/tests/execution.rs` around lines 273 - 301, The test currently only asserts equality between s.stats.row_groups_scanned and l.stats.row_groups_scanned, which allows an off-by-one regression to go unnoticed; modify the test to assert the exact expected count (assert that s.stats.row_groups_scanned == 1 and likewise l.stats.row_groups_scanned == 1) using clear failure messages referencing s.stats and l.stats so the fixture verification ensures exactly one row group is scanned rather than merely equal counts across corpora.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/ourios-querier/tests/execution.rs`:
- Around line 273-301: The test currently only asserts equality between
s.stats.row_groups_scanned and l.stats.row_groups_scanned, which allows an
off-by-one regression to go unnoticed; modify the test to assert the exact
expected count (assert that s.stats.row_groups_scanned == 1 and likewise
l.stats.row_groups_scanned == 1) using clear failure messages referencing
s.stats and l.stats so the fixture verification ensures exactly one row group is
scanned rather than merely equal counts across corpora.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e3e29216-85e8-49a3-a8cf-3cf142944dc0
📒 Files selected for processing (3)
crates/ourios-querier/src/lib.rscrates/ourios-querier/tests/acceptance.rscrates/ourios-querier/tests/execution.rs
What
Slice 3 of the querier: proves B2 — the inverted-index-collapse claim that a template-exact query's work tracks the result size, not the corpus size. Builds on B1 (slice 2, #88).
RFC0007.2 is now a live test (
tests/execution.rs::rfc0007_2_template_exact_work_scales_with_result_not_corpus), flipped from its#[ignore]red-gate stub.How B2 is measured
Two corpora share the same target file (5 rows of
template_id = 1) but differ ~8× in total size (3 vs 30 filler templates, each in its own hour ⇒ its own file ⇒ its own row group). Atemplate_id = 1query against each asserts:rowsidentical (fixed result, 5 in both).row_groups_scannedidentical — only the target row group is read in either corpus. (the headline)bytes_readidentical — the bytes scanned for the fixed result do not grow with corpus (footer/metadata reads do not count towardbytes_scanned, confirmed empirically).row_groups_prunedstrictly larger in the big corpus, and total row groups far larger — the corpus genuinely grew, and the growth is absorbed entirely by pruning.Methodology note (reviewers, please weigh in)
RFC 0007 §5 phrases RFC0007.2 as "measured by
criterionacrosscorpus/otel-demo-v*" (wall-clock latency). This PR proves the same claim structurally viaQueryStatsinstead, because a deterministic scanned-work assertion is a stronger, non-flaky gate than a wall-clock median. The criterion latency bench remains supportive evidence, tracked separately (it does not gate). The acceptance-stub comment records this. I did not edit RFC 0007 §5 here (kept the PR code-only per the split-doc-from-code discipline); RFC staysspecifiedregardless since RFC0007.3/.4 still need tests + RFC 0002.Invariants / hazards
QueryStats/QueryResult. Boundary intact.Verification (local)
cargo fmt --all --check✅cargo clippy -p ourios-querier --all-targets --all-features -- -D warnings✅cargo test -p ourios-querier --all-features✅ (3 lib + 7 execution; 2 acceptance stubs.3/.4remain#[ignore])Closes part of #98 (B2). Epic: #82.
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Tests