Repository navigation
refactor(cli): record the package manager pin from one place - #14627
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe CLI records the pnpm pin during pre-command processing. It separates the workspace manifest directory from the environment lockfile directory. Install-family pipelines use shared config dependency preparation and no longer carry package-manager synchronization state. Changespnpm pin recording
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This centralizes pnpm pin recording before command execution, preserves lockfile-directory and offline flag behavior, and adds coverage for command flags and lockfile-directory pin persistence. No concrete merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant CLI
participant PreCommandPlan
participant EnvLockfile
participant InstallPipeline
participant ConfigDeps
CLI->>PreCommandPlan: Parse command flags
PreCommandPlan->>EnvLockfile: Record pnpm pin at configured lockfile directory
PreCommandPlan->>InstallPipeline: Provide synchronization plan
InstallPipeline->>ConfigDeps: Prepare config dependencies and hooks
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 QodoCentralize package manager pin recording in pre-command checks
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Confidence Score: 4/5The implementation appears behaviorally safe, but the changeset must be adjusted to satisfy the repository’s explicit release-note format. The previously reported deploy flag and negated-offline defects are fixed, and their threads were resolved. The earlier comment-related thread was also resolved. The remaining issue is limited to the changeset ending with historical behavior rather than the issue link, contrary to the repository’s release-note requirement. Files Needing Attention: .changeset/record-the-pin-in-one-place.md Reviews (3): Last reviewed commit: "docs(cli): correct how the install-famil..." | Re-trigger Greptile |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14627 +/- ##
==========================================
+ Coverage 89.34% 89.38% +0.03%
==========================================
Files 757 757
Lines 135826 135720 -106
==========================================
- Hits 121355 121308 -47
+ Misses 14471 14412 -59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`packageManagerDependencies` reached the lockfile from eight call sites: the pre-command checks for most commands, and a copy-pasted prologue in each of the seven install-family pipelines. A hand-maintained list of command variants decided which of the two owned the write, and the two did not agree on what they wrote. The pre-command checks now record the pin for every command, so the list and the pipeline copies are gone. The seven pipelines keep only the config-dependency pair they all share, behind `config_deps::prepare`. The install family used to layer `--lockfile-dir` and `--offline` onto its config before recording, so both now reach the pre-command config too. `--frozen-lockfile` as typed reaches the write for the first time; it previously only saw the `frozenLockfile` setting there. Two bugs fall out of the merge. The pre-command path derived its root from `workspace_dir` alone while the pipelines used `lockfileDir`, so a project setting one recorded the pin in a stray lockfile at the workspace root and never in the lockfile the install reads; the write now follows the lockfile while the manifest is still read from the workspace root. And `pnpm unlink` returns before its pipeline when there is nothing to unlink, which used to skip the record entirely. The install fast path no longer has to give itself up to let the pipeline record the pin, since the record already happened by then. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FPfp4dvqS7Nac4Luy3URJm
01265bd to
3cf2ad7
Compare
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit 3cf2ad7 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The record reads `--lockfile-dir` and the offline flags straight from the command line, and the two extractors that pulled them out were separate hand-written lists. Both omitted `pnpm deploy`, which flattens `InstallArgs` and so carries all of them: a `pnpm deploy --lockfile-dir` recorded the pin against the wrong directory, and `pnpm deploy --offline` could reach the bootstrap registry. The flags are now one `PinFlags` list, and a test asks clap which commands declare them instead of trusting the list, so a command that grows one and is not added fails the build rather than the user. `--offline` also layered onto the config with a boolean or, which cannot express `--no-offline` clearing a configured `offline`. It goes through `resolve_bool_override` now, the precedence every other install-family boolean gets. `--prefer-offline` is read for the same reason: the bootstrap resolver reads that setting too. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FPfp4dvqS7Nac4Luy3URJm
|
Code review by qodo was updated up to the latest commit 96f5dd8 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The note above the install `config()` call said `--offline` and `--prefer-offline` "cannot turn an explicit yaml `true` back off". They can: `resolve_bool_override` is `force_on || (config && !force_off)`, its own contract says a set flag wins "either way", and its tests pin that direction. The note is what the boolean or in the commit before this one was written from. The precedence belongs to `resolve_bool_override` and is documented there, so the note keeps only what the call site knows: why the flags are applied at that point. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FPfp4dvqS7Nac4Luy3URJm
|
Code review by qodo was updated up to the latest commit 571ff55 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
) `packageManagerDependencies` reached the lockfile from eight call sites: the pre-command checks for most commands, and a copy-pasted prologue in each of the seven install-family pipelines. A hand-maintained list of command variants decided which of the two owned the write, and the two did not agree on what they wrote. The pre-command checks now record the pin for every command, so the list and the pipeline copies are gone. The seven pipelines keep only the config-dependency pair they all share, behind `config_deps::prepare`. The install family used to layer `--lockfile-dir` and `--offline` onto its config before recording, so both now reach the pre-command config too. `--frozen-lockfile` as typed reaches the write for the first time; it previously only saw the `frozenLockfile` setting there. Two bugs fall out of the merge. The pre-command path derived its root from `workspace_dir` alone while the pipelines used `lockfileDir`, so a project setting one recorded the pin in a stray lockfile at the workspace root and never in the lockfile the install reads; the write now follows the lockfile while the manifest is still read from the workspace root. And `pnpm unlink` returns before its pipeline when there is nothing to unlink, which used to skip the record entirely. The install fast path no longer has to give itself up to let the pipeline record the pin, since the record already happened by then.
Summary
Follow-up to #14626, which is merged; this PR rebases onto it and is the refactor alone.
While fixing #14575 it turned out
packageManagerDependenciesreached the lockfile from eight call sites, not two: the pre-command checks for most commands, plus an identical three-call prologue copy-pasted into each of the seven install-family pipelines. A hand-maintained list of ten command variants (syncs_env_lockfile_in_pipeline) decided which side owned the write. That list is what let #14575 exist, and the two sides also disagreed about what and where they wrote.The pre-command checks now record the pin for every command. The list and the seven copies are gone; the pipelines keep only the config-dependency pair they all share, behind
config_deps::prepare.Two bugs fell out of the merge
Both confirmed on released 12.3.4 before anything was changed, so neither comes from #14626.
lockfileDiris setpnpm-lock.yamlat the workspace root, and the lockfile the install actually reads never carries itpnpm unlinkwith nothing to unlinkThe
lockfileDirone is the more serious of the two.pre_commandderived its root fromworkspace_diralone while the pipelines usedroot_project_manifest_dir(which honourslockfileDir), so the two wrote to different files.PinRootsnow separates them: the manifest declaring the pin is read at the workspace root, the env lockfile follows the lockfile.Behaviour parity, checked rather than assumed
--frozen-lockfilehas a history of regressions in this block (#14009, #14124, #14129, #14132), so it was the risk to clear. Pre- and post-refactor binaries on an out-of-datepackageManagerDependencies:The
frozenLockfilesetting still blocks the write identically.The install family used to layer
--lockfile-dirand--offlineonto its config before recording, so both now reach the pre-command config; without that, moving the write would have silently dropped them.--frozen-lockfileas typed reaches the write for the first time, where that path previously saw only thefrozenLockfilesetting.The install fast path no longer gives itself up so the pipeline can record the pin, since the record has already happened by the time it runs.
Net −62 lines. All 3318
pnpm-clitests pass; the newlockfileDirend-to-end test was verified to fail with the two-root change reverted.Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
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-5).
🤖 Generated with Claude Code
https://claude.ai/code/session_01FPfp4dvqS7Nac4Luy3URJm
Summary by CodeRabbit
lockfileDiris configured. Pins are now written alongside the configured lockfile instead of creating an incorrect second lockfile at the workspace root.