Skip to content

test(pacquet): move module-level shared-mutable test statics into per-test-local state - #13256

Merged
zkochan merged 10 commits into
mainfrom
claude/pacquet-test-statics-di-fu7cgp
Jul 24, 2026
Merged

zkochan merged 10 commits into
mainfrom
claude/pacquet-test-statics-di-fu7cgp

Conversation

@KSXGitHub

@KSXGitHub KSXGitHub commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A test-only refactor implementing pacquet's dependency-injection convention (pnpm/CODE_STYLE_GUIDE.md, "Dependency injection for tests", principle 3): a stateful test fake keeps its state in an interior-mutable static inside each #[test] body, so tests get independent storage and can't race on it. Several test modules still hoisted that state to module scope — a thread_local! block or a column-0 static reconfigured across tests — and this moves each into per-test-local form.

Where a fake is shared across many tests, a module-local macro_rules! expands the fn-local state at the top of each test body, generating the helpers that only some tests use from named macro arguments (the login_fake! technique) so none needs an #[allow(dead_code)]. Recording-reporter fakes capture into a fn-local Mutex<Vec<LogEvent>> and filter at the assertion site, per the reporter-test convention.

Localizing the state also removes two serialization locks — store_path's PREFIX_PROBE_SCENARIO_LOCK and minimum_release_age's TEST_LOCK — the latter closing a latent race where a writer-only test wrote the shared buffer without holding the lock.

Resolves #12779.

Squash Commit Body

Implement pacquet's DI convention (CODE_STYLE_GUIDE.md, "Dependency
injection for tests", principle 3): a stateful test fake keeps its state
in an interior-mutable static inside each #[test] body, so tests get
independent storage and never race on it. Several test modules still
hoisted that state to module scope (a thread_local! block or a column-0
static); move each into per-test-local form.

Where a fake is shared across many tests, a module-local macro expands
the fn-local state at the top of each test body, generating the helpers
that only some tests use from named macro arguments (the login_fake!
technique) so none needs a dead_code allow. Recording-reporter fakes
capture into a fn-local Mutex<Vec<LogEvent>> and filter at the
assertion site.

Affected: network-web-auth (poll_for_web_auth_token,
prompt_browser_open), config (env resolution, store_path),
env-installer, package-manager (installability, minimum_release_age),
cli (bugs).

Localizing the state also removes two serialization locks (store_path's
PREFIX_PROBE_SCENARIO_LOCK and minimum_release_age's TEST_LOCK); the
latter closes a latent race where a writer-only test wrote the shared
buffer without the lock.

Test-only change; no runtime behavior changes.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port, or the description notes what still needs porting. — Test-only; no user-visible behavior, so no TypeScript-CLI counterpart is needed.
  • Added a changeset if this PR changes any published package. — N/A: test code only.
  • Added or updated tests. — This is the test refactor itself; each fake was re-verified by temporarily breaking the code it exercises to confirm it still catches the regression.
  • Updated the documentation if needed. — No documentation changes required.

Summary by CodeRabbit

  • Tests
    • Improved isolation by scoping simulated state to individual tests, including environment/cwd handling, URL recording, store-path link probing, web auth polling, browser open/enter-key flows, and reporter event capture.
    • Reduced cross-test interference and flakiness by replacing shared module-level fakes/state with per-test macro-driven setups and test-local storage.
    • Preserved validation for configuration precedence/auth, install and prompt events, browser interactions, and minimum release-age prompting.

…-test-local state

pacquet's dependency-injection convention (CODE_STYLE_GUIDE.md, "Dependency
injection for tests", principle 3) keeps a stateful test fake's state in an
interior-mutable static declared inside each `#[test]` body, so tests get
independent buffers and never race on it. Several test modules still hoisted
such state to module scope (a `thread_local!` block or a column-0 static),
where it was shared and reconfigured across tests.

Move each into the per-test-local form. Where a fake is reused across many
tests, a module-local macro expands the fn-local state at the top of each test
body, mirroring the `web_auth_fake!` macro from pacquet-network-web-auth-testing:

- network-web-auth/poll_for_web_auth_token: `poll_fake!` (TIME, SLEEP_BEHAVIOR,
  SLEEPS, FETCH plus the Clock/Sleep/WebAuthFetch fake).
- network-web-auth/prompt_browser_open: `browser_fake!` (STDIN_TTY,
  LISTEN_OUTCOME, OPEN_OUTCOME, ... plus the StdinIsTty/OpenUrl/EnterKeyListener
  fake); the tests that poked the thread-locals directly now go through
  `set_stdin_tty` / `set_listen_outcome` / `set_open_outcome` helpers.
- config: `fake_env!` (FAKE_ENV / FAKE_CWD plus the FakeEnv Sys fake).
- config/store_path: `prefix_probe!` (ALLOW_PREFIXES plus the PrefixProbe
  LinkProbe fake). Localizing the allowlist removes the need for the
  PREFIX_PROBE_SCENARIO_LOCK serialization lock, which existed only to keep
  parallel tests from racing a process-global allowlist.
- env-installer: the single-use CONFIG_DEP_EVENTS recording reporter moves into
  its one test body.
- package-manager/installability: `recording_reporter!` moves RECORDED_EVENTS
  from a module-level `thread_local!` to a fn-local `static Mutex<Vec<LogEvent>>`,
  matching the crate's other recording-reporter tests.

Test-only change; no runtime behavior changes. Resolves #12779.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
@coderabbitai

coderabbitai Bot commented Jul 23, 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: 30407735-04fb-4055-9f24-e43e74230609

📥 Commits

Reviewing files that changed from the base of the PR and between 92c24b8 and d346e65.

📒 Files selected for processing (1)
  • pnpm/crates/package-manager/src/minimum_release_age/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/package-manager/src/minimum_release_age/tests.rs

📝 Walkthrough

Walkthrough

The PR replaces module-level mutable test fakes, event buffers, and synchronization locks with per-test macro-generated or function-local state across CLI, configuration, web-auth, installer, and package-manager test suites.

Changes

Per-test Rust test harnesses

Layer / File(s) Summary
CLI browser recording harness
pnpm/crates/cli/src/cli_args/bugs/tests.rs
Browser URL recording and Bugs execution helpers are generated per test for local-project and registry scenarios.
Configuration test fakes
pnpm/crates/config/src/tests.rs, pnpm/crates/config/src/store_path/tests.rs
Environment, cwd, and linkability probes are scoped per test; registry-auth fixture generation is added.
Web authentication fakes
pnpm/crates/network-web-auth/src/.../tests.rs
Polling and browser-interaction fakes, reporter capture, setters, and inspection helpers are generated per test.
Installability event reporting
pnpm/crates/package-manager/src/installability/tests.rs
Reporter event buffers and reset/drain helpers are generated per test and used by affected assertions.
Minimum release age reporting
pnpm/crates/package-manager/src/minimum_release_age/tests.rs
Prompt event capture and prompt-action extraction move into a per-test reporter macro.
Environment installer event capture
pnpm/crates/env-installer/src/tests.rs
The event buffer, reporter, and status filtering helper are moved into the test function.

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

Assessment against linked issues

Objective Addressed Explanation
Move module-level shared mutable test state into per-test-local state, including the installability and store-path cases [#12779] ✅

Possibly related PRs

  • pnpm/pnpm#13062: Modifies the related minimum-release-age reporter and event-capture tests.

Suggested labels: product: pacquet

Suggested reviewers: zkochan, 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 claude/pacquet-test-statics-di-fu7cgp

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.

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     10.7±0.22ms    35.1 MB/sec    1.04     11.1±1.02ms    33.6 MB/sec
packument/parse                1.00     38.3±0.87µs  1732.6 MB/sec    1.09     41.6±1.24µs  1593.8 MB/sec
tarball/download_dependency    1.00      2.9±0.18ms  1512.1 KB/sec    1.01      2.9±0.26ms  1492.5 KB/sec

@codecov-commenter

codecov-commenter commented Jul 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.91%. Comparing base (4737386) to head (d346e65).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13256   +/-   ##
=======================================
  Coverage   86.91%   86.91%           
=======================================
  Files         530      530           
  Lines       90785    90785           
=======================================
  Hits        78902    78902           
  Misses      11883    11883           

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

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: d346e65ad762

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.678 ± 0.137 2.498 2.886 1.71 ± 0.20
pacquet@main 2.524 ± 0.083 2.418 2.673 1.61 ± 0.18
pnpr@HEAD 1.611 ± 0.186 1.393 1.845 1.03 ± 0.16
pnpr@main 1.565 ± 0.167 1.352 1.807 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.67798093514,
      "stddev": 0.13709480575297397,
      "median": 2.66335336214,
      "user": 2.2448535799999996,
      "system": 1.7218190399999997,
      "min": 2.49775299964,
      "max": 2.88560768064,
      "times": [
        2.74575609564,
        2.74141354964,
        2.56727713964,
        2.87388525764,
        2.49775299964,
        2.65127955564,
        2.67542716864,
        2.88560768064,
        2.49798240964,
        2.64342749464
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5241240594399996,
      "stddev": 0.08320043115333704,
      "median": 2.50961704764,
      "user": 1.86965928,
      "system": 1.4416091399999997,
      "min": 2.41777942264,
      "max": 2.67261618164,
      "times": [
        2.51845029764,
        2.54417821264,
        2.6157731916399998,
        2.41777942264,
        2.43078140264,
        2.4704351776399998,
        2.67261618164,
        2.50078379764,
        2.59735586464,
        2.47308704564
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6114774730400003,
      "stddev": 0.1860765182055682,
      "median": 1.65122266414,
      "user": 1.11207678,
      "system": 1.1842984399999998,
      "min": 1.39324854164,
      "max": 1.8449520586400001,
      "times": [
        1.4085597476400002,
        1.7826228986400001,
        1.7647183636400001,
        1.4321297386400003,
        1.4170670686400002,
        1.8449520586400001,
        1.7450133136400001,
        1.7690309846400003,
        1.39324854164,
        1.55743201464
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5647105378400004,
      "stddev": 0.16706413055615027,
      "median": 1.5810919026400003,
      "user": 1.1044946800000002,
      "system": 1.2516667399999999,
      "min": 1.35209560664,
      "max": 1.8070153506400002,
      "times": [
        1.44960133464,
        1.35209560664,
        1.6437042726400002,
        1.3578467226400002,
        1.6112232556400001,
        1.41637179464,
        1.5509605496400003,
        1.67186673764,
        1.7864197536400002,
        1.8070153506400002
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 260.3 ± 8.3 244.7 270.6 1.00
pacquet@main 261.5 ± 15.8 244.6 297.0 1.00 ± 0.07
pnpr@HEAD 277.1 ± 6.5 269.9 288.4 1.06 ± 0.04
pnpr@main 278.1 ± 5.3 269.1 288.0 1.07 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2602509082400001,
      "stddev": 0.008292139187536251,
      "median": 0.26014781384,
      "user": 0.22012359999999997,
      "system": 0.5250427599999999,
      "min": 0.24465485284000002,
      "max": 0.27059786884000003,
      "times": [
        0.26962271184000003,
        0.26740677084000003,
        0.26492180584,
        0.25132357784000003,
        0.25837918684,
        0.24465485284000002,
        0.26024277684,
        0.27059786884000003,
        0.26005285084,
        0.25530667984
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26146165344000005,
      "stddev": 0.015797544197256683,
      "median": 0.25639334084,
      "user": 0.21226669999999997,
      "system": 0.5344589599999999,
      "min": 0.24456970284000001,
      "max": 0.29704876684000003,
      "times": [
        0.25623943684,
        0.24456970284000001,
        0.24849006784000002,
        0.26882011684,
        0.24938521484,
        0.26979373284,
        0.29704876684000003,
        0.27198204284000005,
        0.25174020784,
        0.25654724484
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27709119734,
      "stddev": 0.00653895348507229,
      "median": 0.27609251384,
      "user": 0.2212325,
      "system": 0.5408589599999998,
      "min": 0.26986557684,
      "max": 0.28840760684,
      "times": [
        0.27216313084000004,
        0.27778221984,
        0.27802005384,
        0.26986557684,
        0.28366434984,
        0.27147066384,
        0.27062350584,
        0.28451205784,
        0.27440280784000004,
        0.28840760684
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27811819704000007,
      "stddev": 0.00527296280726453,
      "median": 0.27915986034000007,
      "user": 0.22227889999999997,
      "system": 0.53417186,
      "min": 0.26907353384000005,
      "max": 0.28796428684,
      "times": [
        0.27324021884000005,
        0.27932701384,
        0.27899270684000005,
        0.27330131384,
        0.26907353384000005,
        0.28796428684,
        0.28042055284,
        0.28109687984000004,
        0.27702257684000003,
        0.28074288684000004
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.859 ± 0.055 2.783 2.959 1.75 ± 0.15
pacquet@main 2.830 ± 0.035 2.792 2.897 1.74 ± 0.14
pnpr@HEAD 1.629 ± 0.133 1.443 1.827 1.00
pnpr@main 1.707 ± 0.162 1.479 1.961 1.05 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.85930860448,
      "stddev": 0.05510005143516351,
      "median": 2.8594081116799996,
      "user": 1.90192746,
      "system": 1.4258357999999998,
      "min": 2.78310060768,
      "max": 2.95925919668,
      "times": [
        2.88223172968,
        2.8921820826799998,
        2.84524852768,
        2.90991505568,
        2.85927763168,
        2.95925919668,
        2.85953859168,
        2.78701673568,
        2.78310060768,
        2.81531588568
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.82970695328,
      "stddev": 0.035426020704316434,
      "median": 2.81990053618,
      "user": 1.8819857599999998,
      "system": 1.3660292999999997,
      "min": 2.79244031668,
      "max": 2.8968015766799997,
      "times": [
        2.79340124768,
        2.82379274868,
        2.81162131468,
        2.85655274768,
        2.79294912068,
        2.85572449468,
        2.81600832368,
        2.8577776416800003,
        2.8968015766799997,
        2.79244031668
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.62936284848,
      "stddev": 0.13294536642205093,
      "median": 1.6007262331799998,
      "user": 1.0837592600000001,
      "system": 1.117074,
      "min": 1.44330071268,
      "max": 1.82687513368,
      "times": [
        1.73393312868,
        1.82687513368,
        1.5661794066799999,
        1.54275881668,
        1.53717349168,
        1.82620311368,
        1.6352730596799998,
        1.51101551168,
        1.44330071268,
        1.6709161096799998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7071718874800001,
      "stddev": 0.16191211016938253,
      "median": 1.68589070168,
      "user": 1.1699175600000002,
      "system": 1.3163498999999999,
      "min": 1.4785358686799999,
      "max": 1.96116803368,
      "times": [
        1.55084874268,
        1.81355195068,
        1.82677788068,
        1.4785358686799999,
        1.8931380626799998,
        1.70130080868,
        1.96116803368,
        1.53945972468,
        1.6704805946799999,
        1.63645720768
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 634.5 ± 49.6 584.0 736.3 2.13 ± 0.18
pacquet@main 609.2 ± 31.4 571.9 666.1 2.05 ± 0.13
pnpr@HEAD 297.2 ± 10.8 285.2 320.1 1.00
pnpr@main 310.9 ± 18.6 287.1 359.6 1.05 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6344556276200001,
      "stddev": 0.049638600163982624,
      "median": 0.61814093822,
      "user": 0.7518407,
      "system": 0.7337576799999999,
      "min": 0.5839874207200001,
      "max": 0.7363454477200001,
      "times": [
        0.7363454477200001,
        0.6239231437200001,
        0.6073350227200001,
        0.62272177372,
        0.6387977157200001,
        0.5839874207200001,
        0.61113160472,
        0.7105944647200001,
        0.6135601027200001,
        0.5961595797200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6091770858200001,
      "stddev": 0.03142190270217875,
      "median": 0.6022859142200001,
      "user": 0.745607,
      "system": 0.6713698799999999,
      "min": 0.57188863972,
      "max": 0.66608988572,
      "times": [
        0.6205075057200001,
        0.66608988572,
        0.6407287727200001,
        0.6372965327200001,
        0.6131631377200001,
        0.5914086907200001,
        0.5877652467200001,
        0.5842476777200001,
        0.57188863972,
        0.5786747687200001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29722676932000003,
      "stddev": 0.010840426688328492,
      "median": 0.29639208772000003,
      "user": 0.2024828,
      "system": 0.5030195799999999,
      "min": 0.28519151372,
      "max": 0.32011644972000003,
      "times": [
        0.28519151372,
        0.29306862772000003,
        0.28647743172,
        0.29109583272,
        0.30149961972,
        0.30580736872000003,
        0.30196339972,
        0.29971554772000003,
        0.32011644972000003,
        0.28733190172
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31089392922000003,
      "stddev": 0.018599678098992895,
      "median": 0.30792446972,
      "user": 0.19168929999999998,
      "system": 0.54796578,
      "min": 0.28714840872,
      "max": 0.35959873372,
      "times": [
        0.35959873372,
        0.31170450472,
        0.30509829072,
        0.31093831972,
        0.31230397672000004,
        0.30439750772,
        0.30845794472,
        0.30190061072,
        0.30739099472000003,
        0.28714840872
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.987 ± 0.032 1.949 2.037 6.25 ± 0.24
pacquet@main 1.981 ± 0.026 1.946 2.029 6.23 ± 0.23
pnpr@HEAD 0.326 ± 0.005 0.320 0.337 1.03 ± 0.04
pnpr@main 0.318 ± 0.011 0.302 0.335 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9871676686600002,
      "stddev": 0.03168995362956608,
      "median": 1.97986191026,
      "user": 1.0562912199999999,
      "system": 0.8075189799999999,
      "min": 1.9490131452600001,
      "max": 2.0371508122599997,
      "times": [
        2.03365072726,
        1.97067283326,
        1.95332797726,
        1.9490131452600001,
        2.01061563126,
        2.0371508122599997,
        1.98905098726,
        1.9955013802600001,
        1.96921699726,
        1.9634761952600002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9813993423600003,
      "stddev": 0.026235430962562027,
      "median": 1.9815517067600001,
      "user": 1.07122132,
      "system": 0.81054928,
      "min": 1.9461794572600002,
      "max": 2.0286423062599996,
      "times": [
        2.00433305226,
        2.0286423062599996,
        1.99510886526,
        2.00162919826,
        1.9824445942600002,
        1.9461794572600002,
        1.95784542826,
        1.98065881926,
        1.95789095326,
        1.95926074926
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32632466926000003,
      "stddev": 0.0049870208839796395,
      "median": 0.32517436676,
      "user": 0.20484032000000002,
      "system": 0.5696996799999998,
      "min": 0.31991143326000004,
      "max": 0.33733764426,
      "times": [
        0.32792496326000004,
        0.31991143326000004,
        0.33733764426,
        0.32315390826,
        0.32246939426000004,
        0.32646269526000005,
        0.32767560826000003,
        0.32388603826,
        0.33071770426,
        0.32370730326
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31790877766000003,
      "stddev": 0.010947112849999843,
      "median": 0.31576250276000006,
      "user": 0.20386902,
      "system": 0.5571443800000001,
      "min": 0.30175336226000005,
      "max": 0.33461289126000004,
      "times": [
        0.30175336226000005,
        0.33214513826000003,
        0.31001071926,
        0.31669550026000004,
        0.30804406526,
        0.33461289126000004,
        0.32212441826000004,
        0.32788510826,
        0.31482950526000003,
        0.31098706826
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 392.5 ± 6.1 381.7 402.2 4.47 ± 0.14
pacquet@main 396.1 ± 15.5 372.8 421.0 4.51 ± 0.22
pnpr@HEAD 88.9 ± 2.2 85.6 92.8 1.01 ± 0.04
pnpr@main 87.8 ± 2.5 85.2 97.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.39249612460000005,
      "stddev": 0.006132529949523271,
      "median": 0.3935099939,
      "user": 0.38884924,
      "system": 0.05971854,
      "min": 0.3816927579,
      "max": 0.4021783219,
      "times": [
        0.3866924499,
        0.3960752199,
        0.39621092290000004,
        0.39718377590000004,
        0.39543114290000003,
        0.3865858739,
        0.39132193590000003,
        0.3816927579,
        0.4021783219,
        0.3915888449
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3961447295,
      "stddev": 0.015480035386245075,
      "median": 0.3967032004,
      "user": 0.38453474,
      "system": 0.06034373999999999,
      "min": 0.3728331319,
      "max": 0.42098390890000004,
      "times": [
        0.42098390890000004,
        0.3761756939,
        0.3877347859,
        0.3728331319,
        0.4087337709,
        0.38676722290000004,
        0.4062726619,
        0.4001326599,
        0.40853971790000004,
        0.3932737409
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.088891137025,
      "stddev": 0.002195248876816312,
      "median": 0.08849876790000001,
      "user": 0.023136415,
      "system": 0.00857417125,
      "min": 0.08559805890000001,
      "max": 0.09284659690000001,
      "times": [
        0.08886153190000001,
        0.08842963290000001,
        0.08596045790000001,
        0.08672988790000001,
        0.0889645059,
        0.09284659690000001,
        0.0921671539,
        0.0895128319,
        0.08839750290000001,
        0.09115200290000001,
        0.0872364679,
        0.0913548019,
        0.0881381779,
        0.09129226590000002,
        0.09154983790000001,
        0.08696934790000001,
        0.08751310590000001,
        0.0865559129,
        0.08687015290000001,
        0.0875381129,
        0.09071861090000001,
        0.08824404590000001,
        0.09196651890000002,
        0.09227903290000002,
        0.09093124890000001,
        0.0865840669,
        0.08858471390000001,
        0.09082004190000001,
        0.08559805890000001,
        0.08608434990000001,
        0.08856790290000001,
        0.08609750390000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08784384138484852,
      "stddev": 0.0024824812651319393,
      "median": 0.08699038790000001,
      "user": 0.021501873333333334,
      "system": 0.009851146666666668,
      "min": 0.0851629239,
      "max": 0.09779300390000001,
      "times": [
        0.0851629239,
        0.08613589590000001,
        0.09173545490000001,
        0.08991376390000001,
        0.08779385190000001,
        0.0867008439,
        0.08643488690000001,
        0.08689975790000001,
        0.0859345199,
        0.08725882990000002,
        0.0867720279,
        0.0866960959,
        0.0864359179,
        0.08762700990000001,
        0.08688128290000001,
        0.08753125090000001,
        0.09142073590000001,
        0.08662495190000001,
        0.08699038790000001,
        0.08560411990000001,
        0.08809989590000002,
        0.0863080489,
        0.0880310469,
        0.08673579090000001,
        0.08679210590000001,
        0.08731565690000001,
        0.0877377569,
        0.0866608199,
        0.08736931690000001,
        0.09284948290000002,
        0.09779300390000001,
        0.08948074190000001,
        0.08711858790000002
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.542 ± 0.043 4.480 4.598 1.27 ± 0.03
pacquet@main 4.576 ± 0.060 4.484 4.673 1.28 ± 0.03
pnpr@HEAD 3.602 ± 0.117 3.483 3.811 1.01 ± 0.04
pnpr@main 3.576 ± 0.084 3.461 3.705 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.542388229579999,
      "stddev": 0.04282176529455234,
      "median": 4.54836416028,
      "user": 2.14618802,
      "system": 1.60139902,
      "min": 4.4800505482799995,
      "max": 4.5982800272799995,
      "times": [
        4.489938060279999,
        4.527819710279999,
        4.4800505482799995,
        4.590442597279999,
        4.49843570728,
        4.5748310632799996,
        4.53190541428,
        4.5982800272799995,
        4.56735626128,
        4.56482290628
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.575821948379999,
      "stddev": 0.06046841905419221,
      "median": 4.56554425228,
      "user": 2.1170959199999997,
      "system": 1.55860802,
      "min": 4.4841832112799995,
      "max": 4.67330614828,
      "times": [
        4.602831954279999,
        4.53171170128,
        4.60867077228,
        4.4841832112799995,
        4.55576892528,
        4.52514750528,
        4.575319579279999,
        4.6600141192799995,
        4.67330614828,
        4.54126556728
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6023183245800006,
      "stddev": 0.11674620749002905,
      "median": 3.59870529028,
      "user": 1.29065932,
      "system": 1.33853312,
      "min": 3.48272650028,
      "max": 3.81059334628,
      "times": [
        3.48272650028,
        3.61493819428,
        3.60686255428,
        3.81059334628,
        3.60717729328,
        3.54559534328,
        3.59054802628,
        3.78959464428,
        3.4908718312800002,
        3.48427551228
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5756584880799998,
      "stddev": 0.0842031559490526,
      "median": 3.55954890078,
      "user": 1.37832162,
      "system": 1.3963696200000002,
      "min": 3.46067797028,
      "max": 3.70451056828,
      "times": [
        3.46067797028,
        3.68864851928,
        3.51557593728,
        3.52184766728,
        3.58822943228,
        3.57245727128,
        3.66171267228,
        3.54664053028,
        3.49628431228,
        3.70451056828
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13256
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,783.10 ms
(-3.50%)Baseline: 2,883.90 ms
3,460.68 ms
(80.42%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,949.01 ms
(-2.71%)Baseline: 2,003.40 ms
2,404.08 ms
(81.07%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
583.99 ms
(-12.29%)Baseline: 665.85 ms
799.02 ms
(73.09%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
381.69 ms
(-8.18%)Baseline: 415.70 ms
498.84 ms
(76.52%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,497.75 ms
(+1.98%)Baseline: 2,449.28 ms
2,939.14 ms
(84.98%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,480.05 ms
(-0.98%)Baseline: 4,524.32 ms
5,429.18 ms
(82.52%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
244.65 ms
(-16.90%)Baseline: 294.40 ms
353.29 ms
(69.25%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13256
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,443.30 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
319.91 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
285.19 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.60 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,393.25 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,482.73 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
269.87 ms
🐰 View full continuous benchmarking report in Bencher

claude added 3 commits July 23, 2026 21:38
The poll_fake! / browser_fake! / fake_env! / prefix_probe! /
recording_reporter! macro doc comments described the refactor's
rationale — the per-test isolation motivation and a citation of the
CODE_STYLE_GUIDE.md "Dependency injection for tests" rule they follow.
A rustdoc comment should state only the item's final-state contract,
not why the change was made, so each is reduced to what the macro is
and which items it brings into the test function.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
A completeness scan turned up two module-level shared-mutable test
statics matching the same anti-pattern #12779 targets, which
the issue's enumerated list did not name:

- cli/src/cli_args/bugs/tests.rs: the OPENED_URLS thread-local and the
  RecordingBrowser OpenUrl fake, shared across seven tests, become a
  per-test recording_browser! macro.
- package-manager/src/minimum_release_age/tests.rs: the module-level
  EVENTS recording-reporter buffer and its TEST_LOCK serialization guard
  become a per-test recording_reporter! macro. Once each test owns its
  own EVENTS there is nothing left to serialize, so TEST_LOCK is gone;
  this also closes a latent race in which a writer-only test emitted
  into the shared buffer without holding the lock and could corrupt the
  reader tests' captured events.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy

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

🧹 Nitpick comments (4)
pnpm/crates/config/src/store_path/tests.rs (1)

74-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use concise regular comments for private test-harness rationale.

These rustdoc blocks narrate macro expansion rather than documenting a public API contract. Retain only the non-obvious isolation invariant as // comments.

  • pnpm/crates/config/src/store_path/tests.rs#L74-L81: replace the expansion walkthrough with a short rationale for per-test probe isolation.
  • pnpm/crates/config/src/tests.rs#L96-L103: replace generated-item documentation with a short rationale for isolated fake environment state.
  • pnpm/crates/config/src/tests.rs#L140-L143: convert the useful retry-isolation rationale to a regular comment.

As per coding guidelines, use rustdoc for public API contracts and regular comments only for non-obvious rationale or invariants. As per path instructions, test-harness comments should preserve contract through names rather than narrating behavior.

🤖 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 `@pnpm/crates/config/src/store_path/tests.rs` around lines 74 - 81, Replace the
private test-harness rustdoc with concise regular comments preserving only
non-obvious isolation rationale: in
pnpm/crates/config/src/store_path/tests.rs:74-81, explain per-test probe
isolation; in pnpm/crates/config/src/tests.rs:96-103, explain isolated fake
environment state; and in pnpm/crates/config/src/tests.rs:140-143, convert the
retry-isolation rationale to a regular comment. Do not narrate macro expansion
or generated-item behavior.

Sources: Coding guidelines, Path instructions

pnpm/crates/package-manager/src/installability/tests.rs (1)

16-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace expansion-narration rustdoc with a short rationale comment.

Both private test macros document their generated items line by line. Keep only the non-obvious isolation contract as a regular comment, or remove the comments.

  • pnpm/crates/package-manager/src/installability/tests.rs#L16-L21: replace the macro-expansion rustdoc with a brief regular comment explaining per-test event isolation.
  • pnpm/crates/package-manager/src/minimum_release_age/tests.rs#L50-L56: replace the macro-expansion rustdoc with a brief regular comment explaining per-test reporter isolation.

As per coding guidelines, “Do not write comments that merely restate code … or narrate the function body.” As per path instructions, comments should explain “non-obvious reasons or invariants.”

🤖 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 `@pnpm/crates/package-manager/src/installability/tests.rs` around lines 16 -
21, The comments above the private test macros are narrating their expansions
instead of documenting the invariant. In
pnpm/crates/package-manager/src/installability/tests.rs lines 16-21, replace the
rustdoc with a brief regular comment explaining per-test event isolation; make
the same change in pnpm/crates/package-manager/src/minimum_release_age/tests.rs
lines 50-56, explaining per-test reporter isolation. Remove the comments if no
concise rationale is needed.

Sources: Coding guidelines, Path instructions

pnpm/crates/env-installer/src/tests.rs (1)

877-883: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Record raw LogEvents in the reporter fake.

This stores only derived statuses. Capture Mutex<Vec<LogEvent>> and filter/assert InstallingConfigDeps events afterward, matching the required reporter-test harness contract.

As per path instructions, “when asserting reporter output, use a recording-fake reporter capturing into a static Mutex<Vec<LogEvent>> declared inside the #[test] body.”

🤖 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 `@pnpm/crates/env-installer/src/tests.rs` around lines 877 - 883, Update the
RecordingReporter test harness to store raw LogEvent values in a static
Mutex<Vec<LogEvent>> declared inside each relevant #[test] body, rather than
extracting InstallingConfigDepsStatus during emit. Filter the recorded events
afterward when asserting InstallingConfigDeps output, and update the reporter
tests to use this raw-event collection.

Source: Path instructions

pnpm/crates/network-web-auth/src/prompt_browser_open/tests.rs (1)

34-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use static Mutex<Vec<LogEvent>> for the reporter capture, per convention.

EMITTED is a thread_local! RefCell<Vec<(LogLevel, String)>> and RecordingReporter::emit destructures only the Global variant, whereas the documented convention for reporter/log-event testing is a static Mutex<Vec<LogEvent>> capturing the full LogEvent. Functionally harmless under the current single-threaded LocalSet tests, but it diverges from the pattern used elsewhere (e.g. CONFIG_DEP_EVENTS in pnpm/crates/env-installer/src/tests.rs) and loses event-variant information that a Mutex<Vec<LogEvent>> would retain.

As per pnpm/AGENTS.md: "when asserting reporter output, use a recording-fake reporter capturing into a static Mutex<Vec> declared inside the #[test] body; reset/clear at test start so retries and parallel runs can't interfere."

♻️ Sketch of the convention-aligned capture
-            static EMITTED: RefCell<Vec<(LogLevel, String)>> = const { RefCell::new(Vec::new()) };
+        static EMITTED: Mutex<Vec<LogEvent>> = Mutex::new(Vec::new());
-        struct RecordingReporter;
-
-        impl Reporter for RecordingReporter {
-            fn emit(event: &LogEvent) {
-                if let LogEvent::Global(GlobalLog { level, message }) = event {
-                    EMITTED.with(|emitted| emitted.borrow_mut().push((*level, message.clone())));
-                }
-            }
-        }
+        struct RecordingReporter;
+
+        impl Reporter for RecordingReporter {
+            fn emit(event: &LogEvent) {
+                EMITTED.lock().unwrap().push(event.clone());
+            }
+        }

(then have infos/warns/messages_at filter LogEvent::Global entries out of the locked Vec<LogEvent> instead of the pre-filtered tuple.)

Also applies to: 97-105

🤖 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 `@pnpm/crates/network-web-auth/src/prompt_browser_open/tests.rs` around lines
34 - 42, Replace the thread-local EMITTED tuple capture with the
convention-aligned static Mutex<Vec<LogEvent>> inside each test, clearing it at
test start. Update RecordingReporter::emit to store the complete LogEvent, and
adjust infos, warns, and messages_at to lock the capture and filter Global
variants when asserting output.

Source: Path instructions

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

Nitpick comments:
In `@pnpm/crates/config/src/store_path/tests.rs`:
- Around line 74-81: Replace the private test-harness rustdoc with concise
regular comments preserving only non-obvious isolation rationale: in
pnpm/crates/config/src/store_path/tests.rs:74-81, explain per-test probe
isolation; in pnpm/crates/config/src/tests.rs:96-103, explain isolated fake
environment state; and in pnpm/crates/config/src/tests.rs:140-143, convert the
retry-isolation rationale to a regular comment. Do not narrate macro expansion
or generated-item behavior.

In `@pnpm/crates/env-installer/src/tests.rs`:
- Around line 877-883: Update the RecordingReporter test harness to store raw
LogEvent values in a static Mutex<Vec<LogEvent>> declared inside each relevant
#[test] body, rather than extracting InstallingConfigDepsStatus during emit.
Filter the recorded events afterward when asserting InstallingConfigDeps output,
and update the reporter tests to use this raw-event collection.

In `@pnpm/crates/network-web-auth/src/prompt_browser_open/tests.rs`:
- Around line 34-42: Replace the thread-local EMITTED tuple capture with the
convention-aligned static Mutex<Vec<LogEvent>> inside each test, clearing it at
test start. Update RecordingReporter::emit to store the complete LogEvent, and
adjust infos, warns, and messages_at to lock the capture and filter Global
variants when asserting output.

In `@pnpm/crates/package-manager/src/installability/tests.rs`:
- Around line 16-21: The comments above the private test macros are narrating
their expansions instead of documenting the invariant. In
pnpm/crates/package-manager/src/installability/tests.rs lines 16-21, replace the
rustdoc with a brief regular comment explaining per-test event isolation; make
the same change in pnpm/crates/package-manager/src/minimum_release_age/tests.rs
lines 50-56, explaining per-test reporter isolation. Remove the comments if no
concise rationale is needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ebb9c48-48ac-49c4-b1c3-4aa0c562f3de

📥 Commits

Reviewing files that changed from the base of the PR and between f4ebdb9 and 743c502.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args/bugs/tests.rs
  • pnpm/crates/config/src/store_path/tests.rs
  • pnpm/crates/config/src/tests.rs
  • pnpm/crates/env-installer/src/tests.rs
  • pnpm/crates/network-web-auth/src/poll_for_web_auth_token/tests.rs
  • pnpm/crates/network-web-auth/src/prompt_browser_open/tests.rs
  • pnpm/crates/package-manager/src/installability/tests.rs
  • pnpm/crates/package-manager/src/minimum_release_age/tests.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 24, 2026

@KSXGitHub KSXGitHub left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Claude Code,

Below are many different reviews. Each may belong to different categories.

I wish that you do not collapse all the unrelated tasks into a single commit.

You shall analyze the reviews. You shall make groups of related reviews.

Each group of related reviews correspond to a task and a git commit.

A git commit should have its purpose clear and focused.

If there would be multiple groups of related reviews, then I expect multiple commits.

claude added 3 commits July 24, 2026 09:26
…ents

The test-fake macros' doc comments listed every item each macro expands and
narrated the expansion, which restates the code below them and drifts as the
macros change. These private test macros are not a rustdoc-visible API, so
state only the non-obvious per-test isolation rationale, and do so in regular
`//` comments rather than `///` rustdoc.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
… allows

The test-fake macros emitted their whole helper surface into every test, so
each test's unused helpers forced a blanket `#[allow(dead_code)]` on the
generated functions. Follow the `login_fake!` technique instead: emit the
always-used core unconditionally, and generate each optional helper from a
macro argument, so every test names exactly the helpers it drives and no
emitted helper is left unused. This drops every `dead_code` allow from these
macros. An unknown helper name now expands to a `compile_error!` naming the
valid helpers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
The reporter-test convention keeps a recording fake's capture in a
`Mutex<Vec<LogEvent>>` holding the raw events. Two fakes diverged:
prompt_browser_open kept a `thread_local! RefCell<Vec<(LogLevel, String)>>`
and env-installer stored the projected `InstallingConfigDepsStatus`. Capture
the full `LogEvent` in both and project or filter at the assertion site, so
the fakes match the convention and retain the complete event variant.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy

This comment was marked as resolved.

@KSXGitHub
KSXGitHub marked this pull request as ready for review July 24, 2026 12:35
@KSXGitHub
KSXGitHub requested a review from zkochan as a code owner July 24, 2026 12:35
Copilot AI review requested due to automatic review settings July 24, 2026 12:35
@greptile-apps

greptile-apps Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the scope of this follow-up review.

Reviews (3): Last reviewed commit: "refactor(pacquet): use a silent reporter..." | Re-trigger Greptile

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

This PR refactors pacquet (Rust) tests to follow the repository’s test dependency-injection convention (DI principle 3): mutable fake state is moved from module-level shared statics/thread-locals into per-#[test] function-local state to prevent cross-test races under parallel execution.

Changes:

  • Replaced module-level shared mutable test state with per-test-local fakes (often via small macro_rules! helpers that expand fn-local statics and optional helpers).
  • Removed test-wide serialization locks (e.g. TEST_LOCK, PREFIX_PROBE_SCENARIO_LOCK) by eliminating shared state that required them.
  • Standardized “recording reporter / browser” fakes to capture into fn-local Mutex<Vec<...>> buffers and filter at assertion sites.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm/crates/package-manager/src/minimum_release_age/tests.rs Introduces a per-test recording reporter macro and removes a global reporter buffer + async lock.
pnpm/crates/package-manager/src/installability/tests.rs Reworks the recording reporter from module-level thread-local state into per-test-local state via a helper macro.
pnpm/crates/network-web-auth/src/prompt_browser_open/tests.rs Moves stdin/browser/open/enter fakes + log capture into per-test-local state via a macro, avoiding module-level thread_locals.
pnpm/crates/network-web-auth/src/poll_for_web_auth_token/tests.rs Localizes clock/sleep/fetch fake state into fn-local thread_locals via a per-test macro.
pnpm/crates/env-installer/src/tests.rs Makes the config-deps recording reporter’s buffer test-local and filters the captured LogEvents at assertion time.
pnpm/crates/config/src/tests.rs Replaces module-level fake env thread_locals with a per-test macro that expands the env fake and optional helpers.
pnpm/crates/config/src/store_path/tests.rs Replaces shared allowlist + scenario lock with a per-test prefix_probe! macro and test-local allowlist state.
pnpm/crates/cli/src/cli_args/bugs/tests.rs Converts the browser URL recorder from module-level thread-local state to a per-test macro-based fake.

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

…s and warns

The `infos` and `warns` accessors in the `browser_fake!` test macro each
inlined the same `Global`-log-by-level filter, differing only in the level.
Move that projection into a module-level `global_messages_at` helper that both
delegate to. It stays live without a `dead_code` allow because a module-level
item is used as long as any test drives `infos` or `warns`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
Copilot AI review requested due to automatic review settings July 24, 2026 12:54

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

`non_interactive_strict_mode_reports_every_immature_pick` asserts only on the
returned error and the prompt messages; it never inspects reporter events.
Drive it with `SilentReporter` instead of the `recording_reporter!` fake, so it
no longer spins up a capture buffer nothing reads — matching the env-installer
tests, which record only when they assert on the recording.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BcmJgTLC8oQzWVLaRL8cy
Copilot AI review requested due to automatic review settings July 24, 2026 13:15

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

@zkochan
zkochan merged commit 209aa31 into main Jul 24, 2026
36 checks passed
@zkochan
zkochan deleted the claude/pacquet-test-statics-di-fu7cgp branch July 24, 2026 13:49
@coderabbitai coderabbitai Bot mentioned this pull request Aug 3, 2026
3 tasks done
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 state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(pacquet): move module-level shared-mutable test statics into per-test-local state (DI principle 3)

5 participants