chore: remove dead pnpm-lockfile parsing utilities#1231
Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom Apr 18, 2026
Merged
chore: remove dead pnpm-lockfile parsing utilities#1231John-David Dalton (jdalton) merged 1 commit intomainfrom
John-David Dalton (jdalton) merged 1 commit intomainfrom
Conversation
`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.
Bret Comnes (bcomnes)
approved these changes
Apr 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
socket pnpmon main routes throughsfw(viaspawnSfwDlx/spawnSfw); nothing in main's runtime reads or parsespnpm-lock.yamlitself. 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.mts—extractOverridesFromPnpmLockSrc,extractPurlsFromPnpmLockfile,isPnpmDepPath,parsePnpmLockfile,parsePnpmLockfileVersion,readPnpmLockfile,stripLeadingPnpmDepPathSlash,stripPnpmPeerSuffixpackages/cli/src/utils/socket/alerts.mts—getAlertsMapFromPnpmLockfile,getAlertsMapFromPurlsand option typespackages/cli/src/utils/ecosystem/spec.mts—idToNpmPurl,idToPurl,resolvePackageVersionTests:
packages/cli/test/unit/utils/pnpm/lockfile.test.mtspackages/cli/test/unit/utils/socket/alerts.test.mtspackages/cli/test/unit/utils/ecosystem/spec.test.mtspackages/cli/test/unit/utils/pnpm/scanning.test.mts— stale; its header claimed coverage ofutils/pnpm/scanning.mts(doesn't exist) but actually tested the dead lockfile/alerts helpers.Verification
grep -racrosspackages/cli/srcfinds zero external imports of any removed symbol — only the three files importing each other and their own tests.pnpm run typeclean.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 typepnpm --filter @socketsecurity/cli run test:unit— 339 filespnpm run build:cli(pre-commit hooks 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.