Skip to content

Share pnpm vendoring and revert across lockfile dialects - #583

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
refactor/pnpm-vendor-dialects-20261002
Oct 2, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
refactor/pnpm-vendor-dialects-20261002

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

The pnpm 9 and pnpm 7/8 vendoring backends duplicated project loading, preflight, staging, commit/unwind, ledger construction, and revert. Route both through one lifecycle selected by PnpmDialect, keeping each lock grammar's splices and refusal rules separate. The common override editor and dependency-field walker are shared too.

This removes 444 production lines (382 excluding blank/comment lines), or 409 lines net including tests. Public entry points, existing ledger flavors/records, lockfile bytes, warning behavior, commit ordering, artifact retention, and pnpm 7/8 support are preserved. The modern parse memo and index remain intact. New/strengthened regressions ensure legacy operations neither read an unreadable workspace file nor replay a forged modern workspace record.

Selected from architecture discussion #560, specifically E12's duplicated pnpm lifecycle, after reviewing open issues and PRs. This has a substantial immediate payoff within two files, without a support-policy decision or overlap with active hosted-mode, inventory, API, and ecosystem fixes. Broader backend/inventory consolidation would span those active areas.

Validation:

  • cargo test --locked -p socket-patch-core --lib pnpm: 296 passed.
  • CLI ledger/schema and group-commit suites: 10 passed; the fixture regeneration utility remains intentionally ignored.
  • CLI pnpm 7/8 hermetic splice/idempotency/revert tests: 2 passed.
  • Required native pnpm_pinned_matrix_vendored_lifecycle_and_manifestless_vex runs on 7.33.5, 8.15.9, 9.15.9, 10.34.5, and 11.27.0: all passed, no toolchain skips. Covers real installs, fresh/offline consumption, reversal, and manifestless VEX; modern versions exercise both vendor and get --mode vendored.
  • Formatting checks on both changed files and git diff --check: passed.
  • cargo clippy --locked --workspace --all-features -- -D warnings -A unused-variables: passed. The unmodified strict command stops on an existing macOS-only unused unix_default parameter in crawlers/python_crawler.rs:1950, which is unchanged from main.

Developed in a separate worktree and rebased onto main at 6cd37540.


Note

Medium Risk
Changes core lockfile rewrite and revert paths for both modern and legacy pnpm, though behavior is intended to be preserved with added regression tests.

Overview
Unifies pnpm 9 and pnpm 7/8 vendoring/revert behind a shared PnpmDialect lifecycle in pnpm_lock (read/preflight, stage/pack, commit/unwind, ledger, revert), while lock-specific surgery stays dialect-specific via ProjectLock (V9 line edits vs LegacyLock::edit).

vendor_pnpm / vendor_pnpm_legacy and their revert wrappers now delegate to vendor_pnpm_dialect / revert_pnpm_dialect. Legacy drops its duplicated orchestration; it keeps grammar-specific splices, pnpm-legacy flavor stamping, and does not read or write pnpm-workspace.yaml (V9 still mirrors overrides there). Shared helpers include edit_lock_overrides (different insert anchors) and dep_field_lines with configurable indent.

Revert allowlists differ by dialect (legacy skips workspace records with a warning). Legacy lock edits can still emit the absolute-specifier vendor warning. Tests add/strengthen cases that legacy ignores unreadable workspace files and won’t replay forged workspace wiring on revert.

Reviewed by Cursor Bugbot for commit d3ee2b8. Configure here.


Generated by Claude Code

@mikolalysenko Mikola Lysenko (mikolalysenko) added the arch-refactor PR opened by the scheduled architecture refactor routine label Oct 2, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as draft October 2, 2026 17:32
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 2, 2026 17:46
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as draft October 2, 2026 17:47
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 2, 2026 17:48
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 2, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[burn-down agent] Labeled Ready for review at d3ee2b805d671ca0e71cd18fb2918016603b2b07.

  • CI: 401/407 check runs green on this head (6 skipped by path/matrix filters), 0 failing. Mergeable, merges cleanly into current main. 6 commits behind main, no file overlap.
  • Bugbot: reviewed d3ee2b805d, no issues found; no unresolved review threads.
  • Reviewer focus: the shared PnpmDialect lifecycle in pnpm_lock.rs/pnpm_lock_legacy.rs — confirm the legacy (pnpm 7/8) refusal rules are unchanged.

Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Reviewed d3ee2b805d671ca0e71cd18fb2918016603b2b07: ready to merge as-is. No actionable correctness or rollback issue found. The shared driver preserves legacy refusal rules, workspace isolation, dialect-specific lock edits, ledger flavors, commit/unwind order, and artifact retention when revert encounters drift.

Validation: cargo test --locked -p socket-patch-core --lib pnpm passed 296 tests locally, including byte-exact v5.4/v6.0 round trips, the workspace regressions, preflight parity, and commit/revert failures. git diff --check passed. Exact-head CI has 401 successful checks and 6 skipped. The PR merges cleanly with reviewed main 203e092b; the merged tree was not rebuilt locally. Native pnpm matrix tests were not rerun locally.

@mikolalysenko
Mikola Lysenko (mikolalysenko) merged commit fc356c0 into main Oct 2, 2026
407 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the refactor/pnpm-vendor-dialects-20261002 branch October 2, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants