Skip to content

test(pacquet): do not tolerate the lacking of tools#11713

Merged
zkochan merged 2 commits into
mainfrom
claude/replace-skip-with-unwrap-S1lMY
May 18, 2026
Merged

test(pacquet): do not tolerate the lacking of tools#11713
zkochan merged 2 commits into
mainfrom
claude/replace-skip-with-unwrap-S1lMY

Conversation

@KSXGitHub

@KSXGitHub KSXGitHub commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Drop the skip_if_no_git / skip_if_no_npm runtime probes in pacquet/crates/git-fetcher/src/fetcher/tests.rs. Each affected test now relies on the existing .unwrap() / .expect(...) calls — if git, node, or npm is missing, the test fails loudly instead of silently returning.

Silently skipping defeats the purpose of testing. Git is ubiquitous on dev machines and Node.js is a documented prerequisite for building pnpm, so there is no realistic environment where the suite should run and those tools should be absent. If they are, that's the environment's problem.

Also codify the rule in pacquet/AGENTS.md so future agent-authored ports don't reintroduce the pattern. Platform-locked tools are still allowed to gate via #[cfg(...)] or #[cfg_attr(..., ignore = "...")], which surface in the test report rather than disappearing into a return.

Test plan

  • cargo check -p pacquet-git-fetcher --tests --locked
  • cargo clippy -p pacquet-git-fetcher --tests --locked -- --deny warnings
  • cargo test -p pacquet-git-fetcher — 74/74 pass

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

Summary by CodeRabbit

  • Documentation
    • Added guidance forbidding tests that silently skip or early-return when external tools are missing; prefer loud failures or platform-gated compile-time ignores.
  • Tests
    • Removed runtime conditional skipping for missing tools; tests now run unconditionally and require external tools to be present, surfacing failures instead of skipping.

Review Change Stack

Replace runtime probe-and-skip helpers with the existing `.unwrap()`
calls — if `git`, `node`, or `npm` is missing the test will fail
loudly rather than silently return. Tolerance defeats the purpose of
testing: an under-provisioned environment is a bug in the environment,
not something the suite should paper over. Git is ubiquitous and
Node.js is a documented prerequisite for building pnpm.

Codify the rule in pacquet/AGENTS.md so future ports don't reintroduce
the pattern. Platform-locked tools are still allowed to gate via
`#[cfg(...)]` or `#[cfg_attr(..., ignore = "...")]`, which surface in
the test report instead of disappearing.

---
Written by an agent (Claude Code, claude-opus-4-7).
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f68258dc-ff5f-4c8d-af41-fafa7d44d27e

📥 Commits

Reviewing files that changed from the base of the PR and between 890dd72 and c2b73e8.

📒 Files selected for processing (1)
  • pacquet/plans/TEST_PORTING.md
✅ Files skipped from review due to trivial changes (1)
  • pacquet/plans/TEST_PORTING.md
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Lint and Test (windows-latest)
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Code Coverage
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Compile & Lint

📝 Walkthrough

Walkthrough

This PR adds a guidance rule forbidding runtime "tolerant" tests for missing external tools and removes PATH-probing skip helpers/guards from git-fetcher tests so those tests run unconditionally and fail loudly when tools like git/npm/node are absent.

Changes

Test Tolerance Policy and Enforcement

Layer / File(s) Summary
Tolerant test policy documentation
pacquet/AGENTS.md, pacquet/plans/TEST_PORTING.md
Added a "No 'tolerant' tests for missing tools" section to AGENTS.md forbidding runtime probe-and-skip patterns and updated the TEST_PORTING note to reflect that tests now fail loudly via .unwrap() when tools are missing.
Remove skip helpers and guards from git-fetcher tests
pacquet/crates/git-fetcher/src/fetcher/tests.rs
Removed skip_if_no_git and skip_if_no_npm helper functions and removed their early-return guards from multiple #[tokio::test] functions so tests run unconditionally instead of silently returning when git/npm/node are absent.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hops through CI with a grin,
No quiet skips — let failures sing!
Gates at compile-time keep the shore secure,
But runtime faults will ring out pure. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: removing silent tool-skip patterns (skip_if_no_git, skip_if_no_npm) to let tests fail explicitly when required tools are missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/replace-skip-with-unwrap-S1lMY

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 and usage tips.

@codecov-commenter

codecov-commenter commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11713      +/-   ##
==========================================
+ Coverage   88.92%   89.68%   +0.76%     
==========================================
  Files         129      129              
  Lines       14845    14858      +13     
==========================================
+ Hits        13201    13326     +125     
+ Misses       1644     1532     -112     

☔ View full report in Codecov by Sentry.
📢 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 May 18, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.03      7.6±0.28ms   571.1 KB/sec    1.00      7.3±0.06ms   590.5 KB/sec

@KSXGitHub KSXGitHub marked this pull request as ready for review May 18, 2026 08:40
@KSXGitHub KSXGitHub requested a review from zkochan as a code owner May 18, 2026 08:40
Copilot AI review requested due to automatic review settings May 18, 2026 08:40
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Scenario: Frozen Lockfile

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.436 ± 0.087 2.309 2.590 1.03 ± 0.05
pacquet@main 2.361 ± 0.080 2.274 2.548 1.00
pnpm 4.654 ± 0.030 4.601 4.686 1.97 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.43620817574,
      "stddev": 0.0870583789464612,
      "median": 2.43639748464,
      "user": 2.69442018,
      "system": 3.6541902,
      "min": 2.30934284114,
      "max": 2.5897108491400003,
      "times": [
        2.42292268514,
        2.50813800314,
        2.46099763914,
        2.5897108491400003,
        2.5022386241400003,
        2.42389028914,
        2.30934284114,
        2.44890468014,
        2.31373312514,
        2.38220302114
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.3608034719399997,
      "stddev": 0.07982887324293203,
      "median": 2.33624741814,
      "user": 2.7137985799999997,
      "system": 3.6281855999999997,
      "min": 2.27426231514,
      "max": 2.54780195314,
      "times": [
        2.32518226514,
        2.36198060414,
        2.2901866381400002,
        2.31457086514,
        2.27426231514,
        2.4131004541400003,
        2.34731257114,
        2.40872466914,
        2.32491238414,
        2.54780195314
      ]
    },
    {
      "command": "pnpm",
      "mean": 4.65380335764,
      "stddev": 0.029797301062884227,
      "median": 4.66580558464,
      "user": 7.95615108,
      "system": 4.0925464,
      "min": 4.60079030914,
      "max": 4.68637838314,
      "times": [
        4.66917115414,
        4.6624400151400005,
        4.68550662514,
        4.60079030914,
        4.62380772214,
        4.68637838314,
        4.63216156414,
        4.67239134914,
        4.67601119214,
        4.62937526214
      ]
    }
  ]
}

Scenario: Frozen Lockfile (Hot Cache)

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 704.4 ± 62.2 669.6 879.9 1.00
pacquet@main 734.4 ± 32.5 703.2 790.0 1.04 ± 0.10
pnpm 2511.3 ± 96.0 2381.1 2663.7 3.57 ± 0.34
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.70440574496,
      "stddev": 0.062233448187051434,
      "median": 0.6834164149599999,
      "user": 0.37877948000000006,
      "system": 1.5879343399999999,
      "min": 0.66955688496,
      "max": 0.87994479296,
      "times": [
        0.87994479296,
        0.69780552996,
        0.69107993796,
        0.68027252196,
        0.6960746639600001,
        0.68318387496,
        0.66955688496,
        0.68034516196,
        0.68364895496,
        0.68214512596
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7344441802600001,
      "stddev": 0.032549240880235954,
      "median": 0.72160832096,
      "user": 0.38396317999999996,
      "system": 1.6130340399999998,
      "min": 0.7032097269600001,
      "max": 0.78998346296,
      "times": [
        0.78998346296,
        0.70389381296,
        0.7716880619600001,
        0.71750279496,
        0.7243388979600001,
        0.7032097269600001,
        0.7770006339600001,
        0.71887774396,
        0.70817389096,
        0.72977277596
      ]
    },
    {
      "command": "pnpm",
      "mean": 2.51127179086,
      "stddev": 0.09596818453758928,
      "median": 2.52328249946,
      "user": 3.0270620799999994,
      "system": 2.2048831399999997,
      "min": 2.3811284599599998,
      "max": 2.6637088599600003,
      "times": [
        2.6637088599600003,
        2.56724612896,
        2.52269739796,
        2.46545491096,
        2.44202409796,
        2.38299796196,
        2.52704061496,
        2.52386760096,
        2.3811284599599998,
        2.63655187496
      ]
    }
  ]
}

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

Removes runtime “probe-and-skip” helpers from pacquet-git-fetcher tests so missing git / node / npm causes a hard test failure, and documents this testing rule in pacquet’s agent guidelines to prevent the pattern from being reintroduced.

Changes:

  • Deleted skip_if_no_git / skip_if_no_npm helpers and the early-return skips in git-fetcher tests.
  • Added an explicit “no tolerant tests for missing tools” guideline to pacquet/AGENTS.md, recommending #[cfg]/#[ignore] for truly platform-locked tooling.

Reviewed changes

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

File Description
pacquet/crates/git-fetcher/src/fetcher/tests.rs Removes silent skips so tool absence fails tests loudly.
pacquet/AGENTS.md Codifies a repo guideline forbidding runtime probe-and-skip test patterns.

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

Comment thread pacquet/AGENTS.md
Comment on lines +230 to +236
are forbidden. If the test needs a tool, just call into it and let the
existing `.unwrap()` / `.expect(...)` panic when the tool is absent — a
failing test in an under-provisioned environment is the correct signal.
Tolerance defeats the purpose of testing: if the environment really
doesn't have the required tools, that's the *environment's* fault and it
needs to be fixed.

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.

Good catch — fixed in c2b73e8. The entry for fetcher_runs_prepare_script_when_allowed now describes the loud-failure approach and points readers at the new pacquet/AGENTS.md rule instead of the deleted helper.


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


Generated by Claude Code

The TEST_PORTING.md entry for fetcher_runs_prepare_script_when_allowed
still advertised the deleted `skip_if_no_npm` helper as the recommended
pattern. Reword it to match the new AGENTS.md rule: rely on the existing
`.unwrap()` calls and let missing tools fail the test loudly.

Spotted by Copilot review on #11713.

---
Written by an agent (Claude Code, claude-opus-4-7).
@zkochan zkochan merged commit a671dda into main May 18, 2026
28 checks passed
@zkochan zkochan deleted the claude/replace-skip-with-unwrap-S1lMY branch May 18, 2026 09:01
KSXGitHub pushed a commit that referenced this pull request May 18, 2026
origin/main advanced with two PRs:

- #11712 (feat: report lockfile verification progress) — TS only.
  Adds a new `lockfile_verification` logger channel and renders its
  progress in `cli/default-reporter`. No pacquet code touched.
- #11713 (test(pacquet): do not tolerate the lacking of tools) —
  hardens `git-fetcher/src/fetcher/tests.rs` so that missing host
  tools fail the test instead of being silently skipped, plus a
  paragraph in `pacquet/AGENTS.md` and a checkbox in
  `pacquet/plans/TEST_PORTING.md`.

Both auto-merged cleanly with this branch — only one touched a file
this branch also changed (`fetcher/tests.rs`, where rc.14 renamed
two closure params), and git's merge driver resolved it without
manual intervention.

`cargo check --workspace --tests --locked`, `cargo dylint --all --
--all-targets --workspace`, and `cargo fmt --check` all clean
post-merge.
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.

5 participants