feat(bench): RFC 0031 — honest total-bytes accounting (count + materialize + registry) - #482
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…alize + registry) The comparative channel's OuriosAnswer.bytes_read reported only the count/pruning scan (QueryStats.bytes_read), silently excluding two real IO components a row-returning query pays: the extra scan that materializes the <= limit rendered records, and the RFC 0017 §3.2 template-registry derivation that reads the tenant's audit stream to reconstruct string bodies. Loki's counterpart figure includes delivering results, so the omission biased the L-gate ratios in Ourios's favour — exactly what the §3.7 anti-strawman discipline forbids. The fix is additive, not a redefinition: QueryStats.bytes_read keeps its count-scan-only meaning (B1/B2 gates and the RFC 0016 metrics depend on it — RFC0017.6's stats-equality still holds), and QueryResult (already non_exhaustive for this) gains materialize_bytes_read (the retained materialization plan's bytes_scanned) and registry_bytes_read (bytes fetched by the audit read — full-object GET on S3, file length locally, so the two backends' figures agree for identical data). The harness sums the three into the honest total the gates ratio, and the indicative report prints the breakdown per pair. RFC 0031 §3.6 carries the measurement-fidelity amendment (2026-07-12, RFC in red). On the comparative fixture the breakdown is total=9886 bytes = count_scan 166 + materialize 1555 + registry 8165 — the old channel under-reported by ~60x on this (registry-dominated) tiny store. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the RFC 0031 comparative benchmarking channel to report honest total bytes read by Ourios (count/pruning scan + row materialization scan + template-registry/audit-stream derivation), while preserving the existing count-scan-only semantics of QueryStats::bytes_read for B1/B2 and RFC 0016 metrics compatibility.
Changes:
- Extend
QueryResultwith additive IO components (materialize_bytes_read,registry_bytes_read) and plumb them through querier execution paths. - Measure and surface audit-stream bytes read by returning
(events, bytes)fromaudit_scan::read_all_eventsand exposing a measured template-registry derivation. - Update the bench harness to sum and report the three components (including a breakdown in the indicative report) and add spec tests pinning the additive contract.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/rfcs/0031-comparative-evaluation-loki.md | Documents the measurement-fidelity amendment: bytes_read is now an honest total in the RFC 0031 channel. |
| crates/ourios-querier/tests/it/rfc0017_query_rows.rs | Adds a spec test asserting additive IO components on QueryResult while keeping stats identical to count-only runs. |
| crates/ourios-querier/src/template_registry.rs | Introduces a measured template-registry derivation returning (registry, bytes_read). |
| crates/ourios-querier/src/lib.rs | Threads new QueryResult fields through query execution; measures materialization scan bytes via retained physical plan metrics. |
| crates/ourios-querier/src/audit_scan.rs | Changes audit scan to return both events and bytes read, accounting for local file sizes and remote object fetch sizes. |
| crates/ourios-querier/src/alias_store.rs | Updates alias-map derivation to accommodate the new (events, bytes) audit scan return type. |
| crates/ourios-bench/tests/rfc0031_comparative.rs | Enhances indicative reporting to print the total bytes breakdown (count/materialize/registry). |
| crates/ourios-bench/src/comparative.rs | Updates OuriosAnswer to carry total bytes and per-component fields; adds a test asserting additivity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A wrapped sum silently corrupts the primary gate metric; overflow now surfaces as an error on both the audit accumulation and the final total. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y
f15e7fc to
2005950
Compare
What
Makes the RFC 0031 comparative measurement channel report the honest total bytes Ourios reads from object storage to answer a query — count/pruning scan + row-materialization scan + template-registry (audit-stream) derivation — instead of the count scan alone.
Why
Verified during the run-#7 analysis:
QueryStats.bytes_readcounts only the count/pruning scan. Two real IO components were silently excluded: the second scan that materializes the ≤limitreturned records, and the RFC 0017 §3.2 audit-stream read that derives the template registry rendering string bodies. Loki's counterpart figures include delivering results, so the comparison was biased in Ourios's favour — the §3.7 anti-strawman discipline cuts both ways. On the 3-record comparative fixture the old channel under-reported ~60× (total 9,886 B = count 166 + materialize 1,555 + registry 8,165); real-corpus skew will differ, but the bias direction is proven. Run #8 (post-merge dispatch) re-baselines the selectivity curve on this honest metric before any §7 margin freeze or §9 fold-in.How
QueryResultgains additive fields (materialize_bytes_read,registry_bytes_read) — it is#[non_exhaustive]for exactly this.QueryStatsis untouched: the existing spec testrfc0017_6_typed_row_payload_returned_b1b2_compatibleassertslimited.stats == counted.stats, so the count-scan-only semantics ofstats.bytes_read(B1/B2 gates, RFC 0016 metrics DTO) are preserved bit-for-bit.collect_recordsnow plans its limited frame by hand and readsbytes_scannedoff the retained plan (only bytes folded — its row-group counts stay out so the B1 pruned fraction keeps its meaning).audit_scan::read_all_eventsreturns(events, bytes); local counts file lengths, S3 counts fetched object bytes, so both backends report the same figure for identical data. Publicderive_template_registrykeeps its signature via apub(crate)measured split.OuriosAnswer.bytes_readbecomes the sum (its doc claim is now true) with the three components exposed; the indicative report prints the per-pair breakdown.Invariants / hazards
No hot-path, schema, or miner change. Tests-as-specifications: no existing test weakened; new spec tests pin the additive contract (
materialization_and_registry_io_reported_additivelyin the querier,honest_total_bytes_breaks_down_additivelyin the bench lib — components 0 when count-only, > 0 with rendered rows, count-scan stats byte-identical either way).Checks run
cargo fmt --all --check,cargo clippy --all-targets --all-features -- -D warnings(workspace-wide),cargo nextest run -p ourios-querier -p ourios-bench(284 passed / 0 failed / 14 skipped = container-gated),mdbook buildfor the RFC edit.Note: merge sequencing — #481 (floor gate) touches adjacent lines in
print_indicative_report; whichever lands second gets a trivial rebase.🤖 Generated with Claude Code
https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y