Skip to content

feat(bench): RFC 0031 — floor-direction gate for L6/L7 reporting - #481

Merged
jensholdgaard merged 2 commits into
mainfrom
rfc0031-floor-gate
Jul 11, 2026
Merged

feat(bench): RFC 0031 — floor-direction gate for L6/L7 reporting#481
jensholdgaard merged 2 commits into
mainfrom
rfc0031-floor-gate

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What

Adds the missing floor-direction bytes gate to lgates.rs and wires the indicative report to use it for the time-window (L6-family) pairs.

bytes_within_floor(ourios, loki, factor) passes iff ourios ≤ factor × loki — the RFC 0031 §2 disposition for L6 (broad scan) and L7 (ingest): bounded-loss classes, not wins to demonstrate. Run #7 reported the window pairs through bytes_must_win, which asks the inverted question (it printed advantage 0.021 as a must-win fail when the semantically correct question is "is Ourios within 3×?" — which also fails today, but the report must ask the right question for the §9 record).

Design

  • advantage keeps the loki/ourios orientation for both gates so report tables read identically; only the pass rule differs (floor passes at advantage ≥ 1/factor).
  • Same honesty guards as bytes_must_win: zero measurement → Invalid never pass; factor == 0Invalid (a floor with no budget fails everything — misconfiguration must be loud).
  • Overflow arm fails closed: factor × loki overflowing u64 would be a mathematically true pass, but only on an implausible measurement — checked_mulInvalid, mirroring the saturation trap fixed in feat(bench): RFC 0031 — L-gate must-win math + §7 margins as config #473 from the other side.
  • Report wiring: PairSpec gains gate: GateKind (MustWin for the severity pair, Floor for window slices); print lines now label must-win margin 10 vs floor factor 3.

Invariants / hazards

Bench gate-math + report labels only; no hot path, no schema, no measurement-channel change. bytes_must_win behavior untouched (its tests unchanged). Part of the RFC 0031 reporting ladder (RFC0031.7–.8 direction); §7 factors stay provisional.

Checks run

cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings (workspace-wide), cargo nextest run -p ourios-bench (126 passed, 13 skipped = the #[ignore]d Docker/dispatch tests). Five new boundary/guard unit tests for the floor gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y

Summary by CodeRabbit

  • New Features

    • Added floor-based byte comparisons for L6/L7 performance gates.
    • Comparative reports now support both must-win and floor gate evaluations.
    • Gate results provide clearer explanations when measurements or configuration are invalid.
  • Bug Fixes

    • Prevented zero-byte measurements, zero-value configuration, and arithmetic overflow from being reported as successful comparisons.
    • Improved boundary handling for floor-based pass/fail decisions.
  • Tests

    • Added coverage for floor thresholds, invalid inputs, overflow handling, and differing L6/L7 calibration values.

L6 (broad scan) and L7 (ingest) are FLOOR/parity classes in RFC 0031
§2 — Ourios may be worse by at most F_L6/F_L7 — but the indicative
report pushed the time-window pairs through bytes_must_win, the wrong
direction (run #7 printed advantage 0.02 as a must-win fail instead of
answering "is Ourios within 3x of Loki?").

Adds bytes_within_floor(ourios, loki, factor): pass iff
ourios <= factor x loki, mirroring bytes_must_win's honesty guards
(factor==0 and zero measurements are Invalid, never a pass). The
overflow arm differs deliberately: an overflowing factor x loki budget
would be a mathematically true pass on an implausible measurement, so
checked_mul fails it closed as Invalid rather than letting a saturated
budget pass everything. advantage keeps the loki/ourios orientation so
both gates' tables read the same way; only the pass rule differs.

The indicative report gains a GateKind on PairSpec: the severity pair
stays must-win (m_l2), the time-window slices report via the floor
gate (f_l6), and the gate lines name the direction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y
@jensholdgaard
jensholdgaard requested a review from Copilot July 11, 2026 22:37
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jensholdgaard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b9d1888d-a374-4950-b24b-6c314be9d1d8

📥 Commits

Reviewing files that changed from the base of the PR and between afa5a8f and 492b73a.

📒 Files selected for processing (2)
  • crates/ourios-bench/src/lgates.rs
  • crates/ourios-bench/tests/rfc0031_comparative.rs
📝 Walkthrough

Walkthrough

The benchmark crate adds floor byte-gate evaluation alongside must-win comparisons, exposes the new function publicly, validates invalid and overflow cases, and applies gate-specific evaluation and labels to RFC0031 comparative reports.

Changes

Comparative gate evaluation

Layer / File(s) Summary
Floor gate contract and implementation
crates/ourios-bench/src/lgates.rs, crates/ourios-bench/src/lib.rs
Gate documentation now covers must-win and floor rules; BytesGateOutcome::Invalid carries a reason; bytes_within_floor validates inputs, checks multiplication overflow, evaluates the floor budget, and is publicly re-exported with unit tests.
RFC0031 gate selection and reporting
crates/ourios-bench/tests/rfc0031_comparative.rs
Pair specifications select must-win or floor evaluation, and indicative reports use the selected gate for storage-side and processed-byte comparisons with dynamic labels.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PairSpec
  participant GateKind
  participant bytes_must_win
  participant bytes_within_floor
  participant IndicativeReport
  PairSpec->>GateKind: select gate kind
  GateKind->>bytes_must_win: evaluate must-win pairs
  GateKind->>bytes_within_floor: evaluate floor pairs
  bytes_must_win-->>IndicativeReport: return outcome
  bytes_within_floor-->>IndicativeReport: return outcome
  IndicativeReport->>GateKind: obtain margin label
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the new floor-direction gate for RFC 0031 L6/L7 reporting.
Description check ✅ Passed The description covers the change, design, risks, and verification, and is mostly complete despite not matching the template headings exactly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0031-floor-gate

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the RFC 0031 “floor-direction” bytes gate to the ourios-bench comparative gate math and updates the indicative comparative report to apply the correct gate semantics for L6/L7 (bounded-loss) pairs, while keeping reporting orientation consistent (advantage = loki/ourios).

Changes:

  • Implement bytes_within_floor (pass iff ourios ≤ factor × loki) with the same “honesty” guards as bytes_must_win, plus overflow-fails-closed behavior.
  • Export the new gate from ourios-bench and add unit tests covering boundary/zero/overflow/factor-wiring cases.
  • Wire the indicative report to select MustWin vs Floor per pair and label output accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
crates/ourios-bench/src/lgates.rs Adds the floor gate implementation + tests, and updates gate outcome docs to cover both gate families.
crates/ourios-bench/src/lib.rs Re-exports bytes_within_floor for consumers (incl. integration tests).
crates/ourios-bench/tests/rfc0031_comparative.rs Introduces per-pair GateKind and updates report printing/evaluation to use must-win vs floor as appropriate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-bench/src/lgates.rs Outdated
Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@crates/ourios-bench/src/lgates.rs`:
- Around line 77-78: Update the field-level documentation for Invalid::reason to
also mention zero factor and overflow, matching the expanded variant-level
documentation while preserving the existing explanations for zero sides and zero
margin.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6c92173-e30e-4b85-a023-f25f7e41ce42

📥 Commits

Reviewing files that changed from the base of the PR and between 5190021 and afa5a8f.

📒 Files selected for processing (3)
  • crates/ourios-bench/src/lgates.rs
  • crates/ourios-bench/src/lib.rs
  • crates/ourios-bench/tests/rfc0031_comparative.rs

Comment thread crates/ourios-bench/src/lgates.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

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.

2 participants