Repository navigation
fix: respect workspace root ignores when packing - #12878
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesWorkspace-aware package packing
Estimated code review effort: 4 (Complex) | ~45 minutes Assessment against linked issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm11/fs/packlist/src/index.ts (1)
22-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the shared
is-subdirhelper instead of the local duplicate.
This check already exists in the repo, so keep the containment logic centralized rather than reimplementing it here.🤖 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 `@pnpm11/fs/packlist/src/index.ts` around lines 22 - 35, The containment check in packlist is duplicating logic that already exists elsewhere in the repo. Update packlist in the packlist module to use the shared is-subdir helper instead of the local containment implementation, keeping the workspaceDir and resolvedPkgDir decision centralized while preserving the existing packlistOpts behavior.Source: Coding guidelines
pacquet/crates/fs-packlist/src/tests.rs (1)
435-458: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a test for
.npmignoreprecedence in the workspace root.
add_workspace_ignore_fileselects.npmignoreover.gitignorewhen both exist, but all workspace tests use only.gitignore. A test with a workspace-root.npmignorewould guard the precedence logic against regressions.♻️ Suggested additional test
+#[test] +fn workspace_root_npmignore_takes_precedence_over_gitignore() { + let dir = tempdir().unwrap(); + fs::write(dir.path().join(".gitignore"), "src/\n").unwrap(); + fs::write(dir.path().join(".npmignore"), "dist/\n").unwrap(); + let root = dir.path().join("packages").join("pkg"); + fs::create_dir_all(&root).unwrap(); + touch(&root, "package.json"); + touch(&root, "dist/generated.js"); + touch(&root, "src/index.js"); + + let manifest = json!({ "name": "x", "version": "0.0.0" }); + let out = packlist_with_options( + &root, + &manifest, + PacklistOptions { workspace_dir: Some(dir.path()) }, + ) + .unwrap(); + + // .npmignore excludes dist/, .gitignore's src/ is ignored + assert!(!out.contains(&"dist/generated.js".to_string()), "{out:?}"); + assert!(out.contains(&"src/index.js".to_string()), "{out:?}"); +}🤖 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 `@pacquet/crates/fs-packlist/src/tests.rs` around lines 435 - 458, Add a workspace-root ignore precedence test in tests.rs to cover add_workspace_ignore_file behavior when both .npmignore and .gitignore exist. Create a case around packlist_with_options and workspace_dir where the workspace root has both files, with .npmignore taking precedence over .gitignore, and assert the resulting packlist reflects the .npmignore rules rather than the .gitignore rules. Use the existing workspace_root_gitignore_excludes_workspace_package_files test pattern and the add_workspace_ignore_file/packlist_with_options symbols to locate the right test area.
🤖 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 `@pacquet/crates/fs-packlist/src/tests.rs`:
- Around line 435-458: Add a workspace-root ignore precedence test in tests.rs
to cover add_workspace_ignore_file behavior when both .npmignore and .gitignore
exist. Create a case around packlist_with_options and workspace_dir where the
workspace root has both files, with .npmignore taking precedence over
.gitignore, and assert the resulting packlist reflects the .npmignore rules
rather than the .gitignore rules. Use the existing
workspace_root_gitignore_excludes_workspace_package_files test pattern and the
add_workspace_ignore_file/packlist_with_options symbols to locate the right test
area.
In `@pnpm11/fs/packlist/src/index.ts`:
- Around line 22-35: The containment check in packlist is duplicating logic that
already exists elsewhere in the repo. Update packlist in the packlist module to
use the shared is-subdir helper instead of the local containment implementation,
keeping the workspaceDir and resolvedPkgDir decision centralized while
preserving the existing packlistOpts behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6f55f734-358c-4d16-9e8b-1a264a21fb03
📒 Files selected for processing (8)
.changeset/workspace-pack-gitignore.mdpacquet/crates/fs-packlist/src/lib.rspacquet/crates/fs-packlist/src/tests.rspacquet/crates/pack/src/lib.rspacquet/crates/pack/src/tests.rspnpm11/fs/packlist/src/index.tspnpm11/releasing/commands/src/publish/pack.tspnpm11/releasing/commands/test/publish/pack.ts
Use the shared subdirectory helper for workspace package containment, and add pacquet coverage for workspace-root .npmignore precedence. Constraint: CodeRabbit requested both follow-ups on pnpm#12878. Rejected: keep local containment helper | duplicates repo dependency logic. Confidence: high Scope-risk: narrow Directive: Keep workspace .gitignore and .npmignore cases covered. Tested: corepack pnpm --filter fs.packlist test Tested: cargo test -p pacquet-fs-packlist workspace_root_npmignore... Tested: cargo test -p pacquet-fs-packlist Tested: cargo fmt --all -- --check Tested: git diff --check Not-tested: full Rust workspace coverage job; unrelated rust-lld bus error.
|
Addressed the two CodeRabbit follow-ups in ff678e2:
Validation:
The current Pacquet coverage failure looks unrelated to this patch: rust-lld bus-error’d while compiling an unrelated Written by an agent (Codex, gpt-5.5). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12878 +/- ##
==========================================
- Coverage 85.36% 85.35% -0.01%
==========================================
Files 453 453
Lines 70913 71129 +216
==========================================
+ Hits 60533 60711 +178
- Misses 10380 10418 +38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.04467680114,
"stddev": 0.09031362384898364,
"median": 4.04873537294,
"user": 3.92674212,
"system": 3.4073684799999997,
"min": 3.92182071094,
"max": 4.22686728594,
"times": [
4.07040887894,
4.12432752594,
4.0286203809400005,
4.22686728594,
4.08552605994,
3.98913067694,
3.96281054694,
3.92182071094,
3.96840557994,
4.06885036494
]
},
{
"command": "pacquet@main",
"mean": 4.007850532440001,
"stddev": 0.1395913805804727,
"median": 3.94050554894,
"user": 3.87860872,
"system": 3.390073879999999,
"min": 3.86799831794,
"max": 4.22276206494,
"times": [
4.17255127894,
3.87389811594,
3.86799831794,
4.1909672569400005,
4.05076835194,
3.89929867594,
4.22276206494,
3.91925016394,
3.92503478894,
3.95597630894
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1226638064399994,
"stddev": 0.12155865314878607,
"median": 2.07377435744,
"user": 2.74823122,
"system": 2.90637518,
"min": 1.96416431294,
"max": 2.36501641694,
"times": [
2.36501641694,
1.96416431294,
2.05836521494,
2.09455182194,
2.06121008894,
2.07627203794,
2.07127667694,
2.05451250894,
2.20089202094,
2.28037696394
]
},
{
"command": "pnpr@main",
"mean": 2.0909331647399996,
"stddev": 0.1338715795807494,
"median": 2.03524020994,
"user": 2.75307412,
"system": 2.89897808,
"min": 1.94030529494,
"max": 2.3625102669399998,
"times": [
2.04424517094,
2.01899759594,
2.02553088194,
2.02623524894,
1.94030529494,
2.11315777594,
2.26996437894,
1.97116273994,
2.3625102669399998,
2.13722229294
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6451713154000001,
"stddev": 0.014670744181274668,
"median": 0.6438180758000001,
"user": 0.37910994,
"system": 1.3128093600000001,
"min": 0.6271159403000001,
"max": 0.6731296543,
"times": [
0.6335331353,
0.6369464233000001,
0.6561368343,
0.6360432273,
0.6506897283,
0.6535590513,
0.6271159403000001,
0.6299260503,
0.6731296543,
0.6546331093
]
},
{
"command": "pacquet@main",
"mean": 0.6753098011,
"stddev": 0.03102396752128259,
"median": 0.6666673193,
"user": 0.40594063999999996,
"system": 1.32950436,
"min": 0.6453064043,
"max": 0.7375876393,
"times": [
0.6492511983,
0.6609284773,
0.6745919953,
0.6704758663,
0.6520807723000001,
0.7230217973,
0.6453064043,
0.6769950883,
0.7375876393,
0.6628587723
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7225944738000001,
"stddev": 0.0651106814495016,
"median": 0.7021247938,
"user": 0.4014194399999999,
"system": 1.3586962599999999,
"min": 0.6782801293,
"max": 0.8995524083,
"times": [
0.6938562743,
0.6782801293,
0.6905705153,
0.6880116813,
0.7045498903,
0.7089879433,
0.6996996973,
0.8995524083,
0.7491861123,
0.7132500863
]
},
{
"command": "pnpr@main",
"mean": 0.7238659169,
"stddev": 0.020075260396655567,
"median": 0.7149335958,
"user": 0.42128694,
"system": 1.36651746,
"min": 0.7049314183000001,
"max": 0.7704071173,
"times": [
0.7355762793,
0.7049314183000001,
0.7081945663,
0.7148014233000001,
0.7150657683,
0.7131262863,
0.7342850133000001,
0.7338125703,
0.7084587263000001,
0.7704071173
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.27899435576,
"stddev": 0.031559136300764914,
"median": 4.278023924459999,
"user": 3.8432976599999997,
"system": 3.3214852,
"min": 4.234070851959999,
"max": 4.32920266596,
"times": [
4.26387317996,
4.27742878796,
4.28109825796,
4.284531696959999,
4.32902732496,
4.27861906096,
4.2733940839599995,
4.2386976469599995,
4.234070851959999,
4.32920266596
]
},
{
"command": "pacquet@main",
"mean": 4.29569984486,
"stddev": 0.027551288408503335,
"median": 4.29735465996,
"user": 3.8450591599999995,
"system": 3.3520851,
"min": 4.23787484996,
"max": 4.33890196296,
"times": [
4.23787484996,
4.293462884959999,
4.310030611959999,
4.307820201959999,
4.28830685996,
4.33890196296,
4.27581616396,
4.28293079796,
4.32060767996,
4.3012464349599995
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1591921637600002,
"stddev": 0.10248262486146335,
"median": 2.1287513989600004,
"user": 2.6160692599999997,
"system": 2.831214,
"min": 2.05307125096,
"max": 2.3481686079600004,
"times": [
2.08571422796,
2.05307125096,
2.06612526496,
2.32902024396,
2.1276083689600003,
2.1127258179600004,
2.3481686079600004,
2.18408817696,
2.12989442896,
2.1555052489600004
]
},
{
"command": "pnpr@main",
"mean": 2.2305007967600003,
"stddev": 0.10782126386082076,
"median": 2.2016992894600005,
"user": 2.6020024599999996,
"system": 2.8445989999999997,
"min": 2.10425796196,
"max": 2.4284018669600003,
"times": [
2.1809903689600003,
2.38846765296,
2.28049908396,
2.10425796196,
2.14964357796,
2.1700302709600003,
2.24541018796,
2.22240820996,
2.1348987859600004,
2.4284018669600003
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4723233588799998,
"stddev": 0.02115163566789662,
"median": 1.46936595318,
"user": 1.4350744199999999,
"system": 1.7275738400000002,
"min": 1.44685898668,
"max": 1.51637124068,
"times": [
1.44685898668,
1.46832887468,
1.45963628968,
1.48095080568,
1.46278560768,
1.4704030316799999,
1.51637124068,
1.4762854106799999,
1.49395369768,
1.44765964368
]
},
{
"command": "pacquet@main",
"mean": 1.4653002692800001,
"stddev": 0.029942987123392308,
"median": 1.45572321118,
"user": 1.44443772,
"system": 1.7361295399999999,
"min": 1.42874119868,
"max": 1.53421253468,
"times": [
1.53421253468,
1.47922467968,
1.4693143686799999,
1.45502857768,
1.45641784468,
1.45002114168,
1.45218486468,
1.42874119868,
1.43963737168,
1.48822011068
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6833559542799998,
"stddev": 0.005361953252112363,
"median": 0.6836801666800001,
"user": 0.3637065199999999,
"system": 1.28414544,
"min": 0.67464739868,
"max": 0.69206417168,
"times": [
0.68728458068,
0.67464739868,
0.68352586768,
0.69206417168,
0.6838344656800001,
0.68145457168,
0.67967171468,
0.68966027768,
0.68390487568,
0.67751161868
]
},
{
"command": "pnpr@main",
"mean": 0.7139234397800001,
"stddev": 0.07972258843093814,
"median": 0.6905073446800001,
"user": 0.38408032,
"system": 1.2811824400000003,
"min": 0.67748269268,
"max": 0.93989400168,
"times": [
0.69277166568,
0.68278840568,
0.69704418768,
0.67748269268,
0.69524554668,
0.69931791568,
0.68824302368,
0.68216139268,
0.93989400168,
0.68428556568
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.1763173531000004,
"stddev": 0.03589663771731859,
"median": 3.1703405231,
"user": 1.89877692,
"system": 2.01871494,
"min": 3.1297558466,
"max": 3.2374418646,
"times": [
3.1597126376,
3.1934382356,
3.1595110506,
3.1799834896,
3.1677993616,
3.1297558466,
3.1328803956,
3.2374418646,
3.1728816846,
3.2297689646000003
]
},
{
"command": "pacquet@main",
"mean": 3.1925073894,
"stddev": 0.046528550769399164,
"median": 3.1965458431,
"user": 1.92323412,
"system": 2.02811564,
"min": 3.1222197186000002,
"max": 3.2675108956,
"times": [
3.2433207366,
3.2101635006,
3.2252288806,
3.1724908026,
3.1921428416,
3.1222197186000002,
3.2009488446,
3.2675108956,
3.1397411926000003,
3.1513064806
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6757216233000001,
"stddev": 0.009418251746968078,
"median": 0.6747241661000001,
"user": 0.34841682,
"system": 1.2920717399999997,
"min": 0.6592656016,
"max": 0.6887997426,
"times": [
0.6854322736,
0.6737329706,
0.6666111086000001,
0.6684170796,
0.6592656016,
0.6887997426,
0.6742296646,
0.6795545096,
0.6752186676,
0.6859546146
]
},
{
"command": "pnpr@main",
"mean": 0.6927545328,
"stddev": 0.009992922370199534,
"median": 0.6881837381,
"user": 0.37690042,
"system": 1.27503754,
"min": 0.6813151406,
"max": 0.7131799426000001,
"times": [
0.7131799426000001,
0.6950710226,
0.6835813096,
0.6874339486000001,
0.6813151406,
0.6884338376,
0.6996569046,
0.6879336386,
0.6874526466,
0.7034869366000001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6638378356400001,
"stddev": 0.007481134311338952,
"median": 0.66213199434,
"user": 0.6177722799999998,
"system": 0.15763645999999998,
"min": 0.65277437234,
"max": 0.67693751634,
"times": [
0.65277437234,
0.66271560034,
0.66527290634,
0.6600057073400001,
0.6581644993400001,
0.6688964243400001,
0.6615483883400001,
0.6737469983400001,
0.67693751634,
0.6583159433400001
]
},
{
"command": "pacquet@main",
"mean": 0.6691866644400002,
"stddev": 0.006345139138838323,
"median": 0.66839052434,
"user": 0.62452458,
"system": 0.15706546,
"min": 0.65931355034,
"max": 0.67844291034,
"times": [
0.6621018333400001,
0.65931355034,
0.67844291034,
0.67560715634,
0.66820521034,
0.66857583834,
0.6656142983400001,
0.67530103434,
0.6736088413400001,
0.6650959713400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.11270734725666669,
"stddev": 0.002050154931948526,
"median": 0.11221040684000001,
"user": 0.02812132166666666,
"system": 0.021915976666666667,
"min": 0.11049644734000001,
"max": 0.12117060334000002,
"times": [
0.11136539634,
0.11286672234,
0.11361094234,
0.11049644734000001,
0.11190790434,
0.11245442234000001,
0.11196178434000001,
0.11239849534000002,
0.11214012234000001,
0.11201966934,
0.11217726234000001,
0.11242802934000001,
0.11194082734000001,
0.11217242534,
0.11213595234000001,
0.11293298034,
0.11594403234,
0.12117060334000002,
0.11134338934000002,
0.11252176734000001,
0.11224355134000001,
0.11240221534000001,
0.11167050834,
0.11267088334000001
]
},
{
"command": "pnpr@main",
"mean": 0.11229376963166665,
"stddev": 0.0005216715930386034,
"median": 0.11230576534,
"user": 0.027371321666666667,
"system": 0.021973893333333328,
"min": 0.11130790734000001,
"max": 0.11403581134000002,
"times": [
0.11268452334000001,
0.11230046534,
0.11191378334,
0.11227832234000001,
0.11240385734000001,
0.11241302134,
0.11242621534000001,
0.11254388534000001,
0.11203246834000001,
0.11403581134000002,
0.11130790734000001,
0.11231106534,
0.11160585234,
0.11193161434000001,
0.11257616234000001,
0.11190400934000001,
0.11206827134000001,
0.11269566934000001,
0.11233037934000001,
0.11204800134000001,
0.11185084034000001,
0.11276123634000002,
0.11195677634000001,
0.11267033234000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.744315746340002,
"stddev": 0.10455235451426777,
"median": 6.746865850040001,
"user": 4.078608220000001,
"system": 3.654186279999999,
"min": 6.60042453354,
"max": 6.91204809454,
"times": [
6.81296479554,
6.640667859540001,
6.771839772540001,
6.65064136454,
6.60042453354,
6.91204809454,
6.721891927540001,
6.857700411540001,
6.811993661540001,
6.662985042540001
]
},
{
"command": "pacquet@main",
"mean": 6.829679437339999,
"stddev": 0.13894560923603946,
"median": 6.825826565040001,
"user": 4.064100120000001,
"system": 3.6960718799999994,
"min": 6.65035673054,
"max": 7.081263922540001,
"times": [
6.823445914540001,
6.828207215540001,
6.99857977154,
7.081263922540001,
6.71881639754,
6.763642816540001,
6.90562372954,
6.65035673054,
6.66715857454,
6.859699300540001
]
},
{
"command": "pnpr@HEAD",
"mean": 4.88665880004,
"stddev": 0.13981589874099096,
"median": 4.852935976540001,
"user": 2.8544873199999996,
"system": 3.12803238,
"min": 4.743987346540001,
"max": 5.18435871754,
"times": [
4.882571978540001,
4.840398981540001,
4.74710991554,
4.89932901454,
4.79562168254,
4.83683461854,
4.865472971540001,
5.07090277354,
4.743987346540001,
5.18435871754
]
},
{
"command": "pnpr@main",
"mean": 4.923228451140001,
"stddev": 0.08343551232311357,
"median": 4.89200565554,
"user": 2.85479112,
"system": 3.1068084799999998,
"min": 4.82349252154,
"max": 5.06726109454,
"times": [
4.891979532540001,
5.0085575245400005,
5.06726109454,
4.885234069540001,
4.851392819540001,
5.023042425540001,
4.82349252154,
4.942234687540001,
4.847058057540001,
4.892031778540001
]
}
]
} |
|
| Branch | pr/12878 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,159.19 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 675.72 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 683.36 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 112.71 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,122.66 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,886.66 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 722.59 ms |
ebd887b to
202f1cb
Compare
Use the shared subdirectory helper for workspace package containment, and add pacquet coverage for workspace-root .npmignore precedence. Constraint: CodeRabbit requested both follow-ups on pnpm#12878. Rejected: keep local containment helper | duplicates repo dependency logic. Confidence: high Scope-risk: narrow Directive: Keep workspace .gitignore and .npmignore cases covered. Tested: corepack pnpm --filter fs.packlist test Tested: cargo test -p pacquet-fs-packlist workspace_root_npmignore... Tested: cargo test -p pacquet-fs-packlist Tested: cargo fmt --all -- --check Tested: git diff --check Not-tested: full Rust workspace coverage job; unrelated rust-lld bus error.
Workspace package packing should use workspace-root ignore context only when the package is actually inside that workspace. This keeps the default package-only packlist behavior unchanged while matching npm-packlist for workspace packages. Constraint: Keep TypeScript pnpm pack and pacquet pack behavior aligned. Rejected: Enabling parent ignore traversal generally | it would reintroduce arbitrary parent ignore leakage outside workspace context. Confidence: high Scope-risk: narrow Directive: Apply workspace ignore context only for actual workspace descendants. Tested: corepack pnpm --filter @pnpm/releasing.commands test pnpm11/releasing/commands/test/publish/pack.ts -t 'workspace root gitignore'; corepack pnpm --filter @pnpm/fs.packlist test; cargo fmt --all -- --check; cargo test -p pacquet-fs-packlist; cargo test -p pacquet-pack. Not-tested: Full repository CI matrix.
Use the shared subdirectory helper for workspace package containment, and add pacquet coverage for workspace-root .npmignore precedence. Constraint: CodeRabbit requested both follow-ups on pnpm#12878. Rejected: keep local containment helper | duplicates repo dependency logic. Confidence: high Scope-risk: narrow Directive: Keep workspace .gitignore and .npmignore cases covered. Tested: corepack pnpm --filter fs.packlist test Tested: cargo test -p pacquet-fs-packlist workspace_root_npmignore... Tested: cargo test -p pacquet-fs-packlist Tested: cargo fmt --all -- --check Tested: git diff --check Not-tested: full Rust workspace coverage job; unrelated rust-lld bus error.
Constraint: Keep derive ordering consistent with perfectionist. Confidence: high Scope-risk: narrow Tested: cargo test and cargo clippy for pacquet-fs-packlist; cargo fmt --check Not-tested: custom Dylint locally because cargo-dylint is not installed
The rebase onto main pulled in the new required PackOptions field before_packing_hooks; add it to the workspace-gitignore pack test so the crate compiles. Also name the pacquet wrapper in the changeset so the Rust side of this parity change is released alongside the TypeScript CLI. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
202f1cb to
df26590
Compare
Confidence Score: 5/5Safe to merge. The change is well-scoped: new opt-in options with correct guards, existing callers pass None/undefined and are unaffected, and the ignore-file walk is only activated when the package is a genuine descendant of the workspace root. The core logic is straightforward: a subdir check gates all new behavior, existing code paths pass None/undefined and remain unchanged, and both the TypeScript and Rust sides are covered by tests that exercise the positive, unrelated-workspace, and negation-override scenarios. No data mutation, no auth boundary, no async coordination concerns. No files require special attention beyond what the previous review threads already noted about the ignore crate's add_ignore precedence tier in pnpm/crates/fs-packlist/src/lib.rs. Reviews (2): Last reviewed commit: "test: cover package-level ignore negatio..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/fs-packlist/src/tests.rs (1)
435-511: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test for intermediate-directory ignore files.
add_workspace_ignore_filesadds ignore files from every ancestor directory between the workspace root and the package parent, but the three new tests only exercise the workspace-root case. A.gitignoreinpackages/(or any intermediate directory) would go untested. If someone later refactors the loop to only add the workspace root's file, these tests would still pass.🧪 Suggested intermediate-directory test
#[test] fn intermediate_directory_gitignore_excludes_workspace_package_files() { let dir = tempdir().unwrap(); let packages = dir.path().join("packages"); fs::create_dir_all(&packages).unwrap(); fs::write(packages.join(".gitignore"), "dist/\n").unwrap(); let root = packages.join("pkg"); fs::create_dir_all(&root).unwrap(); touch(&root, "package.json"); touch(&root, "dist/generated.js"); touch(&root, "src/index.js"); let manifest = json!({ "name": "x", "version": "0.0.0" }); let out = packlist_with_options( &root, &manifest, PacklistOptions { workspace_dir: Some(dir.path()) }, ) .unwrap(); assert!(out.contains(&"src/index.js".to_string()), "{out:?}"); assert!( !out.contains(&"dist/generated.js".to_string()), "intermediate-directory .gitignore must exclude `dist/`; received {out:?}", ); }🤖 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/fs-packlist/src/tests.rs` around lines 435 - 511, Add a test alongside the existing workspace ignore tests that places a .gitignore containing dist/ in the intermediate packages directory, then creates the package under packages/pkg with package.json, dist/generated.js, and src/index.js. Use packlist_with_options with workspace_dir set to the workspace root and assert src/index.js is included while dist/generated.js is excluded, verifying intermediate-directory ignore files are applied.
🤖 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/fs-packlist/src/tests.rs`:
- Around line 435-511: Add a test alongside the existing workspace ignore tests
that places a .gitignore containing dist/ in the intermediate packages
directory, then creates the package under packages/pkg with package.json,
dist/generated.js, and src/index.js. Use packlist_with_options with
workspace_dir set to the workspace root and assert src/index.js is included
while dist/generated.js is excluded, verifying intermediate-directory ignore
files are applied.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3e05bb49-5a5c-4cc6-93ac-00be7ecfc047
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yaml
📒 Files selected for processing (5)
.changeset/workspace-pack-gitignore.mdpnpm/crates/fs-packlist/src/lib.rspnpm/crates/fs-packlist/src/tests.rspnpm/crates/pack/src/lib.rspnpm/crates/pack/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/workspace-pack-gitignore.md
PR Code Suggestions ✨Latest suggestions up to abb45b4 Warning
Previous suggestionsSuggestions up to commit df26590
|
||||||||||||||||||
Address review feedback on the workspace-aware packlist change: - Add a parity test in both stacks proving a package-level `.npmignore` negation (`!dist/`) re-includes files the workspace-root `.gitignore` excluded. The Rust side adds workspace-root ignores at the lowest precedence tier (WalkBuilder::add_ignore), below the package's own discovered ignore files, so it matches npm-packlist's ancestor-first ordering rather than letting the workspace root win. - Document why a non-Normal path component halts the ancestor ignore walk in add_workspace_ignore_files. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit abb45b4 |
Summary
Squash Commit Body
Validation
corepack pnpm --filter @pnpm/releasing.commands test pnpm11/releasing/commands/test/publish/pack.ts -t 'workspace root gitignore'- passed\n-corepack pnpm --filter @pnpm/fs.packlist test- passed\n-cargo fmt --all -- --check- passed\n-cargo test -p pacquet-fs-packlist -- --nocapture- passed\n-cargo test -p pacquet-pack -- --nocapture- passed\n\n## Checklist\n\n- [x] The change is implemented in both the TypeScript CLI and the Rustpacquet/port, or the description notes what still needs porting.\n- [x] Added a changeset (pnpm changeset) if this PR changes any published package. Keep it short and written for pnpm users - it becomes a release note.\n- [x] Added or updated tests.\n- [x] Updated the documentation if needed.\nSummary by CodeRabbit
New Features
pnpm packnow uses workspace-root.npmignoreand.gitignorewhen packaging workspace packages..npmignoretakes precedence over.gitignore.Bug Fixes
Tests
Written by an agent (Codex, gpt-5.5).