Skip to content

Commit 066e8ea

Browse files
committed
Add debug to purls inspected by fix
1 parent df28a21 commit 066e8ea

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/commands/fix/agent-fix.mts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ export async function agentFix(
124124
if (!infoByPartialPurl) {
125125
spinner?.stop()
126126
logger.info('No fixable vulns found.')
127-
debugFn('inspect:\n', { alertsMap })
127+
if (alertsMap.size) {
128+
debugFn('inspect:', { alertsMap })
129+
} else {
130+
debugFn('inspect: { alertsMap: Map(0) {} }')
131+
}
128132
return { ok: true, data: { fixed: false } }
129133
}
130134

src/utils/alerts-map.mts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,22 @@ export async function getAlertsMapFromPurls(
7272
const { spinner } = options
7373

7474
const uniqPurls = arrayUnique(purls)
75+
debugFn('inspect:', { purls: uniqPurls })
76+
7577
let { length: remaining } = uniqPurls
7678
const alertsByPurl: AlertsByPurl = new Map()
79+
7780
if (!remaining) {
7881
return alertsByPurl
7982
}
83+
8084
const getText = () => `Looking up data for ${remaining} packages`
8185

8286
spinner?.start(getText())
8387

8488
const sockSdkResult = await setupSdk(getPublicToken())
8589
if (!sockSdkResult.ok) {
90+
spinner?.stop()
8691
throw new Error('Auth error: Try to run `socket login` first')
8792
}
8893
const sockSdk = sockSdkResult.data
@@ -121,12 +126,12 @@ export async function getAlertsMapFromPurls(
121126
)
122127
} else {
123128
spinner?.stop()
124-
debugFn('Received a result=false:', batchResult)
125129
logger.fail(
126130
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
127131
batchResult.error,
128132
batchResult.cause ? `( ${batchResult.cause} )` : '',
129133
)
134+
debugFn('inspect:', { batchResult })
130135
break
131136
}
132137
remaining -= 1

0 commit comments

Comments
 (0)