Skip to content

feat(bench): RFC 0031 — latency_p50 channel (RFC0031.7 becomes measurable) - #495

Merged
jensholdgaard merged 4 commits into
mainfrom
rfc0031-latency-channel
Jul 12, 2026
Merged

feat(bench): RFC 0031 — latency_p50 channel (RFC0031.7 becomes measurable)#495
jensholdgaard merged 4 commits into
mainfrom
rfc0031-latency-channel

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

The latency_p50 channel RFC 0031 §3.6 specifies but the harness never implemented. After this, scenario RFC0031.7 (ourios.latency_p50 ≤ F_L6 × loki.latency_p50) is measurable as written — and measured.

Measured result (pre-merge validation, run #18 on this branch — first latency numbers in the program)

pair Ourios p50 Loki p50 ratio (>1 = Ourios faster)
severity (1 row) 82.0 ms 875.0 ms 10.7×
L3 trace (9 rows) 74.6 ms 24.10 s 323×
L1 template (2 rows) 75.7 ms 23.32 s 308×
window k=100 40.2 ms 13.8 ms 0.34 — RFC0031.7 floor (3) PASSES
window k=2000 85.9 ms 294.8 ms 3.4× — Ourios faster; floor passes
selective-resource k=100 38.8 ms 51.2 ms 1.3× — Ourios faster; floor passes

Three headline findings:

  1. The "young engine" latency risk the RFC hedged against did not materialize. Ourios answers every pair in 39–86 ms — a remarkably flat profile — while Loki spans 14 ms to 24 s. On the needle classes the human-facing difference is interactive-vs-coffee-break: 75 ms vs 23–24 seconds.
  2. The L6 floor, evaluated as the RFC actually wrote it (latency), PASSES on all three window pairs (0.34 / 3.43 / 1.32, all ≥ 1/3) — and Ourios is outright faster on two of the three windows it loses on bytes. The §9.13 draft's "published loss" is a bytes-channel artifact; on the RFC's own gate the window tier holds the floor.
  3. The asymmetry caveat (in-process vs localhost HTTP) is immaterial at these magnitudes.

All byte figures and equivalence unchanged from run #17 (exit 0).

Checks run

cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings (workspace-wide), cargo nextest run -p ourios-bench (140 passed). Pre-merge bench: run #18 (29210202343), exit 0, six pairs, equivalence held.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y

…able)

The indicative run now measures the RFC 0031 §3.6 latency channel per
pair on both systems: after a pair's correctness measurement succeeds,
7 timed repetitions of the same query — Ourios via ourios_query_answer
end to end (in-process), Loki via the same query_range round trip with
the body drained — reported as the median (warm p50, never min). The
report prints both p50s, the loki_p50/ourios_p50 ratio in the bytes
gates' orientation with the in-process-vs-localhost-HTTP asymmetry
caveat, and for Floor pairs the RFC0031.7 gate as written
(ourios_p50 <= F_L6 x loki_p50) through the shared checked gate math on
nanosecond integers. Latency stays corroborating: a rep failure on an
otherwise-good pair logs loudly and reports "unmeasured", never fails
the run; a pair whose correctness measurement failed reports no latency.

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 12, 2026 21:17
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The RFC0031 comparative harness now measures warm p50 latency for Loki and Ourios queries, propagates latency through measurement handling, reports latency ratios and Floor gate results, and tests median and gate calculations.

Changes

Warm latency comparison

Layer / File(s) Summary
Latency measurement and gates
crates/ourios-bench/tests/rfc0031_comparative.rs
Adds repeated Loki and Ourios query timing, median Duration calculation, and nanosecond-based latency Floor gating.
Measurement collection and propagation
crates/ourios-bench/tests/rfc0031_comparative.rs
Carries optional latency p50 values through Ourios and Loki measurement vectors and split_measurements.
Latency reporting and tests
crates/ourios-bench/tests/rfc0031_comparative.rs
Reports warm latency values, Loki/Ourios ratios, and Floor outcomes, with unit tests for median and gate behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant ComparativeRunner
  participant Ourios
  participant Loki
  participant IndicativeReport
  ComparativeRunner->>Ourios: Execute repeated in-process queries
  Ourios-->>ComparativeRunner: Return latency samples
  ComparativeRunner->>Loki: Execute repeated query_range requests
  Loki-->>ComparativeRunner: Return latency samples
  ComparativeRunner->>ComparativeRunner: Store and split measurements
  ComparativeRunner->>IndicativeReport: Render p50 values, ratio, and Floor result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning It covers the change and validation, but it doesn't follow the template: Summary, Related, and Checklist sections are missing or incomplete. Add the required Summary and Related sections, and include the Checklist with checkbox items for fmt, clippy, tests, docs/CHANGELOG, and RFC link if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed It matches the main change: adding the RFC 0031 latency_p50 channel and making RFC0031.7 measurable.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0031-latency-channel

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 missing RFC 0031 §3.6 latency_p50 “corroborating channel” to the comparative benchmark harness so scenario RFC0031.7’s latency floor can be measured and reported alongside the existing bytes gates.

Changes:

  • Introduces warm-p50 latency measurement for both Ourios (in-process) and Loki (localhost HTTP), using 7 post-correctness repetitions and reporting the median.
  • Implements an RFC0031.7 latency floor check by reusing ourios_bench::bytes_within_floor over nanosecond integers.
  • Extends the per-pair measurement plumbing/report output and adds unit tests for median + floor behavior.

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

Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs

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 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs
Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs
…e the timing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQY9wfrfRggqSpMLH8Xj3Y

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 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/tests/rfc0031_comparative.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 1 out of 1 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit 13087bd into main Jul 12, 2026
27 checks passed
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