fix(package): include namespace in shallow score purl output#1431
Open
John-David Dalton (jdalton) wants to merge 1 commit into
Open
fix(package): include namespace in shallow score purl output#1431John-David Dalton (jdalton) wants to merge 1 commit into
John-David Dalton (jdalton) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 402cea1. Configure here.
John-David Dalton (jdalton)
force-pushed
the
fix/971-shallow-namespace
branch
from
July 24, 2026 18:39
402cea1 to
c0e3486
Compare
Collaborator
Author
|
CI note (both red checks are pre-existing, not from this PR):
|
John-David Dalton (jdalton)
force-pushed
the
fix/971-shallow-namespace
branch
3 times, most recently
from
July 25, 2026 16:17
dc9ed97 to
0f1e4ae
Compare
`socket package shallow` (and `socket package score`) dropped the package namespace when rendering the report card purl, so a scoped npm package like `@axe-core/react` was printed as `pkg:npm/react@4.11.0`. The informational log line already showed the correct purl, making the mismatch confusing. formatReportCard() rebuilt the purl from ecosystem/name/version but omitted the namespace segment that preProcess() already tracks on the deduped artifact. Add the namespace back, mirroring how preProcess and the deep-score renderer construct purls. Adds a focused regression test for the scoped-npm case and updates the Go shallow snapshots (which now correctly show the module namespace). Fixes #971
John-David Dalton (jdalton)
force-pushed
the
fix/971-shallow-namespace
branch
from
July 25, 2026 17:42
0f1e4ae to
5f3c03c
Compare
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.

What
socket package shallowdropped the package namespace from the purl it printed in the report card. A scoped npm package like@axe-core/reactwas rendered as:instead of
pkg:npm/@axe-core/react@4.11.0. The informational log line (Requesting shallow score data for ... pkg:npm/@axe-core/react) already showed the correct purl, so the mismatch was confusing.Fixes #971.
Root cause
formatReportCard()inoutput-purls-shallow-score.mtsrebuilt the purl fromecosystem/name/versionbut skipped thenamespacesegment:preProcess()already tracksnamespaceon the deduped artifact (and the deep-score renderer includes it), so only the report-card purl was affected.Change
src/commands/package/output-purls-shallow-score.mts— add the namespace segment to the report-card purl, matching howpreProcess()and the deep-score renderer build purls.Testing
namespaced packages (issue #971)) asserting the scoped-npm purl and the no-namespace case, callingformatReportCarddirectly.pkg:golang/github.com/steelpoor/tlsproxy@...) — this is the same bug for Go modules.vitest run test/unit/commands/package/— 146 passed.pnpm run lint <files>— passed.Before / after (Go shallow report, showing the same bug for module namespaces)
Before:
Package: pkg:golang/tlsproxy@v0.0.0-...After:
Package: pkg:golang/github.com/steelpoor/tlsproxy@v0.0.0-...Note
Low Risk
CLI display-only purl formatting fix with targeted unit tests; no API or scoring logic changes.
Overview
Fixes #971 by including the
namespacesegment whenformatReportCardbuilds the purl for shallow package score text and markdown output, aligned withpreProcess()and the deep-score renderer.Scoped npm packages (e.g.
@axe-core/react) and other namespaced ecosystems (Go modules, Maven coordinates) now show canonical purls such aspkg:npm/@axe-core/react@…instead of dropping the namespace and showing only the bare name.Adds direct
formatReportCardregression tests for scoped vs non-scoped npm and updates Go/Maven fixture snapshots to expect the corrected purls.Reviewed by Cursor Bugbot for commit 402cea1. Configure here.