feat(lockfile): read `tool:` lockfile keys as `runtime:` #18589
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.45) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 445 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #18589"
general
weight: 0.35
zkochan
Summary
tool:replacesruntime:as the protocol for tools pnpm provisions itself, but lockfile keys and references still spell itruntime:(node@runtime:22.0.0). The plan is to switch the lockfile spelling totool:in the next lockfile major. For that to be safe, the pnpm versions that will meet such a lockfile have to read it first.Today
node@tool:22.0.0doesn't fail to parse.toolis a reserved version prefix, so the key falls through to an opaque non-semver version with no prefix. It round-trips byte for byte, butPrefix::is_tool()is false and none of the runtime handling (installability, frozen install, lockfile reuse, hoisting) applies to it.This PR makes the lockfile parser (
PkgVerPeer::from_str) accepttool:as a second spelling ofPrefix::Runtime:runtime:on read. Code downstream and string checks such as@runtime:only ever see one spelling.runtime:in every format. Choosing the written spelling per lockfile format is a separate change.tool:file:…is rejected the same wayruntime:file:…is.Tests:
pkg_ver_peer::tests::tool_prefix_reads_as_runtime: parsing, peer suffix, equality with theruntime:spelling, written form, and the conflicting-scheme error.next_format::tests::tool_keys_read_as_runtime_keys_in_both_formats: a lockfile spelled withtool:keys and importer versions loads equal to itsruntime:spelling, in both the 9.0 format and the 13.0 format.Both tests fail without the parser change.
Checklist
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
🤖 Generated with Claude Code
---
Written by an agent (Claude Code, claude-opus-5-5).
<!-- codesmith:footer -->
---
<a href="https://dashboardbackend.blacksmith.sh/track/run-proof?expires=1798676600&installation_model_id=426870&pr_number=18589&ref=codesmith_pr_footer&repository=pnpm%2Fpnpm&return_to=https%3A%2F%2Fgithub.com%2Fpnpm%2Fpnpm%2Fpull%2F18589&variant=show_it_working&signature=efbf3a5ebb002475f3d3d9c33d5cd3fe34a98cd76c3001ca33f97825f94b0479"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-light.svg"><img alt="Show it working" src="https://pr-comments-assets.blacksmith.sh/codesmith/proof-show-it-working-v2-dark-3x.png" width="140" height="28"></picture></a>
<sup><a href="https://app.blacksmith.sh/pnpm/codesmith/pnpm/pr/18589?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>
<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
pnpm now reads
tool:lockfile version entries the same way asruntime:entries in both supported lockfile formats. Existingtool:entries are interpreted as runtime dependencies, preserving their version and peer information. When pnpm writes the lockfile, it continues to use theruntime:prefix. Combiningtool:with a conflicting scheme such asfile:remains invalid.<!-- end of auto-generated comment: release notes by coderabbit.ai -->