Repository navigation
fix: pnpm cache delete removes a package from all metadata cache directories - #12831
Conversation
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesCache delete multi-directory fix
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CacheDelete
participant MetadataCache
User->>CacheDelete: delete package metadata
CacheDelete->>MetadataCache: search abbreviated, full, and full-filtered directories
MetadataCache-->>CacheDelete: matching deleted paths
CacheDelete-->>User: sorted, deduplicated paths
Assessment against linked issues
Possibly related PRs
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 |
PR Summary by QodoFix pnpm cache delete to purge package metadata across all cache modes
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Pacquet cache delete unsynced
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Pacquet cache delete unsynced
|
| case 'delete': { | ||
| // A package's metadata can be cached under any of the metadata directories | ||
| // depending on the resolution mode used when it was fetched. | ||
| const deleted = await Promise.all( | ||
| [ABBREVIATED_META_DIR, FULL_META_DIR, FULL_FILTERED_META_DIR].map((metaDir) => | ||
| cacheDelete({ | ||
| ...opts, | ||
| cacheDir: path.join(opts.cacheDir, metaDir), | ||
| registry: opts.cliOptions['registry'], | ||
| }, params.slice(1)) | ||
| ) | ||
| ) | ||
| return [...new Set(deleted.flatMap((result) => result.split('\n')).filter(Boolean))].sort().join('\n') | ||
| } |
There was a problem hiding this comment.
1. Pacquet cache delete unsynced 📘 Rule violation ⌂ Architecture
pnpm cache delete now deletes metadata across metadata, metadata-full, and metadata-full-filtered, but pacquet's cache delete still only targets a single mode-derived metadata directory. This creates a user-visible divergence between pnpm (TypeScript) and pacquet (Rust) with no explicit call-out in the PR description.
Agent Prompt
## Issue description
This PR changes pnpm's `cache delete` to remove package metadata from all metadata cache directories, but pacquet's `cache delete` still resolves a single `cache_dir` from the current resolution mode and deletes only within that directory.
## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior to stay in sync, or for the PR description to explicitly call out any known divergence and follow-up work.
## Fix Focus Areas
- pnpm11/cache/commands/src/cache.cmd.ts[81-94]
- pacquet/crates/cli/src/cli_args/cache.rs[28-41]
- pacquet/crates/cli/src/cli_args/cache.rs[130-141]
- .changeset/cache-delete-all-metadata-dirs.md[1-6]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Addressed in 777b254 — mirrored the same all-metadata-directories deletion in pacquet's Rust cache delete (pacquet/crates/cli/src/cli_args/cache.rs), iterating ABBREVIATED_META_DIR / FULL_META_DIR / FULL_FILTERED_META_DIR instead of the single mode-derived dir, with a matching test (should_delete_packages_from_all_metadata_dirs). pnpm (TS) and pacquet (Rust) cache delete are now in sync.
|
Code review by qodo was updated up to the latest commit 9c0e94c ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan |
9c0e94c to
9cf7ccc
Compare
|
Code review by qodo was updated up to the latest commit 9cf7ccc |
1 similar comment
|
Code review by qodo was updated up to the latest commit 9cf7ccc |
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? |
|
Code review by qodo was updated up to the latest commit 777b254 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 777b254 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12831 +/- ##
==========================================
+ Coverage 85.18% 85.23% +0.05%
==========================================
Files 486 486
Lines 76975 77072 +97
==========================================
+ Hits 65570 65696 +126
+ Misses 11405 11376 -29 ☔ 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": 3.9074332475400007,
"stddev": 0.1623455270076966,
"median": 3.93095148014,
"user": 3.6636894599999996,
"system": 3.3187742200000003,
"min": 3.6898235771400003,
"max": 4.11402859414,
"times": [
4.08348706414,
4.06603303114,
3.77050939714,
3.6898235771400003,
3.8941501081400003,
4.11402859414,
3.74020773714,
4.0125172641399995,
3.7358228501400004,
3.9677528521400003
]
},
{
"command": "pacquet@main",
"mean": 3.7823390765400005,
"stddev": 0.16705282291860526,
"median": 3.73218962264,
"user": 3.6493957599999987,
"system": 3.33859142,
"min": 3.60875116714,
"max": 4.056921303139999,
"times": [
3.76426221414,
3.91935085214,
3.71765788214,
3.73828319514,
4.056921303139999,
3.62761750014,
3.7260960501400002,
3.62207207414,
3.60875116714,
4.0423785271399995
]
},
{
"command": "pnpr@HEAD",
"mean": 2.14866568824,
"stddev": 0.12631967774423933,
"median": 2.13351643864,
"user": 2.77180446,
"system": 2.93803572,
"min": 1.97311920914,
"max": 2.36552885714,
"times": [
2.12024790714,
2.31946487514,
2.05040818214,
2.14678497014,
2.0489876271400003,
2.06613387114,
2.36552885714,
2.24549128514,
2.15049009814,
1.97311920914
]
},
{
"command": "pnpr@main",
"mean": 2.0870246727399997,
"stddev": 0.08521541530082495,
"median": 2.07210467664,
"user": 2.7571897599999997,
"system": 2.92612852,
"min": 1.9833299011400003,
"max": 2.21773768214,
"times": [
2.02825118814,
2.17223167814,
2.10664855414,
2.01726367914,
2.08706403514,
2.21773768214,
2.20104865514,
1.9833299011400003,
2.05714531814,
1.9995260361400002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6656678655199999,
"stddev": 0.011170462651284453,
"median": 0.6686323918200001,
"user": 0.40750482000000005,
"system": 1.3278987999999998,
"min": 0.6490985518200001,
"max": 0.6814517868200001,
"times": [
0.6683490028200001,
0.68008528582,
0.6814517868200001,
0.6537494768200001,
0.6585781528200001,
0.66915415582,
0.67262362082,
0.6490985518200001,
0.6546728408200001,
0.6689157808200001
]
},
{
"command": "pacquet@main",
"mean": 0.66105430722,
"stddev": 0.017206624858799147,
"median": 0.6639233968200001,
"user": 0.39674642,
"system": 1.3242036000000001,
"min": 0.6293675758200001,
"max": 0.6855035748200001,
"times": [
0.6761597108200001,
0.6855035748200001,
0.6632935248200001,
0.6712312308200001,
0.6411796518200001,
0.6293675758200001,
0.6459630538200001,
0.6645532688200001,
0.66286950582,
0.6704219748200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7022787155200001,
"stddev": 0.01816165952607296,
"median": 0.70052969832,
"user": 0.40822192,
"system": 1.3409146,
"min": 0.6793397648200001,
"max": 0.7472796818200002,
"times": [
0.6793397648200001,
0.70754026282,
0.7059662068200001,
0.6900965628200001,
0.6973073568200001,
0.7006149848200001,
0.7004444118200001,
0.7472796818200002,
0.7055587888200001,
0.6886391338200001
]
},
{
"command": "pnpr@main",
"mean": 0.7787500159199999,
"stddev": 0.07246279795367515,
"median": 0.75887152782,
"user": 0.4127476199999999,
"system": 1.4090507000000003,
"min": 0.7176190628200001,
"max": 0.9775527048200001,
"times": [
0.7790931778200001,
0.74074365082,
0.7616208278200001,
0.7536688638200001,
0.7176190628200001,
0.7513170478200001,
0.7590375098200001,
0.7881417678200001,
0.75870554582,
0.9775527048200001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.28996580298,
"stddev": 0.039276902947226904,
"median": 4.300897186679999,
"user": 3.8411952199999995,
"system": 3.32235602,
"min": 4.219350157179999,
"max": 4.33230426818,
"times": [
4.31525058018,
4.292124729179999,
4.23920603518,
4.25462287518,
4.321580658179999,
4.3096696441799995,
4.29026367818,
4.219350157179999,
4.33230426818,
4.32528540418
]
},
{
"command": "pacquet@main",
"mean": 4.30093693268,
"stddev": 0.032248435067784575,
"median": 4.30227448668,
"user": 3.83594942,
"system": 3.3212645199999997,
"min": 4.24551565018,
"max": 4.3474167241799995,
"times": [
4.30445247718,
4.324841764179999,
4.24551565018,
4.344831021179999,
4.284149320179999,
4.26778945418,
4.30073929418,
4.30380967918,
4.3474167241799995,
4.2858239421799995
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1389232917800003,
"stddev": 0.12436983853453332,
"median": 2.15792546518,
"user": 2.5790702199999997,
"system": 2.8175189200000004,
"min": 1.97439298818,
"max": 2.38762186718,
"times": [
2.21244174918,
2.1559372471800002,
2.08273461418,
2.15991368318,
2.19012847918,
2.01569279818,
2.00292771318,
2.38762186718,
2.20744177818,
1.97439298818
]
},
{
"command": "pnpr@main",
"mean": 2.25955944198,
"stddev": 0.13760606843684814,
"median": 2.2983381086800003,
"user": 2.56597692,
"system": 2.83198062,
"min": 2.03592729718,
"max": 2.41623455618,
"times": [
2.2895492921800003,
2.15660833518,
2.34779127918,
2.16101128118,
2.03592729718,
2.37917679918,
2.40943661118,
2.30712692518,
2.0927320431800003,
2.41623455618
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4148741397200002,
"stddev": 0.019793712134983397,
"median": 1.41331706482,
"user": 1.3593002599999997,
"system": 1.7253435400000001,
"min": 1.39140061282,
"max": 1.45925216282,
"times": [
1.45925216282,
1.4232684948199998,
1.42570324482,
1.40953897282,
1.42365316482,
1.39978650782,
1.4170951568199999,
1.39140061282,
1.40157820682,
1.3974648728199999
]
},
{
"command": "pacquet@main",
"mean": 1.4289207257199998,
"stddev": 0.041340421890517925,
"median": 1.41736096182,
"user": 1.3477570599999997,
"system": 1.7581453399999998,
"min": 1.40065844682,
"max": 1.54278857582,
"times": [
1.43476204182,
1.54278857582,
1.4108002098199999,
1.42838261882,
1.41642902182,
1.40223222982,
1.40065844682,
1.41536273682,
1.41829290182,
1.41949847382
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6848615102200001,
"stddev": 0.05546856009419719,
"median": 0.6678851663200001,
"user": 0.33977336,
"system": 1.3089850399999998,
"min": 0.65728710182,
"max": 0.84225136982,
"times": [
0.6678479568200001,
0.65728710182,
0.6683153018200001,
0.84225136982,
0.66792237582,
0.6667233438200001,
0.66654871382,
0.6735921218200001,
0.67208429282,
0.6660425238200001
]
},
{
"command": "pnpr@main",
"mean": 0.6742271675200001,
"stddev": 0.014215751173943851,
"median": 0.6716563358200001,
"user": 0.34703716000000007,
"system": 1.2830133399999997,
"min": 0.65171930182,
"max": 0.6965177398200001,
"times": [
0.68775626182,
0.6899838208200001,
0.6965177398200001,
0.6685707058200001,
0.6633368648200001,
0.6617352028200001,
0.66775210882,
0.65171930182,
0.6801577028200001,
0.67474196582
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.08537044454,
"stddev": 0.02170686076080629,
"median": 3.08720524614,
"user": 1.7721287799999998,
"system": 2.01488712,
"min": 3.0448249831400003,
"max": 3.11713985414,
"times": [
3.09233414814,
3.0448249831400003,
3.08529986014,
3.0683923871400003,
3.10085271314,
3.0661382341400003,
3.07982102814,
3.08911063214,
3.11713985414,
3.10979060514
]
},
{
"command": "pacquet@main",
"mean": 3.14092104104,
"stddev": 0.056216879818985155,
"median": 3.12987278664,
"user": 1.7944489799999999,
"system": 2.05702552,
"min": 3.1039809221400003,
"max": 3.29603294714,
"times": [
3.13453649114,
3.1039809221400003,
3.14088563414,
3.1057201931400003,
3.12680576114,
3.1184025921400003,
3.13293981214,
3.10980505114,
3.29603294714,
3.14010100614
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6753386085399999,
"stddev": 0.015541910884820605,
"median": 0.6702396156400001,
"user": 0.34623778,
"system": 1.30137762,
"min": 0.6506214691400001,
"max": 0.7014732491400001,
"times": [
0.66539185814,
0.6876565801400001,
0.6506214691400001,
0.6631509871400001,
0.68713376514,
0.6717651371400001,
0.66729651014,
0.6901824351400001,
0.7014732491400001,
0.66871409414
]
},
{
"command": "pnpr@main",
"mean": 0.66136763994,
"stddev": 0.011649794793257775,
"median": 0.66099710014,
"user": 0.34683468,
"system": 1.25852762,
"min": 0.6471968651400001,
"max": 0.6848370531400001,
"times": [
0.6554881261400001,
0.6649288551400001,
0.65712221114,
0.6471968651400001,
0.65326505814,
0.6682404201400001,
0.6704137961400001,
0.6473120251400001,
0.6848370531400001,
0.66487198914
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.67477298768,
"stddev": 0.03377141399037269,
"median": 0.66121583848,
"user": 0.62656164,
"system": 0.1581411,
"min": 0.65034071348,
"max": 0.75774556748,
"times": [
0.6623104454800001,
0.75774556748,
0.71234173548,
0.65821540448,
0.65849724348,
0.66661457848,
0.65034071348,
0.6592325114800001,
0.66215199948,
0.66027967748
]
},
{
"command": "pacquet@main",
"mean": 0.67645661308,
"stddev": 0.021751253051349773,
"median": 0.66983128648,
"user": 0.62928904,
"system": 0.1616424,
"min": 0.65148023848,
"max": 0.70734520948,
"times": [
0.6855804614800001,
0.65918684248,
0.65148023848,
0.70734520948,
0.65628467048,
0.67423533948,
0.6584710394800001,
0.66542723348,
0.70449087548,
0.7020642204800001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.11269113123,
"stddev": 0.002338403018078965,
"median": 0.11217693648,
"user": 0.029018839999999994,
"system": 0.02286503333333333,
"min": 0.11105462148,
"max": 0.12312745148000001,
"times": [
0.11228481948,
0.11119315848,
0.11203282348,
0.11382058548,
0.11105462148,
0.11204930848,
0.11231834948000001,
0.11202648248000001,
0.11208579048,
0.11244184948000001,
0.11217274048,
0.11208049248,
0.11244204948,
0.11218113248,
0.11230938248,
0.11234143048,
0.11232330448000001,
0.11118339948,
0.11191407448,
0.11380052948000001,
0.11213544348,
0.11144180348,
0.12312745148000001,
0.11382612648
]
},
{
"command": "pnpr@main",
"mean": 0.11223238197999998,
"stddev": 0.0005979392168236275,
"median": 0.11222914798,
"user": 0.02932934,
"system": 0.022051491666666662,
"min": 0.11115059048,
"max": 0.11332990948,
"times": [
0.11266350948000001,
0.11212894448,
0.11125405448,
0.11298736048000001,
0.11154188248,
0.11247225048000001,
0.11199147048000001,
0.11231601248,
0.11239657248,
0.11253236448000001,
0.11172559548000001,
0.11227351948,
0.11324062748000001,
0.11115059048,
0.11211115848,
0.11269019848,
0.11194245748000001,
0.11212377648,
0.11218477648,
0.11245035248,
0.11332990948,
0.11142597048,
0.11158128048,
0.11306253248
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.645924849479999,
"stddev": 0.07549281097427338,
"median": 6.64555892898,
"user": 3.8939385,
"system": 3.583909319999999,
"min": 6.51865153398,
"max": 6.76663909698,
"times": [
6.66004018698,
6.63107767098,
6.581597813979999,
6.71950459998,
6.59662143998,
6.51865153398,
6.72012819198,
6.66605501998,
6.76663909698,
6.598932939979999
]
},
{
"command": "pacquet@main",
"mean": 6.573470180679999,
"stddev": 0.1119945730280112,
"median": 6.5394829014799996,
"user": 3.8816461,
"system": 3.6059868199999996,
"min": 6.42989757298,
"max": 6.75438923698,
"times": [
6.639463388979999,
6.73458602498,
6.55607069198,
6.5126287199799995,
6.63165114898,
6.5228951109799995,
6.492313847979999,
6.46080606298,
6.75438923698,
6.42989757298
]
},
{
"command": "pnpr@HEAD",
"mean": 4.96658296298,
"stddev": 0.10043442423488641,
"median": 4.961310141479999,
"user": 2.8658138,
"system": 3.1422386199999996,
"min": 4.77433406798,
"max": 5.13855216998,
"times": [
4.975910947979999,
4.912675030979999,
4.89917633398,
5.13855216998,
4.933345634979999,
4.9467093349799995,
5.041666437979999,
4.77433406798,
4.979930780979999,
5.06352888998
]
},
{
"command": "pnpr@main",
"mean": 4.986524275779999,
"stddev": 0.06400251195267616,
"median": 4.9795479904799995,
"user": 2.8601876,
"system": 3.135018219999999,
"min": 4.879507566979999,
"max": 5.093690628979999,
"times": [
5.03817570898,
4.95254866098,
4.97893696098,
4.879507566979999,
5.06287842098,
4.980159019979999,
4.94185303698,
4.94089129298,
5.093690628979999,
4.99660145998
]
}
]
} |
777b254 to
eb453cf
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/cache.rs (1)
120-143: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd stdout assertion to verify de-duplication.
The test proves files are removed from all three metadata directories but doesn't capture or assert the command's stdout output. Since the PR objective states the command returns a de-duplicated list, adding a stdout check would verify that the same package across multiple directories appears exactly once. Without it, accidentally removing
deleted.dedup()would go undetected.♻️ Proposed addition
- cwd.pacquet.with_arg("cache").with_arg("delete").with_arg("is-positive").assert().success(); + let output = cwd + .pacquet + .with_arg("cache") + .with_arg("delete") + .with_arg("is-positive") + .assert() + .success() + .get_output() + .stdout + .clone(); + let stdout = String::from_utf8_lossy(&output); + assert_eq!(stdout.trim(), format!("{registry_name}/is-positive.jsonl"));🤖 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/cli/tests/cache.rs` around lines 120 - 143, Add a stdout assertion to should_delete_packages_from_all_metadata_dirs after the cache delete command, verifying the deleted package is listed exactly once despite existing in all three metadata directories. Keep the existing file-removal assertions and assert the command output reflects de-duplication.
🤖 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/cli/tests/cache.rs`:
- Around line 120-143: Add a stdout assertion to
should_delete_packages_from_all_metadata_dirs after the cache delete command,
verifying the deleted package is listed exactly once despite existing in all
three metadata directories. Keep the existing file-removal assertions and assert
the command output reflects de-duplication.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2e63b308-92b7-4117-9db4-8e71e00424a8
📒 Files selected for processing (3)
.changeset/cache-delete-all-metadata-dirs.mdpnpm/crates/cli/src/cli_args/cache.rspnpm/crates/cli/tests/cache.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/cache-delete-all-metadata-dirs.md
|
Code review by qodo was updated up to the latest commit eb453cf |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to the delete branch, both implementations are updated in lockstep, and the fix has deterministic test coverage including the exact bug scenario from the issue report. The logic in both stacks is straightforward and self-consistent: the TypeScript side uses Promise.all over the three directory constants and correctly deduplicates via Set, while the Rust side loops sequentially with an explicit exists() guard. The return-value contract of cacheDelete (newline-joined sorted paths) is handled correctly in the aggregation step. Tests cover the originally reported case and the all-directories case. No pre-existing behaviors are altered outside the delete branch. No files require special attention. Reviews (2): Last reviewed commit: "test(cli): use metadata-dir constants in..." | Re-trigger Greptile |
The cache delete multi-directory test hardcoded the metadata directory names as string literals, which could drift from the constants the delete logic actually uses. Reference ABBREVIATED_META_DIR / FULL_META_DIR / FULL_FILTERED_META_DIR directly so the test and the code stay in lockstep. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 6d695c6 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
|
| Branch | pr/12831 |
| 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,138.92 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 675.34 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 684.86 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 112.69 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,148.67 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,966.58 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 702.28 ms |
Fixes #12753.
The bug
pnpm cache delete <pkg>leaves the package's metadata behind in some cachedirectories. Per the issue: a package cached under
v11/metadata-full-filtered/(e.g.
@vue/compiler-core.jsonl) is not removed bypnpm cache delete @vue/compiler-core.Root cause
cachestores registry metadata under three directories depending on theresolution mode used when it was fetched —
v11/metadata(ABBREVIATED_META_DIR),v11/metadata-full(FULL_META_DIR), andv11/metadata-full-filtered(
FULL_FILTERED_META_DIR).delete, however, resolves a singlecacheDirfromthe current mode and clears only that one
(
pnpm11/cache/commands/src/cache.cmd.ts):So metadata cached under a different mode is never deleted, and
FULL_META_DIRis never selected at all.
The fix
cache deletenow runscacheDeleteagainst all three metadata directories andreturns the de-duplicated union of what it removed. No new dependency:
FULL_META_DIRis already exported from@pnpm/constants.The change is confined to the
deletebranch.list/view/list-registriesintentionally stay mode-scoped reads — a package must bedeletable regardless of which mode it was cached under, whereas aggregating the
read commands across directories is a separate behavior change and out of scope
for #12753.
Testing
jest test/cacheDelete.cmd.test.ts(inpnpm11/cache/commands). Twodeterministic tests were added (no registry mock, since the delete path only
globs and unlinks — it never reads file content):
cache delete <pkg>, and asserts it is removed from every one and that thereturned list is the de-duplicated path;
metadata-full-filtered(the reporter's case) and asserts thepackage is removed even when the other directories are absent.
The same tests, before and after the fix:
Before (fail — the non-selected directories keep the file):
After (pass):
Summary by CodeRabbit
Bug Fixes
pnpm cache deletenow removes a package’s cached metadata from all supported metadata cache directory variants, regardless of the active resolution mode.Tests