Skip to content

test(pacquet): recalibrate the peer-heavy pacquet-vs-pnpm floor - #13552

Merged
zkochan merged 1 commit into
mainfrom
fix-integrity-bench
Aug 1, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-integrity-bench

Conversation

@zkochan

@zkochan zkochan commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Summary

The peer-heavy integrated benchmark has failed on every main push since it
landed, e.g.
run 30699800078:

pacquet@HEAD was only 1.78x faster than pnpm@HEAD on the peer-heavy DAG;
required at least 10.00x (pacquet 1.651s, pnpm 2.943s)

The 10x floor was calibrated on
the benchmark's own PR run,
whose base predated #13504 — that PR merged nine minutes after the
benchmark run started, and landed on main twenty minutes before
#13545 did. #13504 removed exactly the per-edge work this
scenario stresses (filterPkgMetadataByPublishDate and semver re-parsing on
every dependency edge, offline hot cache), so the TypeScript arm collapsed:

target PR run (pre-13504) main run (post-13504)
pacquet@HEAD 1.467 s 1.651 s
pnpm@HEAD 34.663 s 2.943 s
ratio 23.6x 1.78x

pacquet did not move; TypeScript pnpm got ~12x faster on this workload. Both
failing main runs agree (1.78x and 1.72x), so this is not measurement noise.

This lowers the floor to 1.25x and documents what it is actually guarding.

Related to #13540.

Squash Commit Body

The peer-heavy scenario asserted that pacquet resolves the fixture at least
10x faster than the TypeScript CLI. That headroom was measured against a base
that still re-filtered the packument and re-parsed semver ranges once per
dependency edge on the offline hot-cache path. pnpm/pnpm#13504 removed that
per-edge work, so the same 401-package DAG now resolves in ~2.9s instead of
~34.4s and the ratio fell to ~1.7x, failing the benchmark on main.

Tie the floor to what the assertion is actually for: a peer-resolution blowup
of the kind pnpm/pnpm#13540 tracked runs slower than the TypeScript CLI (7.0s
versus 2.9s, ~0.4x), so 1.25x clears the run-to-run noise while still catching
it, and no longer breaks whenever the TypeScript resolver gets faster.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.

Written by an agent (Claude Code, claude-opus-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Documentation

    • Added guidance explaining the benchmark speedup threshold.
  • Bug Fixes

    • Adjusted the minimum expected speedup threshold to better reflect observed benchmark performance.

The peer-heavy scenario asserted that pacquet resolves the fixture at least
10x faster than the TypeScript CLI. That headroom was measured against a base
that still re-filtered the packument and re-parsed semver ranges once per
dependency edge on the offline hot-cache path. #13504 removed that
per-edge work, so the same 401-package DAG now resolves in ~2.9s instead of
~34.4s and the ratio fell to ~1.7x, failing the benchmark on main.

Tie the floor to what the assertion is actually for: a peer-resolution blowup
of the kind #13540 tracked runs slower than the TypeScript CLI (7.0s
versus 2.9s, ~0.4x), so 1.25x clears the run-to-run noise while still catching
it, and no longer breaks whenever the TypeScript resolver gets faster.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 1, 2026 13:10
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9345b6c7-e2e4-43b3-ae51-844c400b21ac

📥 Commits

Reviewing files that changed from the base of the PR and between 3f900cd and 562696e.

📒 Files selected for processing (1)
  • pnpm/tasks/integrated-benchmark/src/work_env.rs

📝 Walkthrough

Walkthrough

The integrated benchmark documents the peer-heavy speedup threshold and lowers PACQUET_PNPM_SPEEDUP_MIN from 10.0 to 1.25.

Changes

Integrated benchmark threshold

Layer / File(s) Summary
Update peer-heavy speedup threshold
pnpm/tasks/integrated-benchmark/src/work_env.rs
The benchmark documents the speedup floor and changes PACQUET_PNPM_SPEEDUP_MIN from 10.0 to 1.25.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • pnpm/pnpm#13545: Updates the peer-heavy benchmark speedup threshold in the same work_env.rs area.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ 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 fix-integrity-bench

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Recalibrate peer-heavy pacquet vs pnpm benchmark speedup floor

🧪 Tests 🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Lower the peer-heavy pacquet-vs-pnpm speedup threshold to avoid false failures on pnpm perf wins.
• Document that the check is meant to catch peer-resolution blowups, not enforce large headroom.
• Keep the integrated benchmark gate stable despite TypeScript resolver hot-cache improvements.
Diagram

graph TD
  A["Integrated benchmark run"] --> B["Hyperfine results"] --> C["BenchmarkDiagnostics"] --> D["WorkEnv verify"] --> E{Peer-heavy scenario?} --> F["Compute speedup pnpm/pacquet"] --> G["Assert >= 1.25x floor"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Baseline-relative threshold (rolling median)
  • ➕ Adapts automatically when pnpm/pacquet performance changes over time
  • ➕ Reduces manual recalibration when either side gets faster
  • ➖ Requires storing historical results and picking a robust window
  • ➖ More moving parts; can be flaky if baselines drift or data is sparse
2. Assert on absolute pnpm max time (instead of ratio)
  • ➕ Decouples the gate from pacquet changes; directly constrains pnpm runtime
  • ➕ Easier to interpret for regression tracking
  • ➖ Machine/CI variance makes absolute time assertions fragile
  • ➖ Doesn’t directly capture the intended ‘pacquet should stay ahead’ invariant

Recommendation: Keep the PR’s approach: a lowered fixed ratio plus explicit rationale is the simplest stable gate that still detects the targeted peer-resolution blowup, and it avoids tying CI to unrelated pnpm hot-cache improvements. Consider a baseline-relative scheme only if recalibration becomes frequent again.

Files changed (1) +6 / -1

Tests (1) +6 / -1
work_env.rsLower and document peer-heavy pacquet-vs-pnpm speedup floor +6/-1

Lower and document peer-heavy pacquet-vs-pnpm speedup floor

• Replaces the hardcoded minimum pacquet speedup threshold from 10.0x to 1.25x for the peer-heavy offline hot-cache scenario. Adds comments explaining that the check is intended to catch peer-resolution blowups and should not track unrelated pnpm resolver performance improvements.

pnpm/tasks/integrated-benchmark/src/work_env.rs

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge because the recalibrated threshold preserves the benchmark’s intended regression signal.

The changed threshold is applied in the correct ratio direction and remains between the documented healthy and regressed benchmark results.

Reviews (1): Last reviewed commit: "test(pacquet): recalibrate the peer-heav..." | Re-trigger Greptile

@zkochan
zkochan merged commit 5cf3a96 into main Aug 1, 2026
29 of 30 checks passed
@zkochan
zkochan deleted the fix-integrity-bench branch August 1, 2026 13:11
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Informational

1. Speedup floor comment historical 📘 Rule violation ⚙ Maintainability
Description
The newly added comment documents a past performance change (`dropped from ~34s to ~3s in
pnpm/pnpm#13504`) rather than strictly describing the current behavior/intent of the benchmark gate.
This violates the rule to avoid historical implementation notes in source comments (keep such
context in PR/commit history or design docs).
Code

pnpm/tasks/integrated-benchmark/src/work_env.rs[R35-39]

+// A pacquet peer-resolution blowup lands *below* 1x on this DAG, so the floor
+// only has to clear measurement noise, not encode how far ahead pacquet is.
+// The TypeScript resolver's own hot-cache cost moves independently — offline
+// resolution of this fixture dropped from ~34s to ~3s in pnpm/pnpm#13504 — and
+// a floor tracking that headroom would fail on every TypeScript perf win.
Relevance

● Weak

Similar “remove historical/temporal phrasing in comments” suggestions were rejected repeatedly in
this repo.

PR-#13408
PR-#13349

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that describe past behavior (temporal/historical phrasing).
The added comment explicitly references a historical runtime change (`dropped from ~34s to ~3s in
pnpm/pnpm#13504`).

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/tasks/integrated-benchmark/src/work_env.rs[35-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment includes historical/temporal performance context (e.g., referencing a prior drop in runtime), which should not live in source comments.

## Issue Context
Per the compliance rule, comments should describe current behavior/intent and constraints, not past implementations or historical changes.

## Fix Focus Areas
- pnpm/tasks/integrated-benchmark/src/work_env.rs[35-39]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Hardcoded speedup gate remains 🐞 Bug ☼ Reliability
Description
The peer-heavy benchmark still asserts a fixed minimum speedup (pnpm_mean / pacquet_mean >= 1.25),
so CI will fail whenever pnpm closes the gap below 1.25x even if pacquet is unchanged. This can
reintroduce recurring benchmark failures that require manual recalibration rather than strictly
guarding against the pathological “pacquet slower than pnpm” regression the comment describes.
Code

pnpm/tasks/integrated-benchmark/src/work_env.rs[R35-40]

+// A pacquet peer-resolution blowup lands *below* 1x on this DAG, so the floor
+// only has to clear measurement noise, not encode how far ahead pacquet is.
+// The TypeScript resolver's own hot-cache cost moves independently — offline
+// resolution of this fixture dropped from ~34s to ~3s in pnpm/pnpm#13504 — and
+// a floor tracking that headroom would fail on every TypeScript perf win.
+const PACQUET_PNPM_SPEEDUP_MIN: f64 = 1.25;
Relevance

● Weak

Very close precedent: suggestion to relax/make configurable PACQUET_PNPM_SPEEDUP_MIN gate was
rejected.

PR-#13545

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new constant/comment positions the floor as primarily noise clearance, but the runtime check
still treats it as a hard minimum speedup requirement; therefore the benchmark remains coupled to
pnpm’s absolute performance on this fixture.

pnpm/tasks/integrated-benchmark/src/work_env.rs[34-40]
pnpm/tasks/integrated-benchmark/src/work_env.rs[1185-1206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`verify_peer_heavy_pacquet_pnpm_ratio` currently enforces a fixed minimum speedup (`speedup >= PACQUET_PNPM_SPEEDUP_MIN`). Even with the lowered floor (1.25), this remains sensitive to upstream pnpm improvements: if pnpm gets within 25% of pacquet, the benchmark fails despite no pacquet regression.

### Issue Context
This assertion is intended as a regression gate for a peer-resolution blowup case, but it is implemented as an absolute headroom requirement.

### Fix Focus Areas
- pnpm/tasks/integrated-benchmark/src/work_env.rs[35-40]
- pnpm/tasks/integrated-benchmark/src/work_env.rs[1185-1206]

### Suggested fix
Adjust the assertion to match the intended regression signal rather than a fixed headroom multiple, e.g.:
- Gate only on pacquet not being slower than pnpm (with a small noise margin), such as `speedup >= 1.0 + epsilon` (or `pacquet <= pnpm * (1.0 - epsilon)`), where `epsilon` is calibrated to observed run-to-run noise.
- Alternatively, explicitly document that `1.25x` is an intentional minimum acceptable advantage (not just noise clearance) and add a short rationale for why 25% is expected to remain stable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

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.

🟢 Ready to approve

The change is a narrow, low-risk benchmark threshold recalibration consistent with the stated CI regression-gate intent.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Recalibrates the integrated benchmark guardrail for the peer-heavy (offline, hot-cache) scenario so it no longer fails on main after TypeScript pnpm’s resolver became significantly faster, while still catching pacquet peer-resolution regressions where pacquet falls behind pnpm.

Changes:

  • Lowered the minimum required pacquet-vs-pnpm speedup threshold for the peer-heavy DAG from 10.0x to 1.25x.
  • Added rationale explaining that the threshold is meant to clear measurement noise and catch peer-resolution blowups, not encode large headroom that can shrink as pnpm improves.
File summaries
File Description
pnpm/tasks/integrated-benchmark/src/work_env.rs Lowers the peer-heavy pacquet-vs-pnpm speedup floor and documents the intent of the regression gate.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +35 to +39
// A pacquet peer-resolution blowup lands *below* 1x on this DAG, so the floor
// only has to clear measurement noise, not encode how far ahead pacquet is.
// The TypeScript resolver's own hot-cache cost moves independently — offline
// resolution of this fixture dropped from ~34s to ~3s in pnpm/pnpm#13504 — and
// a floor tracking that headroom would fail on every TypeScript perf win.
@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     12.1±0.02ms    30.9 MB/sec    1.00     12.0±0.03ms    31.1 MB/sec
packument/parse                                  1.00     36.7±0.18µs  1809.3 MB/sec    1.07     39.2±0.17µs  1690.2 MB/sec
tarball/download_dependency                      1.05      2.3±0.06ms  1885.0 KB/sec    1.00      2.2±0.07ms  1970.2 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    176.4±1.78ms 90.7 KElem/sec    1.00    176.4±2.16ms 90.7 KElem/sec

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.93%. Comparing base (3f900cd) to head (562696e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13552      +/-   ##
==========================================
- Coverage   87.93%   87.93%   -0.01%     
==========================================
  Files         550      550              
  Lines       97112    97112              
==========================================
- Hits        85394    85393       -1     
- Misses      11718    11719       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants