Repository navigation
refactor(plugins): centralize managed npm install planning - #139788
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 2:18 AM ET / 06:18 UTC. ClawSweeper reviewWhat this changesCentralizes npm plugin installation planning so registry installs, packed archives, and managed installation share directory selection and install/update policy decisions. Merge readiness✅ Ready for maintainer review Keep open: this is a useful, bounded consolidation that remains absent from the reviewed main branch. No introduced correctness defect was found, and the maintainer-authored contribution is protected from cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherThe plugin installer takes an npm package or packed archive and selects where its files should live. Its plan feeds policy checks and installation while preserving retained files that running processes may still need. flowchart TD
A[Registry package] --> C[Shared installation planner]
B[Packed archive] --> C
D[Existing and retained plugin files] --> C
C --> E[Directory and operation mode]
C --> F[Install or update policy]
F --> G[Policy checks and managed installation]
E --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -43. Total -43 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one internal planner for directory and policy decisions while preserving retained-artifact isolation and existing installation contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor rather than a reported runtime defect; source and existing behavioral tests were inspected without executing tests. Is this the best way to solve the issue? Yes: consolidating the existing decisions at their shared owner removes duplication without adding a public plugin API or changing the preserved mode rules. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e19a7694cef6. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
836d628 to
bd55b14
Compare
|
Merged via squash.
|
What Problem This Solves
Registry installs, npm-pack archives, and managed npm installation repeated the same generation and policy decisions. An update into a new directory or reinstallation of a retained artifact needs consistent policy across those paths.
Why This Change Was Made
One managed npm install planner now returns the artifact roots, filesystem operation mode, and policy mode for all three callers. The generation owner also reuses its existing decision instead of calculating it twice.
User Impact
Install/update behavior, retained-file protection, rollback, corruption quarantine, and Gateway restart behavior remain unchanged. This independent preparation for #135599 removes 43 production lines across four files.
Evidence
All 210 existing installer tests passed, including generated policy scripts, npm-pack installation, retained lazy imports, rollback, and quarantine. The 11 generation/mode cases passed again after the final simplification. Production and test typechecks, formatting, boundary/ratchet/dead-export guards, final typed lint, and independent P2 review passed. No tests were weakened or added to mirror the implementation.