Skip to content

test(install): count the manifest opens of an up-to-date install and run - #17653

Merged
zkochan merged 1 commit into
mainfrom
fast-path-manifest-open-count
Nov 4, 2026
Merged

zkochan merged 1 commit into
mainfrom
fast-path-manifest-open-count

Conversation

@zkochan

@zkochan zkochan commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes the verification item of pnpm/tasks#256. #17637 and #17647 made an up-to-date pnpm install, and a pnpm run gated by verifyDepsBeforeRun, decide from the workspace state's manifest records. Their tests observed that through a debug trace, which a read added anywhere else would not change.

No filesystem seam reaches project discovery and the checks. So on Linux these tests watch the project manifests other than the workspace root's through inotify and count IN_OPEN events:

  • An up-to-date install opens neither project manifest.
  • An up-to-date gated pnpm run noop opens neither project manifest.
  • A control: after one manifest is edited, the install falls back to the files and opens the unchanged manifest too, so the count does see reads.
  • pnpm -r exec decides its gate from the records. This was a CodeRabbit nitpick on feat(run): decide the verify-deps gate from the recorded manifests #17647.

Disabling the install's records attempt makes the zero-open install test fail.

Squash Commit Body

The record-based fast paths promise that an up-to-date install, and a
gated `pnpm run`, open no project manifest that did not change. No
filesystem seam reaches discovery and the checks, so on Linux the tests
watch the non-active manifests through inotify and count IN_OPEN events.
A control test edits one manifest and asserts the fallback opens the
unchanged one, which shows the count sees reads at all. A recursive
`pnpm -r exec` test covers the records gate under a recursive command.

Part of pnpm/tasks#256.

Checklist

  • Added or updated tests.

Test-only, so no changeset or docs.


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

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Tests
    • Added platform-specific coverage for repeat installs and traced command runs, including checks for manifest access and successful execution.
    • Added checks for behavior after a project manifest changes and for trace reports that identify record-based gate decisions.

The record-based fast paths promise that an up-to-date install, and a
gated `pnpm run`, open no project manifest that did not change. No
filesystem seam reaches discovery and the checks, so on Linux the tests
watch the non-active manifests through inotify and count IN_OPEN events.
A control test edits one manifest and asserts the fallback opens the
unchanged one, which shows the count sees reads at all. A recursive
`pnpm -r exec` test covers the records gate under a recursive command.

Part of pnpm/tasks#256.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

Adds Linux-only tests that count project-manifest opens during install and gated runs. The tests check open counts for up-to-date installs, installs after a manifest edit, and traced command execution.

Changes: Repeat Install Records

Layer / File(s) Summary
Linux open-event test support
pnpm/crates/cli/tests/suite/repeat_install_records.rs, pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs
Adds a Linux-only test module, inotify-based open-event counting helpers, and helpers to identify project manifests and run install commands.
Manifest open assertions
pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs
Tests that an up-to-date install and a gated run open no non-root project manifests. After editing one manifest, a test checks that an unchanged project manifest is opened. A recursive exec test checks for GATE_DECIDED_FROM_RECORDS in the combined output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • pnpm/pnpm#17647: Adds records-based decisions for verifyDepsBeforeRun, which these tests exercise.
  • pnpm/pnpm#17625: Records trusted project-manifest stats used by the tested install and run fast paths.
  • pnpm/pnpm#17637: Adds records-based decisions for repeat installs, which these tests exercise.

Suggested labels: product: pacquet

Merge Risk: Minimal · up to 2717d

The change adds Linux tests. No merge-blocking risk was identified.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 0eae2c2 and 2717d76.

Files selected for processing: 2
  • pnpm/crates/cli/tests/suite/repeat_install_records.rs
  • pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                    pr
-----                                            ----                                    --
lockfile/parse_pnpm_lock                         1.00     14.6±0.84ms    25.7 MB/sec     1.02     14.8±1.11ms    25.2 MB/sec
packument/parse                                  1.07     46.3±5.52µs  1432.0 MB/sec     1.00     43.2±1.67µs  1536.5 MB/sec
tarball/download_dependency                      1.13  1138.3±251.01µs     3.7 MB/sec    1.00  1005.5±99.15µs     4.2 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   229.3±11.61ms 69.8 KElem/sec     1.04    237.4±3.21ms 67.4 KElem/sec
version_pick/repeated_ranges_file                1.00      5.1±0.35ms  6.1 KElem/sec     1.06      5.4±0.19ms  5.8 KElem/sec
version_pick/repeated_ranges_raw                 1.00      5.1±0.24ms  6.2 KElem/sec     1.05      5.3±0.11ms  5.9 KElem/sec
version_pick/wildcard_lowest                     1.00     40.1±2.53µs 24.4 KElem/sec     1.16     46.4±4.32µs 21.0 KElem/sec
workspace_resolution/hoist_heavy                 1.08   378.9±17.57ms        ? ?/sec     1.00   350.0±18.86ms        ? ?/sec
workspace_sort/chained_projects                  1.22     22.0±6.25ms        ? ?/sec     1.00     18.0±3.42ms        ? ?/sec

@zkochan
zkochan marked this pull request as ready for review November 4, 2026 00:45
Copilot AI balanced review requested due to automatic review settings November 4, 2026 00:45

@greptile-apps greptile-apps Bot 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Test manifest opens on up-to-date installs and gated runs

🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Verify up-to-date installs and gated runs do not open non-root project manifests.
• Confirm an edited manifest triggers filesystem reads, validating the open-count check.
• Cover the record-based dependency gate for recursive exec.
Diagram

graph TD
  W["Workspace fixtures"] --> S[("Manifest records")] --> M["Inotify watches"] --> C["CLI commands"] --> O["Open events"] --> A["Test assertions"]
  C --> T["Gate trace"] --> A
  M --> O
Loading
High-Level Assessment

The Linux-only inotify tests directly verify the absence of manifest opens without changing production code. Existing debug-trace assertions cannot detect reads added outside traced paths; a filesystem seam would require broader changes.

Files changed (2) +175 / -0

Tests (2) +175 / -0
repeat_install_records.rsEnable Linux-only manifest-open tests +3/-0

Enable Linux-only manifest-open tests

• Includes the new inotify-backed test module only on Linux, alongside the existing record-fast-path tests.

pnpm/crates/cli/tests/suite/repeat_install_records.rs

opens.rsCount manifest opens across install and run scenarios +172/-0

Count manifest opens across install and run scenarios

• Adds an inotify helper and tests that unchanged installs and gated runs open no non-root project manifests. An edited-manifest control confirms the counter detects fallback reads, and a recursive exec test checks that its gate decides from records.

pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.82%. Comparing base (0eae2c2) to head (2717d76).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17653   +/-   ##
=======================================
  Coverage   92.81%   92.82%           
=======================================
  Files        2074     2074           
  Lines      267563   267563           
=======================================
+ Hits       248347   248359   +12     
+ Misses      19216    19204   -12     

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

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Linux regression tests cannot compile 📘 Rule violation ▣ Testability
Description
read_open_events calls size_of without importing it or qualifying it with std::mem, so the new
Linux test target fails to compile. Every Linux test in this module is blocked before its assertions
run.
Code

pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs[40]

+    const HEADER: usize = size_of::<libc::inotify_event>();
Relevance

●●● Strong

Unqualified size_of causes a deterministic Rust compilation failure; recent suite test fixes were
accepted.

PR-#17647
PR-#17637

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed Linux test module imports several std items but not std::mem::size_of, while
read_open_events invokes the unqualified size_of symbol. Rust does not provide size_of through
the prelude, so this added test target cannot compile.

Rule 713440: Investigate and resolve all failing tests before merge
pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs[13-18]
pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs[38-40]

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

## Issue description
The Linux-only test module uses `size_of::<libc::inotify_event>()` without importing `size_of` or qualifying it with `std::mem`, causing the test target to fail compilation.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs[13-18]
- pnpm/crates/cli/tests/suite/repeat_install_records/opens.rs[38-40]

## Recommended Fix
Add `mem::size_of` to the existing `std` imports and call it as `size_of`, or qualify the call as `std::mem::size_of::<libc::inotify_event>()`. Run the Linux CLI test suite to confirm the module compiles and all assertions execute.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 60 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: ⚖️ Balanced: Low-level Linux instrumentation and multiple behavioral tests warrant careful review.

Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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

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.

🟢 Approval recommended

There are no active review issues for the Linux manifest fast-path regression test additions.

No open issues 🎉

What changed in this PR

Adds regression tests for the Rust CLI’s manifest-record fast paths, checking filesystem opens rather than relying only on debug traces. No production behavior changes.

Changes:

  • Uses Linux inotify to verify that up-to-date installs and gated runs open no non-root project manifests.
  • Adds an edited-manifest control to confirm the watcher detects fallback reads.
  • Checks that recursive exec decides its dependency gate from recorded manifests.
File Description
pnpm/​crates/​cli/​tests/​suite/​repeat_install_records/​opens.rs Adds the inotify helper and four regression tests.
pnpm/​crates/​cli/​tests/​suite/​repeat_install_records.rs Registers the new test module on Linux.

Review effort: Balanced

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Nov 4, 2026
@zkochan

zkochan commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Re Qodo's "Linux regression tests cannot compile": not a defect. size_of is in the Rust prelude since Rust 1.80, so it needs no import. Rust CI / Test / ubuntu compiled repeat_install_records::opens and ran its four tests, which passed on 2717d76. They also pass locally.


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

@zkochan
zkochan merged commit 016fd43 into main Nov 4, 2026
43 checks passed
@zkochan
zkochan deleted the fast-path-manifest-open-count branch November 4, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants