Repository navigation
fix(diagnostics): report ERR_PNPM_* error codes, never pacquet ones - #13091
Conversation
📝 WalkthroughWalkthroughThis change standardizes diagnostic codes across pnpm Rust crates, tests, comments, and release documentation by replacing legacy or unprefixed identifiers with ChangesDiagnostic code migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
PR Summary by Qodofix(diagnostics): emit pnpm ERR_PNPM_* codes instead of pacquet/internal codes
AI Description
Diagram
High-Level Assessment
Files changed (85)
|
Confidence Score: 5/5This PR is safe to merge — it is a systematic rename of diagnostic codes with no logic changes, backed by a full 6128-test suite pass, zero-collision verification across all 259 rule-2 codes, and explicit parity guards added to the most security-sensitive paths. The change is purely additive to the public contract: users who already match on ERR_PNPM_* codes see no difference, and users matching old internal codes are warned by the changeset. The critical ERR_PNPM_TARBALL_INTEGRITY and ERR_PNPM_TRUST_DOWNGRADE paths — where pnpm matches the diagnostic code by name at runtime — are correctly aligned. The mislabeled FrozenLockfileWithUpdateChecksums correction is accurate and the doc-comment fix removes a genuinely misleading claim. No logic, data, or protocol changes are present. No files require special attention. The tarball/src/lib.rs and resolving-npm-resolver/src/trust_checks.rs changes are the most externally visible (pnpm matches their codes at runtime) and both are correctly aligned. Reviews (3): Last reviewed commit: "test: assert diagnostic codes, not just ..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Line 231: Update the stale diagnostic-code references in the comments adjacent
to the diagnostic attributes: in
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs at lines 231,
258, and 282, and in pnpm/crates/resolving-local-resolver/src/local_resolver.rs
at lines 117 and 126. Rename each documented identifier to its current
ERR_PNPM_* code, including both codes referenced at line 282, without changing
the diagnostic attributes or behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6a6c1213-c50e-4eeb-a8a4-9b61d3fc91cc
⛔ Files ignored due to path filters (1)
pnpm/crates/cli/tests/snapshots/init__should_throw_on_existing_file.snapis excluded by!**/*.snap,!**/*.snap
📒 Files selected for processing (85)
.changeset/pacquet-err-pnpm-error-codes.mdpnpm/crates/auth-commands/src/login/classic_login.rspnpm/crates/auth-commands/src/login/error.rspnpm/crates/auth-commands/src/login/test_classic_login.rspnpm/crates/auth-commands/src/login/test_web_login_errors.rspnpm/crates/auth-commands/src/logout.rspnpm/crates/cli/src/cli_args/config.rspnpm/crates/cli/src/cli_args/config/tests.rspnpm/crates/cli/src/cli_args/dlx.rspnpm/crates/cli/src/cli_args/exec.rspnpm/crates/cli/src/cli_args/patch.rspnpm/crates/cli/src/cli_args/patch_commit.rspnpm/crates/cli/src/cli_args/patch_remove.rspnpm/crates/cli/src/cli_args/patch_state.rspnpm/crates/cli/src/cli_args/prefix.rspnpm/crates/cli/src/cli_args/root.rspnpm/crates/cli/tests/deploy.rspnpm/crates/cli/tests/lockfile_only.rspnpm/crates/cli/tests/workspace_install.rspnpm/crates/cmd-shim/src/link_bins.rspnpm/crates/crypto-shasums-file/src/lib.rspnpm/crates/directory-fetcher/src/error.rspnpm/crates/engine-runtime-bun-resolver/src/bun_resolver.rspnpm/crates/engine-runtime-bun-resolver/src/read_bun_assets.rspnpm/crates/engine-runtime-deno-resolver/src/deno_resolver.rspnpm/crates/engine-runtime-deno-resolver/src/read_deno_assets.rspnpm/crates/engine-runtime-node-resolver/src/node_resolver.rspnpm/crates/engine-runtime-node-resolver/src/node_resolver/tests.rspnpm/crates/engine-runtime-node-resolver/src/parse_node_specifier.rspnpm/crates/engine-runtime-node-resolver/src/resolve_node_version.rspnpm/crates/env-installer/src/errors.rspnpm/crates/executor/src/lib.rspnpm/crates/executor/src/lifecycle.rspnpm/crates/executor/src/run_script.rspnpm/crates/exportable-manifest/src/create.rspnpm/crates/fs-packlist/src/lib.rspnpm/crates/git-fetcher/src/error.rspnpm/crates/lockfile/src/load_lockfile.rspnpm/crates/lockfile/src/save_lockfile.rspnpm/crates/modules-yaml/src/lib.rspnpm/crates/pack/src/lib.rspnpm/crates/package-manager/src/add.rspnpm/crates/package-manager/src/build_snapshot.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rspnpm/crates/package-manager/src/create_virtual_store.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_package_by_snapshot.rspnpm/crates/package-manager/src/install_package_from_registry.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/link_bins.rspnpm/crates/package-manager/src/link_manifest_link_deps.rspnpm/crates/package-manager/src/link_root_component_members.rspnpm/crates/package-manager/src/minimum_release_age.rspnpm/crates/package-manager/src/package_extender.rspnpm/crates/package-manager/src/patch.rspnpm/crates/package-manager/src/patch_commit.rspnpm/crates/package-manager/src/prune_direct_deps.rspnpm/crates/package-manager/src/symlink_direct_dependencies.rspnpm/crates/package-manager/src/update.rspnpm/crates/package-manifest/src/lib.rspnpm/crates/publish/src/extract_manifest_from_packed.rspnpm/crates/registry/src/lib.rspnpm/crates/resolving-default-resolver/src/lib.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-local-resolver/src/local_resolver.rspnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rspnpm/crates/resolving-npm-resolver/src/errors.rspnpm/crates/resolving-npm-resolver/src/mirror.rspnpm/crates/resolving-npm-resolver/src/pick_package.rspnpm/crates/resolving-npm-resolver/src/resolve_from_workspace.rspnpm/crates/resolving-npm-resolver/src/trust_checks.rspnpm/crates/store-dir/src/msgpackr_records.rspnpm/crates/store-dir/src/project_registry.rspnpm/crates/store-dir/src/prune.rspnpm/crates/store-dir/src/store_index.rspnpm/crates/tarball/src/lib.rspnpm/crates/versioning/src/error.rspnpm/crates/workspace-manifest-writer/src/lib.rspnpm/crates/workspace-projects-filter/src/filter.rspnpm/crates/workspace-state/src/lib.rspnpm/crates/workspace/src/manifest.rspnpm/crates/workspace/src/project_manifest.rspnpm/crates/workspace/src/projects.rspnpm/crates/workspace/src/root_finder.rs
PR Code Suggestions ✨Latest suggestions up to dfafc29 Warning
Previous suggestions✅ Suggestions up to commit 7c70e3c
|
||||||||||||||||||||
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": 2.5861872635800003,
"stddev": 0.13265033450760383,
"median": 2.56630163268,
"user": 2.13288264,
"system": 1.6679198200000003,
"min": 2.45966910918,
"max": 2.90851612118,
"times": [
2.50668567218,
2.56464514618,
2.62161343118,
2.6271550231800003,
2.56795811918,
2.47365344018,
2.45966910918,
2.90851612118,
2.4795817811800003,
2.65239479218
]
},
{
"command": "pacquet@main",
"mean": 2.8290269797799996,
"stddev": 0.1709923543112872,
"median": 2.83387158418,
"user": 2.71485614,
"system": 1.9799769199999997,
"min": 2.61308145318,
"max": 3.09701697218,
"times": [
2.8710115211800002,
3.09701697218,
2.61308145318,
2.6179550761800003,
2.79673164718,
2.8901961371800002,
2.66979508618,
2.91334801218,
2.75591687118,
3.06521702118
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7186378264799997,
"stddev": 0.18381766861093432,
"median": 1.6966779066800002,
"user": 1.76259624,
"system": 1.80251172,
"min": 1.50837824118,
"max": 2.00620577418,
"times": [
1.57049707018,
1.8678075281800002,
2.00620577418,
1.5348987041800002,
1.87668632918,
1.50837824118,
1.6126547551800001,
1.8862293191800001,
1.78070105818,
1.5423194851800002
]
},
{
"command": "pnpr@main",
"mean": 1.75201686758,
"stddev": 0.13607105030652814,
"median": 1.76569765768,
"user": 1.8047190400000002,
"system": 1.7936067200000003,
"min": 1.54092166118,
"max": 1.93483005918,
"times": [
1.8111612721800001,
1.54092166118,
1.93483005918,
1.7464141021800001,
1.7031267191800001,
1.84092705518,
1.56407951418,
1.92801586118,
1.78498121318,
1.6657112181800002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36006225388,
"stddev": 0.021845961397013215,
"median": 0.35928125048000004,
"user": 0.35523627999999996,
"system": 0.83634542,
"min": 0.33398698248,
"max": 0.40877190648,
"times": [
0.33398698248,
0.38167191048000004,
0.36182065148000003,
0.35178069548,
0.36128235748000004,
0.34080948548,
0.40877190648,
0.34193604848000003,
0.35826296748,
0.36029953348000004
]
},
{
"command": "pacquet@main",
"mean": 0.34825364778,
"stddev": 0.03184323781738148,
"median": 0.34085947998,
"user": 0.36223528,
"system": 0.7748560200000002,
"min": 0.30713385048,
"max": 0.40622939648,
"times": [
0.34443140948,
0.30713385048,
0.33728755048000003,
0.35003433548,
0.37549976248,
0.38720657948000003,
0.40622939648,
0.32964067348000003,
0.32440640348,
0.32066651648
]
},
{
"command": "pnpr@HEAD",
"mean": 0.37488366797999995,
"stddev": 0.016923294715895536,
"median": 0.38043089798000007,
"user": 0.38813237999999994,
"system": 0.79151862,
"min": 0.34973817748,
"max": 0.39479179948000004,
"times": [
0.35217250348,
0.37450166248,
0.34973817748,
0.38851394148,
0.39095375848,
0.38355087148,
0.35375216948000004,
0.37873200248000005,
0.39479179948000004,
0.38212979348000004
]
},
{
"command": "pnpr@main",
"mean": 0.38016609738000007,
"stddev": 0.022934971993291826,
"median": 0.38139089348,
"user": 0.37806818,
"system": 0.8214624199999999,
"min": 0.33826557348,
"max": 0.41616830948000005,
"times": [
0.33826557348,
0.37093275748000004,
0.40121448848,
0.38971380148,
0.39264492148,
0.37980745048000003,
0.41616830948000005,
0.35013188448000004,
0.38040311248,
0.38237867448
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.263051575680001,
"stddev": 0.0715775381974154,
"median": 3.2570264623800003,
"user": 2.8653153799999997,
"system": 2.0476201599999997,
"min": 3.13757327238,
"max": 3.36962363738,
"times": [
3.1764465143800003,
3.3319197263800002,
3.2448380553800003,
3.13757327238,
3.36962363738,
3.32545497738,
3.2992083823800002,
3.2313982663800003,
3.2658769003800003,
3.24817602438
]
},
{
"command": "pacquet@main",
"mean": 3.262493117980001,
"stddev": 0.03272956741205686,
"median": 3.2595920533800005,
"user": 2.8401433799999998,
"system": 2.04212506,
"min": 3.2170233123800003,
"max": 3.32322064038,
"times": [
3.2614473733800002,
3.2794507803800004,
3.3026289063800003,
3.23509208238,
3.23739302838,
3.32322064038,
3.2170233123800003,
3.23991245438,
3.27102586838,
3.2577367333800002
]
},
{
"command": "pnpr@HEAD",
"mean": 1.74353579338,
"stddev": 0.12713653335681718,
"median": 1.7201538433799999,
"user": 1.6675273799999997,
"system": 1.75410446,
"min": 1.52754370138,
"max": 1.92247115838,
"times": [
1.76426305238,
1.86043670638,
1.52754370138,
1.67543315338,
1.6548271933799998,
1.78888224338,
1.67604463438,
1.90625290938,
1.65920318138,
1.92247115838
]
},
{
"command": "pnpr@main",
"mean": 1.80231926508,
"stddev": 0.1350234677656537,
"median": 1.79746672688,
"user": 1.66874988,
"system": 1.7727036600000001,
"min": 1.62578195938,
"max": 1.99763917838,
"times": [
1.99763917838,
1.95281989838,
1.66785438638,
1.87890985838,
1.83244953638,
1.93545060738,
1.69863021038,
1.76248391738,
1.67117309838,
1.62578195938
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.9182483217800002,
"stddev": 0.07104274311983418,
"median": 0.91592760738,
"user": 1.15719898,
"system": 0.95686096,
"min": 0.8298584418800001,
"max": 1.03708582388,
"times": [
0.9805813228800001,
0.8298584418800001,
0.91803833288,
1.03708582388,
0.87359766788,
0.9715580138800001,
0.8320690268800001,
0.9732073298800001,
0.9138168818800001,
0.85267037588
]
},
{
"command": "pacquet@main",
"mean": 0.99313813638,
"stddev": 0.06732055274665272,
"median": 1.00053105238,
"user": 1.26382468,
"system": 0.9489657600000001,
"min": 0.8797565398800001,
"max": 1.12066115888,
"times": [
1.01899482388,
0.93966179788,
1.00323269188,
0.9894758558800001,
0.92093310788,
0.99782941288,
1.12066115888,
1.03289341588,
1.02794255888,
0.8797565398800001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.38573130758000007,
"stddev": 0.01653753450096191,
"median": 0.38808021888000005,
"user": 0.33141777999999994,
"system": 0.70760066,
"min": 0.36161803088000005,
"max": 0.42021770888000004,
"times": [
0.3880501128800001,
0.39152529988000007,
0.37864843188,
0.38811032488,
0.38826804388,
0.36763731888000006,
0.42021770888000004,
0.36161803088000005,
0.39803098488000005,
0.37520681888000007
]
},
{
"command": "pnpr@main",
"mean": 0.45946339588,
"stddev": 0.01914088600265162,
"median": 0.45459531488000005,
"user": 0.33948588,
"system": 0.73815396,
"min": 0.43459158688000005,
"max": 0.50309323788,
"times": [
0.4707444598800001,
0.43459158688000005,
0.4553437698800001,
0.44658668388000006,
0.45521476688000007,
0.50309323788,
0.4539758628800001,
0.44780671188000004,
0.47473447688000003,
0.45254240188000006
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4777149136400003,
"stddev": 0.12002340646540151,
"median": 2.45568763214,
"user": 1.7109175999999997,
"system": 1.2147633199999999,
"min": 2.31225372364,
"max": 2.63110235664,
"times": [
2.61088772664,
2.59381729264,
2.49232053164,
2.63110235664,
2.58441073864,
2.4167598736400002,
2.36929772264,
2.34724443764,
2.4190547326400003,
2.31225372364
]
},
{
"command": "pacquet@main",
"mean": 2.60438246714,
"stddev": 0.21360664591546896,
"median": 2.66024325264,
"user": 1.8672148,
"system": 1.22528362,
"min": 2.23146647964,
"max": 2.86220581764,
"times": [
2.40627996264,
2.23146647964,
2.3535967816400003,
2.5887026956400003,
2.73309860664,
2.86220581764,
2.73178380964,
2.76176221264,
2.8126731726400003,
2.56225513264
]
},
{
"command": "pnpr@HEAD",
"mean": 0.42540544884000003,
"stddev": 0.038406490043871554,
"median": 0.41216013914000005,
"user": 0.3412611,
"system": 0.7812615199999999,
"min": 0.39579248664,
"max": 0.5294662816400001,
"times": [
0.42814460164,
0.41032114964,
0.39579248664,
0.43807514564,
0.41051447464,
0.5294662816400001,
0.40604430464,
0.41448295764000004,
0.40740728264000003,
0.41380580364
]
},
{
"command": "pnpr@main",
"mean": 0.39715096404,
"stddev": 0.014437662962583241,
"median": 0.39633809764,
"user": 0.323724,
"system": 0.73832612,
"min": 0.37727473664,
"max": 0.42321144964,
"times": [
0.39901099664,
0.39366519864,
0.37727473664,
0.39136999464,
0.38647334364,
0.42321144964,
0.41062230764,
0.40806201564,
0.40231873764000003,
0.37950085964
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6813797191,
"stddev": 0.06712628679888147,
"median": 0.6879441884,
"user": 0.6558228399999999,
"system": 0.116574,
"min": 0.5703657999,
"max": 0.7865498929,
"times": [
0.5703657999,
0.6730500749,
0.5957098639,
0.6762893469000001,
0.7581029229,
0.7057022359,
0.7865498929,
0.7117726189,
0.6995990299,
0.6366554049
]
},
{
"command": "pacquet@main",
"mean": 0.6524190114999999,
"stddev": 0.0456989728850248,
"median": 0.6443816834,
"user": 0.6179094399999999,
"system": 0.1249533,
"min": 0.5802899209,
"max": 0.7445104219,
"times": [
0.6236130799,
0.7445104219,
0.6696124709000001,
0.6592406249,
0.7026432239,
0.5802899209,
0.6502064189000001,
0.6385569479000001,
0.6292409199000001,
0.6262760859000001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.1116261050666667,
"stddev": 0.003393896838767068,
"median": 0.1113264659,
"user": 0.03201193166666666,
"system": 0.017500116666666666,
"min": 0.1031492339,
"max": 0.1188694929,
"times": [
0.1142482789,
0.1115612579,
0.1166339919,
0.1095191509,
0.1090956029,
0.1090850739,
0.1158683509,
0.1122688309,
0.1172093349,
0.10927496090000001,
0.1104073349,
0.1126395679,
0.1109812749,
0.1188694929,
0.1111875439,
0.1119017379,
0.1141775149,
0.10734920390000001,
0.1110390229,
0.1114972869,
0.1114653879,
0.11056290590000001,
0.1090341789,
0.1031492339
]
},
{
"command": "pnpr@main",
"mean": 0.11246602802500001,
"stddev": 0.00428638915711482,
"median": 0.1125190724,
"user": 0.03463184833333333,
"system": 0.015264574999999997,
"min": 0.1057742569,
"max": 0.1222436279,
"times": [
0.1177248469,
0.1057742569,
0.1119704889,
0.1083291799,
0.1073741009,
0.1177212609,
0.1093742979,
0.1172492809,
0.1163897619,
0.1077369749,
0.1120244589,
0.1222436279,
0.11273876590000001,
0.1125867299,
0.1124514149,
0.1154155669,
0.1088630059,
0.1058835639,
0.1141815129,
0.1152804929,
0.1147864329,
0.1116261999,
0.11427620990000001,
0.1071822399
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 5.04966304062,
"stddev": 0.19143223172135598,
"median": 5.051958905019999,
"user": 3.12990466,
"system": 2.28515608,
"min": 4.80530265702,
"max": 5.36895818502,
"times": [
5.13540924402,
5.04817858502,
5.36895818502,
5.05573922502,
5.24203494502,
4.89430747702,
4.80530265702,
4.84687539902,
4.87888819402,
5.22093649502
]
},
{
"command": "pacquet@main",
"mean": 5.31665345742,
"stddev": 0.3333506127603531,
"median": 5.24889286102,
"user": 3.21007536,
"system": 2.48105528,
"min": 4.90253042402,
"max": 5.96364510102,
"times": [
4.90253042402,
5.16720080502,
4.92644954802,
5.23275376302,
5.72867131602,
5.96364510102,
5.41811131202,
5.13423058502,
5.26503195902,
5.42790976102
]
},
{
"command": "pnpr@HEAD",
"mean": 4.08256312702,
"stddev": 0.16421794681166368,
"median": 4.05339710652,
"user": 2.1443325599999996,
"system": 2.1414039799999998,
"min": 3.76477172302,
"max": 4.29173686902,
"times": [
4.06665860902,
4.28941944402,
4.03240904302,
3.96617556702,
4.04013560402,
3.76477172302,
4.20192852602,
4.19293166002,
3.97946422502,
4.29173686902
]
},
{
"command": "pnpr@main",
"mean": 3.8304026991199995,
"stddev": 0.20528456346517063,
"median": 3.74163089002,
"user": 1.9527747599999998,
"system": 1.9024215799999997,
"min": 3.6305992630199997,
"max": 4.16685192102,
"times": [
3.79419903702,
4.1528232120199995,
4.0229582620199995,
4.16685192102,
3.73679798702,
3.66566453502,
3.6305992630199997,
3.65161516502,
3.73605381602,
3.74646379302
]
}
]
} |
|
| Branch | pr/13091 |
| Testbed | pacquet |
🚨 1 Alert
| Benchmark | Measure Units | View | Benchmark Result (Result Δ%) | Upper Boundary (Limit %) |
|---|---|---|---|---|
| isolated-linker.fresh-resolve.hot-cache.offline | Latency milliseconds (ms) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 681.38 ms(+44.90%)Baseline: 470.26 ms | 564.31 ms (120.75%) |
Click to view all benchmark results
Error codes are a public contract — users match on them in CI and scripts, and pnpm documents them at https://pnpm.io/errors. 284 of pacquet's `#[diagnostic(code(...))]` sites reported something else: $ pnpm root -g Error: pacquet_cli::root_global_unsupported `pacquet` is an in-repo crate name that means nothing to a user of the `pnpm` binary. A second group reported unprefixed codes (`GIT_CHECKOUT_FAILED`), which are the *short* names pnpm passes to `PnpmError`; its constructor prepends `ERR_PNPM_` before the code is ever observed, so pacquet was emitting a code pnpm never emits. Rename all 259 offending codes across 284 sites under two rules: 1. Where pnpm defines a code for the same error, use pnpm's exact code. `pacquet_package_manager::outdated_lockfile` becomes `ERR_PNPM_OUTDATED_LOCKFILE` — which its own doc comment already claimed it was — and `GIT_CHECKOUT_FAILED` becomes `ERR_PNPM_GIT_CHECKOUT_FAILED`. 2. Otherwise derive from the full path minus the crate prefix, so `pacquet::patch_state_read` becomes `ERR_PNPM_PATCH_STATE_READ`. The namespace is retained rather than the leaf alone: six distinct `create_dir` errors would otherwise collapse onto one code. Three merge onto codes pacquet already used elsewhere for the same condition, which is the intent, not a clash. pnpm has a single `ERR_PNPM_TRUST_DOWNGRADE` and matches on it by name in `deps-resolver`, so pacquet's resolver-side and lockfile-side trust downgrades now share it. Two errors were mislabelled and are corrected rather than renamed: - `frozen_lockfile_with_outdated_lockfile` is not pnpm's outdated-lockfile error. The variant is `FrozenLockfileWithUpdateChecksums` and the message is about combining --frozen-lockfile with --update-checksums. It takes `ERR_PNPM_CONFIG_CONFLICT_FROZEN_LOCKFILE_WITH_UPDATE_CHECKSUMS`, following the existing ERR_PNPM_CONFIG_CONFLICT_* convention, and its doc comment no longer claims to be the error it isn't. - Three package-manifest errors have pnpm equivalents under a different name, which rule 1 cannot see because it matches on the name: "package.json file already exists" is pnpm's `PACKAGE_JSON_EXISTS` (thrown by `pnpm init`), "No package.json was found" is `NO_IMPORTER_MANIFEST_FOUND`, and "Missing script" is `NO_SCRIPT`. All 610 diagnostic codes are now ERR_PNPM_*.
… mismatch
`TarballError::Checksum` is the downloaded-tarball-does-not-match-the-
lockfile error. pnpm calls that `TARBALL_INTEGRITY`
(`fetching/binary-fetcher/src/index.ts`, `worker/src/index.ts`), and
matches on the emitted code by name:
const BROKEN_LOCKFILE_INTEGRITY_ERRORS = new Set([
'ERR_PNPM_UNEXPECTED_PKG_CONTENT_IN_STORE',
'ERR_PNPM_TARBALL_INTEGRITY',
])
so the code drives lockfile-integrity recovery rather than only being
printed. The N-API bridge forwards `Diagnostic::code()` into the JS error
(`napi/src/error.rs`), which makes the diagnostic code externally
observable — a consumer treating an integrity mismatch as a supply-chain
signal would not have recognised it under a pacquet-specific name.
The correct code was already recorded one layer away:
`tarball_error_to_request_retry` has mapped `TarballError::Checksum` to
`ERR_PNPM_TARBALL_INTEGRITY` in the retry payload all along. The
diagnostic attribute now agrees with it, so one error reports one code on
both surfaces.
`TarballTooLarge` gets the same treatment: the derived name stuttered
(`ERR_PNPM_TARBALL_TARBALL_TOO_LARGE`, crate + leaf), and the retry
mapping already called it `ERR_PNPM_TARBALL_TOO_LARGE`.
All four tarball codes that pnpm defines — TARBALL_INTEGRITY,
PATH_TRAVERSAL, NO_OFFLINE_TARBALL, TARBALL_TOO_LARGE — now match between
the diagnostic attribute and the retry payload.
Reported by Qodo on the review of the parent commit.
The rename updated `#[diagnostic(code(...))]` but not the prose around
it, leaving 42 comment lines naming pre-rename identifiers — "Carries the
`LINKED_PKG_DIR_NOT_FOUND` code" when the code emitted is now
`ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND`. One sentence managed both
conventions at once:
/// The error codes (`GIT_DEP_PREPARE_NOT_ALLOWED`,
/// `ERR_PNPM_PREPARE_PACKAGE`, `INVALID_PATH`) match pnpm's
The short forms were not wrong so much as ambiguous: they are the names
pnpm passes to `PnpmError`, which are not the names either stack emits.
Spelling every reference the way it appears in output makes the comment
checkable against the attribute below it, and matches the
`pnpm.io/errors/<code>` URLs those comments point at.
`BAD_READ_PACKAGE_HOOK_RESULT` is included: pnpm raises it via
`super('BAD_READ_PACKAGE_HOOK_RESULT', ...)` in `requirePnpmfile.ts`, so
it is a real code, referenced by pacquet only in prose.
Reported by CodeRabbit on the review of the parent commit.
|
Code review by qodo was updated up to the latest commit c831702 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@pnpm/crates/cli/tests/install.rs`:
- Line 987: The renamed diagnostic codes are only documented in comments, so the
tests do not detect regressions. Update the relevant assertions in
pnpm/crates/cli/tests/install.rs:987-987 to verify the exact catalog diagnostic
code for the missing-entry case;
pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs:622-622 and :662-662 to
assert ERR_PNPM_INVALID_PATH; and
pnpm/crates/resolving-local-resolver/tests/resolve.rs:383-383 to assert
ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND, while preserving the existing message and
behavior checks.
In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Around line 279-282: Update the documentation for the PnpmfileHook variant to
mention only the ERR_PNPM_PNPMFILE_FAIL diagnostic code it actually emits.
Remove the unsupported ERR_PNPM_BAD_READ_PACKAGE_HOOK_RESULT reference, unless a
separate diagnostic path is implemented to emit that code consistently with
pnpm’s canonical public contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 843df1b5-f822-4910-90e4-a523e6cfab86
📒 Files selected for processing (22)
pnpm/crates/cli/tests/install.rspnpm/crates/crypto-shasums-file/src/lib.rspnpm/crates/engine-runtime-deno-resolver/src/deno_resolver.rspnpm/crates/engine-runtime-deno-resolver/src/read_deno_assets.rspnpm/crates/engine-runtime-node-resolver/src/node_resolver.rspnpm/crates/engine-runtime-node-resolver/src/parse_node_specifier.rspnpm/crates/engine-runtime-node-resolver/src/resolve_node_version.rspnpm/crates/git-fetcher/src/error.rspnpm/crates/git-fetcher/src/fetcher/tests.rspnpm/crates/git-fetcher/src/prepare_package.rspnpm/crates/git-fetcher/src/tarball_fetcher/tests.rspnpm/crates/hooks/src/lib.rspnpm/crates/napi/src/resolve.rspnpm/crates/napi/src/resolve/tests.rspnpm/crates/package-manager/src/create_virtual_store.rspnpm/crates/package-manager/src/install_package_by_snapshot.rspnpm/crates/resolving-default-resolver/src/lib.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-local-resolver/src/lib.rspnpm/crates/resolving-local-resolver/src/local_resolver.rspnpm/crates/resolving-local-resolver/tests/resolve.rspnpm/crates/tarball/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (10)
- pnpm/crates/resolving-default-resolver/src/lib.rs
- pnpm/crates/engine-runtime-node-resolver/src/resolve_node_version.rs
- pnpm/crates/resolving-local-resolver/src/local_resolver.rs
- pnpm/crates/engine-runtime-deno-resolver/src/deno_resolver.rs
- pnpm/crates/engine-runtime-deno-resolver/src/read_deno_assets.rs
- pnpm/crates/engine-runtime-node-resolver/src/node_resolver.rs
- pnpm/crates/package-manager/src/create_virtual_store.rs
- pnpm/crates/package-manager/src/install_package_by_snapshot.rs
- pnpm/crates/git-fetcher/src/error.rs
- pnpm/crates/crypto-shasums-file/src/lib.rs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13091 +/- ##
==========================================
- Coverage 85.49% 85.49% -0.01%
==========================================
Files 501 501
Lines 80484 80484
==========================================
- Hits 68807 68806 -1
- Misses 11677 11678 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The previous commit spelled every code reference in its emitted `ERR_PNPM_*` form, which was wrong for this one. `PnpmfileHook` carries only `ERR_PNPM_PNPMFILE_FAIL`; `HookError` has no diagnostic code of its own. Writing the second identifier as `ERR_PNPM_BAD_READ_PACKAGE_HOOK_RESULT` turned a note about which pnpm *conditions* the variant covers into a claim that it emits a code it cannot emit. Say what it emits, and record the parity gap the old wording was hinting at: pnpm splits these conditions across two codes, reserving BAD_READ_PACKAGE_HOOK_RESULT for a hook that returns a non-manifest, which pacquet does not distinguish yet. Closing that gap means splitting HookError, which is not a rename. Reported by CodeRabbit.
Four tests named a diagnostic code in a doc comment but asserted only the
enum variant or the message text, so a code regression — the exact thing
this branch changes — would not fail them.
Assert the code itself, following the pattern already established in
`git_fetcher::fetcher::tests`, whose comment says a rename "would
silently regress error-code parity with pnpm without this check":
let code = err.code().map(|c| c.to_string()).unwrap_or_default();
assert_eq!(code, "ERR_PNPM_INVALID_PATH");
Covers the traversal and missing-subdir rejections
(ERR_PNPM_INVALID_PATH), the missing `file:` tarball target
(ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND), and the catalog misconfiguration
(ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC), whose test asserted the
prose while its comment made a claim about the code specifically.
Each assertion was verified to fail against a deliberately regressed
code before being kept.
Reported by CodeRabbit.
c831702 to
dfafc29
Compare
|
Code review by qodo was updated up to the latest commit dfafc29 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/workspace-manifest-writer/src/lib.rs (1)
134-159: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winRevert unrelated API refactor to maintain scope discipline.
This functional API change (refactoring from a single dependency update to a batch update via an iterator) violates the PR's scope. As per path instructions, this PR should remain strictly focused on diagnostic error code unification, with no unrelated refactors or churn.
Please revert this method's signature and implementation back to their original state to keep the PR focused and prevent unintended behavioral consequences.
🤖 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/workspace-manifest-writer/src/lib.rs` around lines 134 - 159, Revert set_config_dependencies to its original single-dependency API and implementation, replacing the IntoIterator batch parameter with the prior name/specifier arguments and removing the iterator loop. Preserve the existing manifest read, parse, edit, and write behavior without introducing unrelated batching changes.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.
Outside diff comments:
In `@pnpm/crates/workspace-manifest-writer/src/lib.rs`:
- Around line 134-159: Revert set_config_dependencies to its original
single-dependency API and implementation, replacing the IntoIterator batch
parameter with the prior name/specifier arguments and removing the iterator
loop. Preserve the existing manifest read, parse, edit, and write behavior
without introducing unrelated batching changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 56094d55-9610-4a4c-868a-efeb9b4d1fb4
⛔ Files ignored due to path filters (1)
pnpm/crates/cli/tests/snapshots/init__should_throw_on_existing_file.snapis excluded by!**/*.snap,!**/*.snap
📒 Files selected for processing (94)
.changeset/pacquet-err-pnpm-error-codes.mdpnpm/crates/auth-commands/src/login/classic_login.rspnpm/crates/auth-commands/src/login/error.rspnpm/crates/auth-commands/src/login/test_classic_login.rspnpm/crates/auth-commands/src/login/test_web_login_errors.rspnpm/crates/auth-commands/src/logout.rspnpm/crates/cli/src/cli_args/config.rspnpm/crates/cli/src/cli_args/config/tests.rspnpm/crates/cli/src/cli_args/dlx.rspnpm/crates/cli/src/cli_args/exec.rspnpm/crates/cli/src/cli_args/patch.rspnpm/crates/cli/src/cli_args/patch_commit.rspnpm/crates/cli/src/cli_args/patch_remove.rspnpm/crates/cli/src/cli_args/patch_state.rspnpm/crates/cli/src/cli_args/prefix.rspnpm/crates/cli/src/cli_args/root.rspnpm/crates/cli/tests/deploy.rspnpm/crates/cli/tests/install.rspnpm/crates/cli/tests/lockfile_only.rspnpm/crates/cli/tests/workspace_install.rspnpm/crates/cmd-shim/src/link_bins.rspnpm/crates/crypto-shasums-file/src/lib.rspnpm/crates/directory-fetcher/src/error.rspnpm/crates/engine-runtime-bun-resolver/src/bun_resolver.rspnpm/crates/engine-runtime-bun-resolver/src/read_bun_assets.rspnpm/crates/engine-runtime-deno-resolver/src/deno_resolver.rspnpm/crates/engine-runtime-deno-resolver/src/read_deno_assets.rspnpm/crates/engine-runtime-node-resolver/src/node_resolver.rspnpm/crates/engine-runtime-node-resolver/src/node_resolver/tests.rspnpm/crates/engine-runtime-node-resolver/src/parse_node_specifier.rspnpm/crates/engine-runtime-node-resolver/src/resolve_node_version.rspnpm/crates/env-installer/src/errors.rspnpm/crates/executor/src/lib.rspnpm/crates/executor/src/lifecycle.rspnpm/crates/executor/src/run_script.rspnpm/crates/exportable-manifest/src/create.rspnpm/crates/fs-packlist/src/lib.rspnpm/crates/git-fetcher/src/error.rspnpm/crates/git-fetcher/src/fetcher/tests.rspnpm/crates/git-fetcher/src/prepare_package.rspnpm/crates/git-fetcher/src/tarball_fetcher/tests.rspnpm/crates/hooks/src/lib.rspnpm/crates/lockfile/src/load_lockfile.rspnpm/crates/lockfile/src/save_lockfile.rspnpm/crates/modules-yaml/src/lib.rspnpm/crates/napi/src/resolve.rspnpm/crates/napi/src/resolve/tests.rspnpm/crates/pack/src/lib.rspnpm/crates/package-manager/src/add.rspnpm/crates/package-manager/src/build_snapshot.rspnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rspnpm/crates/package-manager/src/create_virtual_store.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_package_by_snapshot.rspnpm/crates/package-manager/src/install_package_from_registry.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/link_bins.rspnpm/crates/package-manager/src/link_manifest_link_deps.rspnpm/crates/package-manager/src/link_root_component_members.rspnpm/crates/package-manager/src/minimum_release_age.rspnpm/crates/package-manager/src/package_extender.rspnpm/crates/package-manager/src/patch.rspnpm/crates/package-manager/src/patch_commit.rspnpm/crates/package-manager/src/prune_direct_deps.rspnpm/crates/package-manager/src/symlink_direct_dependencies.rspnpm/crates/package-manager/src/update.rspnpm/crates/package-manifest/src/lib.rspnpm/crates/publish/src/extract_manifest_from_packed.rspnpm/crates/registry/src/lib.rspnpm/crates/resolving-default-resolver/src/lib.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-local-resolver/src/lib.rspnpm/crates/resolving-local-resolver/src/local_resolver.rspnpm/crates/resolving-local-resolver/src/parse_bare_specifier.rspnpm/crates/resolving-local-resolver/tests/resolve.rspnpm/crates/resolving-npm-resolver/src/errors.rspnpm/crates/resolving-npm-resolver/src/mirror.rspnpm/crates/resolving-npm-resolver/src/pick_package.rspnpm/crates/resolving-npm-resolver/src/resolve_from_workspace.rspnpm/crates/resolving-npm-resolver/src/trust_checks.rspnpm/crates/store-dir/src/msgpackr_records.rspnpm/crates/store-dir/src/project_registry.rspnpm/crates/store-dir/src/prune.rspnpm/crates/store-dir/src/store_index.rspnpm/crates/tarball/src/lib.rspnpm/crates/versioning/src/error.rspnpm/crates/workspace-manifest-writer/src/lib.rspnpm/crates/workspace-projects-filter/src/filter.rspnpm/crates/workspace-state/src/lib.rspnpm/crates/workspace/src/manifest.rspnpm/crates/workspace/src/project_manifest.rspnpm/crates/workspace/src/projects.rspnpm/crates/workspace/src/root_finder.rs
🚧 Files skipped from review as they are similar to previous changes (66)
- pnpm/crates/package-manager/src/package_extender.rs
- pnpm/crates/package-manager/src/add.rs
- pnpm/crates/package-manager/src/link_bins.rs
- pnpm/crates/workspace/src/manifest.rs
- pnpm/crates/git-fetcher/src/fetcher/tests.rs
- pnpm/crates/directory-fetcher/src/error.rs
- pnpm/crates/package-manager/src/install_package_from_registry.rs
- pnpm/crates/lockfile/src/load_lockfile.rs
- pnpm/crates/resolving-npm-resolver/src/resolve_from_workspace.rs
- pnpm/crates/napi/src/resolve.rs
- pnpm/crates/lockfile/src/save_lockfile.rs
- pnpm/crates/resolving-local-resolver/src/lib.rs
- pnpm/crates/registry/src/lib.rs
- pnpm/crates/auth-commands/src/login/error.rs
- pnpm/crates/engine-runtime-node-resolver/src/parse_node_specifier.rs
- pnpm/crates/engine-runtime-bun-resolver/src/read_bun_assets.rs
- pnpm/crates/cli/src/cli_args/config.rs
- pnpm/crates/package-manager/src/create_virtual_dir_by_snapshot.rs
- pnpm/crates/engine-runtime-node-resolver/src/node_resolver/tests.rs
- pnpm/crates/workspace/src/root_finder.rs
- pnpm/crates/hooks/src/lib.rs
- pnpm/crates/cli/tests/deploy.rs
- pnpm/crates/exportable-manifest/src/create.rs
- pnpm/crates/pack/src/lib.rs
- pnpm/crates/store-dir/src/prune.rs
- pnpm/crates/modules-yaml/src/lib.rs
- pnpm/crates/package-manager/src/link_manifest_link_deps.rs
- pnpm/crates/auth-commands/src/login/classic_login.rs
- pnpm/crates/resolving-default-resolver/src/lib.rs
- pnpm/crates/cli/src/cli_args/prefix.rs
- pnpm/crates/workspace/src/project_manifest.rs
- pnpm/crates/package-manager/src/create_virtual_store.rs
- pnpm/crates/cli/src/cli_args/patch_remove.rs
- pnpm/crates/cli/src/cli_args/patch.rs
- pnpm/crates/engine-runtime-node-resolver/src/node_resolver.rs
- pnpm/crates/auth-commands/src/login/test_web_login_errors.rs
- pnpm/crates/versioning/src/error.rs
- pnpm/crates/executor/src/lifecycle.rs
- pnpm/crates/engine-runtime-deno-resolver/src/deno_resolver.rs
- .changeset/pacquet-err-pnpm-error-codes.md
- pnpm/crates/package-manager/src/patch.rs
- pnpm/crates/fs-packlist/src/lib.rs
- pnpm/crates/cli/src/cli_args/config/tests.rs
- pnpm/crates/napi/src/resolve/tests.rs
- pnpm/crates/package-manager/src/link_root_component_members.rs
- pnpm/crates/package-manager/src/prune_direct_deps.rs
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
- pnpm/crates/resolving-npm-resolver/src/mirror.rs
- pnpm/crates/package-manager/src/install_frozen_lockfile.rs
- pnpm/crates/executor/src/lib.rs
- pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs
- pnpm/crates/crypto-shasums-file/src/lib.rs
- pnpm/crates/engine-runtime-deno-resolver/src/read_deno_assets.rs
- pnpm/crates/cli/tests/workspace_install.rs
- pnpm/crates/cli/src/cli_args/patch_commit.rs
- pnpm/crates/tarball/src/lib.rs
- pnpm/crates/package-manifest/src/lib.rs
- pnpm/crates/auth-commands/src/logout.rs
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
- pnpm/crates/resolving-npm-resolver/src/errors.rs
- pnpm/crates/store-dir/src/store_index.rs
- pnpm/crates/resolving-local-resolver/src/local_resolver.rs
- pnpm/crates/workspace-projects-filter/src/filter.rs
- pnpm/crates/package-manager/src/install.rs
- pnpm/crates/workspace-state/src/lib.rs
- pnpm/crates/package-manager/src/patch_commit.rs
Summary
Error codes are a public contract — users match on them in CI and scripts, and pnpm documents them at https://pnpm.io/errors. 284 of pacquet's
#[diagnostic(code(...))]sites reported something that is not a pnpm error code:pacquetis an in-repo crate name that means nothing to a user of thepnpmbinary. This is the same leak fixed in #13086 (messages) and #13087 (.modules.yaml), in the last place it remained.A second group reported unprefixed codes (
GIT_CHECKOUT_FAILED,EXOTIC_SUBDEP). Those are the short names pnpm passes toPnpmError, whose constructor prepends the prefix before the code is ever observed (core/error/src/index.ts:19):So pnpm emits
ERR_PNPM_GIT_CHECKOUT_FAILEDwhere pacquet emittedGIT_CHECKOUT_FAILED— a code pnpm never emits.All 610 diagnostic codes are now
ERR_PNPM_*.Rules
pacquet_package_manager::outdated_lockfile→ERR_PNPM_OUTDATED_LOCKFILE(which its own doc comment already claimed it was);GIT_CHECKOUT_FAILED→ERR_PNPM_GIT_CHECKOUT_FAILED.pacquet::patch_state_read→ERR_PNPM_PATCH_STATE_READ. The namespace is kept rather than the leaf alone — six distinctcreate_direrrors (lockfile, modules-yaml, pack, mirror, store-index, workspace-state) would otherwise collapse onto oneERR_PNPM_CREATE_DIR. Verified zero collisions across all 259.Three merge onto codes pacquet already used elsewhere for the same condition — intended, not a clash. pnpm has a single
ERR_PNPM_TRUST_DOWNGRADEand matches on it by name (deps-resolver/src/resolveDependencies.ts:1903), so pacquet's resolver-side and lockfile-side trust downgrades now share it.Two mislabelled errors, corrected rather than renamed
frozen_lockfile_with_outdated_lockfileis not pnpm's outdated-lockfile error. The variant isFrozenLockfileWithUpdateChecksumsand the message is about combining--frozen-lockfilewith--update-checksums. Renaming on the name alone would have merged a flag conflict into pnpm's stale-lockfile code. It takesERR_PNPM_CONFIG_CONFLICT_FROZEN_LOCKFILE_WITH_UPDATE_CHECKSUMS, matching the existingERR_PNPM_CONFIG_CONFLICT_*convention, and its doc comment no longer claims to be the error it isn't.PACKAGE_JSON_EXISTS(workspace/commands/src/init.ts:84); "No package.json was found" isNO_IMPORTER_MANIFEST_FOUND; "Missing script" isNO_SCRIPT(exec/commands/src/run.ts:264, messageMissing script: ${scriptName}— identical).Verified
cargo nextest run --workspace --no-fail-fast— 6128/6128 pass, 3 skipped.cargo clippy --workspace --all-targets -- -D warningsclean.RUSTDOCFLAGS=-D warnings cargo docclean.Four tests asserted on the old codes and are updated:
deploy_all_files_rejects_symlink_escapeandlockfile_only(which asserts on the code precisely because miette wraps the prose), two node-resolver assertions, and theinitsnapshot.git-fetcher/src/fetcher/tests.rs:594already tested error-code parity with pnpm, warning against "a pacquet-only string" — this is the change that test was written to protect.Review findings (both real, both fixed)
ERR_PNPM_TARBALL_INTEGRITY(Qodo) — 6f31f75.TarballError::Checksumis pnpm'sTARBALL_INTEGRITY(fetching/binary-fetcher/src/index.ts:168), and pnpm matches on that code by name to drive lockfile-integrity recovery:Since
napi/src/error.rs:38forwardsDiagnostic::code()to JS, a pacquet-specific name would have silently disabled that path. The right code was already recorded one layer away —tarball_error_to_request_retryhas mappedChecksumtoERR_PNPM_TARBALL_INTEGRITYin the retry payload all along — so the same error was reporting two different codes depending on the surface. Auditing the crate against that mapping also caughtTarballTooLarge, whose derived name stuttered (ERR_PNPM_TARBALL_TARBALL_TOO_LARGE). All four tarball codes pnpm defines now agree across both surfaces.Stale comments (CodeRabbit) — c831702. 42 comment lines across 21 files still named pre-rename identifiers; 5 were flagged, all 42 are fixed. Comments only, no attribute or behavior change.
Known limitation
Rule 1 matches on the code name, so a pacquet error whose pnpm equivalent is named differently gets a rule-2 name instead of pnpm's. The
TARBALL_INTEGRITYfinding above is exactly this failure mode — pacquet called itverify_checksum_error, pnpm calls itTARBALL_INTEGRITY, and no name-based rule could bridge that.Six such cases are now fixed by hand (
outdated_lockfile,PACKAGE_JSON_EXISTS,NO_IMPORTER_MANIFEST_FOUND,NO_SCRIPT,TARBALL_INTEGRITY,TARBALL_TOO_LARGE), but I have not audited all 225 rule-2 codes for semantic equivalents. None is wrong today — they are pacquet-specific names for errors pnpm has no code for, or more specific than pnpm's — but where pnpm does have an equivalent under another name, only a per-error read will find it. Worth a follow-up pass; each is a one-line rename.One lead for that pass:
tarball_error_to_request_retry-style hand-maintained mappings are where the real pnpm codes were already written down. Other crates may have the same, and they are the cheapest place to look.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
ERR_PNPM_*codes.