Skip to content

chore: remove dead pnpm-lockfile parsing utilities#1231

Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/remove-dead-pnpm-lockfile-utils
Apr 18, 2026
Merged

chore: remove dead pnpm-lockfile parsing utilities#1231
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/remove-dead-pnpm-lockfile-utils

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 18, 2026

Summary

socket pnpm on main routes through sfw (via spawnSfwDlx / spawnSfw); nothing in main's runtime reads or parses pnpm-lock.yaml itself. The three utility modules removed here were exported but had zero production callers — only each other and their own tests.

Removed

Source:

  • packages/cli/src/utils/pnpm/lockfile.mtsextractOverridesFromPnpmLockSrc, extractPurlsFromPnpmLockfile, isPnpmDepPath, parsePnpmLockfile, parsePnpmLockfileVersion, readPnpmLockfile, stripLeadingPnpmDepPathSlash, stripPnpmPeerSuffix
  • packages/cli/src/utils/socket/alerts.mtsgetAlertsMapFromPnpmLockfile, getAlertsMapFromPurls and option types
  • packages/cli/src/utils/ecosystem/spec.mtsidToNpmPurl, idToPurl, resolvePackageVersion

Tests:

  • packages/cli/test/unit/utils/pnpm/lockfile.test.mts
  • packages/cli/test/unit/utils/socket/alerts.test.mts
  • packages/cli/test/unit/utils/ecosystem/spec.test.mts
  • packages/cli/test/unit/utils/pnpm/scanning.test.mts — stale; its header claimed coverage of utils/pnpm/scanning.mts (doesn't exist) but actually tested the dead lockfile/alerts helpers.

Verification

  • grep -r across packages/cli/src finds zero external imports of any removed symbol — only the three files importing each other and their own tests.
  • pnpm run type clean.
  • pnpm --filter @socketsecurity/cli run test:unit — 339 files pass (was 343; delta matches the 4 removed test files).

If future pnpm-lockfile parsing is needed

Write it fresh against the current architecture rather than resurrecting this chain — the helpers were geared to the v1.x flow and don't fit how scans/sfw work on main.

Test plan

  • pnpm run type
  • pnpm --filter @socketsecurity/cli run test:unit — 339 files
  • pnpm run build:cli (pre-commit hooks green)
  • CI green

Note

Low Risk
Low risk because this PR only deletes unused helper modules and their unit tests; the main risk is unintended breakage if any downstream consumer relied on these exported utilities.

Overview
Deletes the CLI’s unused pnpm lockfile parsing utilities (including peer-suffix stripping and PURL extraction), related package spec helpers, and the Socket alerts-map lookup helpers.

Removes the associated unit tests that only exercised these modules, reducing test coverage surface without changing runtime behavior.

Reviewed by Cursor Bugbot for commit 8fc86de. Configure here.

`socket pnpm` on main routes through `sfw` (Socket Firewall) via
`spawnSfwDlx`/`spawnSfw`; nothing in main's runtime reads or parses
the pnpm-lock.yaml itself. The three utility modules below were
exported but had zero production callers — only each other and their
unit tests.

Removed:
  * `packages/cli/src/utils/pnpm/lockfile.mts`
      exported: extractOverridesFromPnpmLockSrc,
                extractPurlsFromPnpmLockfile, isPnpmDepPath,
                parsePnpmLockfile, parsePnpmLockfileVersion,
                readPnpmLockfile, stripLeadingPnpmDepPathSlash,
                stripPnpmPeerSuffix.
  * `packages/cli/src/utils/socket/alerts.mts`
      exported: getAlertsMapFromPnpmLockfile, getAlertsMapFromPurls,
                and their option types.
  * `packages/cli/src/utils/ecosystem/spec.mts`
      exported: idToNpmPurl, idToPurl, resolvePackageVersion.

Also removed the accompanying unit-test files and a stale
`scanning.test.mts` whose header claimed to cover
`utils/pnpm/scanning.mts` (which doesn't exist) but actually
exercised the dead lockfile/alerts helpers.

Verified before deletion:
  * `grep -r` across `packages/cli/src` finds zero external imports
    of any symbol from the three modules — only the three files
    importing each other and their own tests.
  * `pnpm run type` clean.
  * `pnpm --filter @socketsecurity/cli run test:unit` — 339 files
    pass (was 343 — the 4 difference matches the deleted test files).

If a future flow needs pnpm-lockfile parsing in main, it should be
written fresh against the current architecture rather than resurrected
from this dead chain.
@jdalton John-David Dalton (jdalton) merged commit 64a14c5 into main Apr 18, 2026
14 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/remove-dead-pnpm-lockfile-utils branch April 18, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants