Skip to content

Track Node and Bun benchmark trends with calibrated gates - #6329

Merged
proggeramlug merged 4 commits into
mainfrom
chore/benchmark-peer-gates
Jul 13, 2026
Merged

Track Node and Bun benchmark trends with calibrated gates#6329
proggeramlug merged 4 commits into
mainfrom
chore/benchmark-peer-gates

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

Hardens Perry's benchmark regression signal with complete Perry/Node/Bun distributions, peer-relative tracking, calibrated fast-benchmark noise handling, and deterministic Fastify HTTP diagnostics.

Changes

  • Records raw timing/RSS samples, derived distributions, exact runtime metadata, and Perry-to-peer ratios in schema-v2 artifacts.
  • Rejects missing benchmarks, failed processes, incomplete samples, inconsistent derived fields, malformed metadata, and unhealthy HTTP rows.
  • Replaces the global 100 ms escape hatch with robust per-benchmark MAD noise while preserving stable one-tick sensitivity.
  • Uses peer-relative vetoes only when baseline and current artifacts have matching pinned version and command metadata.
  • Tracks fixed-load Fastify throughput plus p50/p95/p99 distributions for Perry, Node, and Bun.
  • Leaves public performance tables, committed baseline values, and documentation unchanged.

Related issue

N/A — implements performance audit findings #6 and #7.

Test plan

  • python3 -m unittest discover -s tests -p 'test_benchmark_gate.py'
  • ./tests/test_benchmark_peer_fallback.sh
  • ./tests/test_benchmark_output_verifier.sh
  • python3 -m py_compile benchmarks/benchmark_gate.py tests/test_benchmark_gate.py
  • bash -n benchmarks/compare.sh benchmarks/honest_bench/run.sh tests/test_benchmark_peer_fallback.sh tests/test_benchmark_output_verifier.sh
  • Parsed .github/workflows/benchmark.yml and .github/workflows/test.yml with PyYAML.
  • git diff --check

Checklist

  • Tests cover new behavior and failure modes.
  • Public performance tables, baseline values, and documentation are unchanged.
  • The pull request is ready for review.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The benchmark pipeline now runs five-sample Perry, Node, and optional Bun comparisons, validates versioned JSON artifacts, applies noise-aware regression gates, and records deterministic Fastify HTTP tracking results with raw and summarized outputs.

Changes

Benchmark gating and tracking

Layer / File(s) Summary
Artifact schema and validation
benchmarks/benchmark_gate.py, tests/test_benchmark_gate.py
Adds version 2 artifact construction, normalization, validation, runtime distributions, metadata handling, and typed gate result models.
Regression and HTTP evaluation
benchmarks/benchmark_gate.py, tests/test_benchmark_gate.py
Evaluates correctness, threshold and noise-aware regressions, peer-relative ratios, improvements, and Fastify HTTP summaries through new CLI commands.
Multi-runtime benchmark collection
benchmarks/compare.sh, tests/test_benchmark_peer_fallback.sh
Adds optional Bun sampling, runtime fallback correctness checks, JSONL sample persistence, cleanup handling, and delegation to the artifact builder and comparator.
Deterministic Fastify tracking
.github/workflows/benchmark.yml, benchmarks/honest_bench/*
Runs five-sample benchmarks and fixed-load Fastify tracking with pinned runtime tooling, Bun coverage, metadata, summaries, and uploaded artifacts.
Pipeline documentation and validation
README.md, benchmarks/README.md, .github/workflows/test.yml, tests/*
Documents artifact and regression behavior and tests artifact validation, gate semantics, HTTP summaries, CI harness checks, and Bun-unavailable fallback behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CIWorkflow
  participant CompareScript
  participant BenchmarkGate
  participant HonestBench
  participant Oha
  CIWorkflow->>CompareScript: run five-sample runtime benchmarks
  CompareScript->>BenchmarkGate: build and compare benchmark artifacts
  BenchmarkGate-->>CIWorkflow: return regression gate report
  CIWorkflow->>HonestBench: run Fastify tracking workload
  HonestBench->>Oha: collect fixed-load HTTP metrics
  HonestBench-->>CIWorkflow: write raw results and metadata
  CIWorkflow->>BenchmarkGate: summarize HTTP results
  BenchmarkGate-->>CIWorkflow: write tracking summary
Loading

Possibly related PRs

  • PerryTS/perry#5564: Adds the Fastify workload and harness paths extended here for multi-runtime HTTP tracking.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 The title accurately summarizes the core change: benchmark trend tracking for Node and Bun with calibrated gating.
Description check ✅ Passed The description includes the required summary, changes, related issue, test plan, and checklist sections, with only optional screenshots omitted.
✨ 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 chore/benchmark-peer-gates

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.

@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: 2

🧹 Nitpick comments (1)
tests/test_benchmark_gate.py (1)

259-298: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover unhealthy HTTP samples.

Add cases for a nonzero exit_code and the intended invalid-success-rate condition. The documented artifact contract invalidates unhealthy samples, while this suite currently only covers incomplete samples and missing metrics.

🤖 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 `@tests/test_benchmark_gate.py` around lines 259 - 298, Extend the HTTP
summarization tests around summarize_http with cases covering a nonzero
exit_code and the documented invalid success-rate condition. Assert that each
unhealthy sample raises ArtifactError, while preserving the existing
incomplete-sample and missing-metric coverage.
🤖 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 `@benchmarks/README.md`:
- Around line 123-126: Update the runtime metadata documentation around
build_artifact() to avoid describing Perry’s compile command as a required
schema field. Mark the compile-command metadata optional, or state that
validation enforces it only where applicable, while preserving the existing
required runtime fields and fallback behavior.

In `@tests/test_benchmark_gate.py`:
- Around line 18-28: Update the fixture helpers runtime and record to preserve
explicitly supplied empty command and RSS lists: replace truthiness-based
fallbacks in command and rss with None-only defaulting. Keep defaults for
omitted arguments while allowing [] to remain unchanged so malformed empty
inputs are detected.

---

Nitpick comments:
In `@tests/test_benchmark_gate.py`:
- Around line 259-298: Extend the HTTP summarization tests around summarize_http
with cases covering a nonzero exit_code and the documented invalid success-rate
condition. Assert that each unhealthy sample raises ArtifactError, while
preserving the existing incomplete-sample and missing-metric coverage.
🪄 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: 619b104d-c3b6-43c7-b432-8ad294232d4c

📥 Commits

Reviewing files that changed from the base of the PR and between 2c32585 and 4a01393.

⛔ Files ignored due to path filters (1)
  • benchmarks/honest_bench/workloads/4_http_fastify/node/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • .github/workflows/benchmark.yml
  • README.md
  • benchmarks/README.md
  • benchmarks/benchmark_gate.py
  • benchmarks/compare.sh
  • benchmarks/honest_bench/run.sh
  • benchmarks/honest_bench/workloads/4_http_fastify/README.md
  • benchmarks/honest_bench/workloads/4_http_fastify/node/package.json
  • tests/test_benchmark_gate.py
  • tests/test_benchmark_peer_fallback.sh

Comment thread benchmarks/README.md Outdated
Comment thread tests/test_benchmark_gate.py 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 `@benchmarks/benchmark_gate.py`:
- Around line 268-269: Update validate_artifact so every completeness-only
validation, including sample-count checks, benchmark-set equality, and
derived-distribution requirements, is conditional on require_complete. Preserve
schema validation in both modes, while allowing evaluate_regressions to validate
incomplete baselines when it passes False; if leniency is not intended, remove
the unused parameter instead.
🪄 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: 7162aadb-8e54-4fd7-8f10-5c200c8577a8

📥 Commits

Reviewing files that changed from the base of the PR and between 4a01393 and 42844eb.

📒 Files selected for processing (9)
  • .github/workflows/benchmark.yml
  • .github/workflows/test.yml
  • README.md
  • benchmarks/README.md
  • benchmarks/benchmark_gate.py
  • benchmarks/compare.sh
  • benchmarks/honest_bench/workloads/4_http_fastify/README.md
  • tests/test_benchmark_gate.py
  • tests/test_benchmark_peer_fallback.sh
🚧 Files skipped from review as they are similar to previous changes (5)
  • README.md
  • benchmarks/README.md
  • benchmarks/honest_bench/workloads/4_http_fastify/README.md
  • .github/workflows/benchmark.yml
  • benchmarks/compare.sh

Comment thread benchmarks/benchmark_gate.py 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
benchmarks/benchmark_gate.py (1)

347-347: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

runtime_results["perry"] will KeyError instead of raising ArtifactError if Perry is unavailable.

Line 347 directly indexes runtime_results["perry"] without a guard. If Perry's runtime metadata were available: False, the loop at lines 301-306 would skip Perry, leaving it absent from runtime_results. This would produce an unhandled KeyError rather than a descriptive ArtifactError. While Perry should always be available in practice, the validator should enforce this explicitly.

🛡️ Proposed fix
         perry_result = runtime_results.get("perry")
-        perry_result = runtime_results["perry"]
+        if not perry_result:
+            raise ArtifactError(f"{name}: Perry runtime is required but missing")
         ratios = _mapping(entry.get("ratios"), f"{name}: ratios")
🤖 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 `@benchmarks/benchmark_gate.py` at line 347, Update the Perry validation flow
around runtime_results and the perry_result assignment to explicitly verify
Perry was available and produced a result before indexing it. Raise the existing
ArtifactError with a descriptive message when Perry is missing, while preserving
the current processing path when runtime_results contains "perry".
🤖 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.

Outside diff comments:
In `@benchmarks/benchmark_gate.py`:
- Line 347: Update the Perry validation flow around runtime_results and the
perry_result assignment to explicitly verify Perry was available and produced a
result before indexing it. Raise the existing ArtifactError with a descriptive
message when Perry is missing, while preserving the current processing path when
runtime_results contains "perry".

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 05eebc55-68bb-45d4-9047-d318d9768526

📥 Commits

Reviewing files that changed from the base of the PR and between 42844eb and b08060a.

📒 Files selected for processing (3)
  • .github/workflows/benchmark.yml
  • benchmarks/benchmark_gate.py
  • tests/test_benchmark_gate.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/benchmark.yml
  • tests/test_benchmark_gate.py

@proggeramlug
proggeramlug merged commit 7a3b48a into main Jul 13, 2026
25 checks passed
@proggeramlug
proggeramlug deleted the chore/benchmark-peer-gates branch July 13, 2026 04:39
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