Skip to content

Commit f22e5c4

Browse files
committed
refactor(scan): decouple --reach-continue-on-install-errors from manifest ignoreUnresolved
--reach-continue-on-install-errors is a Coana concern (it tells Coana to keep going past its own install errors) and is threaded to Coana in perform-reachability-analysis. It should not also decide whether socket-cli's manifest generation tolerates unresolved dependencies — that is a separate concern governed by the manifest's own ignoreUnresolved (socket.json / --ignore-unresolved). Drop the resolveIgnoreUnresolved coupling so the two are independent; the flag still reaches Coana unchanged.
1 parent 75f4bfe commit f22e5c4

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

src/commands/manifest/generate_auto_manifest.mts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export type GenerateAutoManifestResult = {
3232
// Under --auto-manifest, a manifest generator that failed — raising the exit
3333
// code above the value captured before it ran — aborts the whole run: a partial
3434
// or empty SBOM silently under-reports dependencies. The generator has already
35-
// logged the specifics. Tolerated failures (ignoreUnresolved /
36-
// reachContinueOnInstallErrors) warn without touching the exit code, so they
37-
// pass through here and the run continues.
35+
// logged the specifics. A tolerated resolution failure (ignoreUnresolved) warns
36+
// without touching the exit code, so it passes through here and the run
37+
// continues.
3838
function abortManifestRunIfFailed(
3939
ecosystem: string,
4040
beforeExitCode: string | number | undefined,
@@ -51,16 +51,13 @@ export async function generateAutoManifest({
5151
cwd,
5252
detected,
5353
outputKind,
54-
reachContinueOnInstallErrors,
5554
verbose,
5655
}: {
5756
// Reachability path: run build tools with files to emit the sidecar.
5857
computeArtifactsSidecar?: boolean | undefined
5958
detected: GeneratableManifests
6059
cwd: string
6160
outputKind: OutputKind
62-
// Reachability install-error gate: tolerate a blocking resolution failure.
63-
reachContinueOnInstallErrors?: boolean | undefined
6461
verbose: boolean
6562
}): Promise<GenerateAutoManifestResult> {
6663
const sockJson = readOrDefaultSocketJson(cwd)
@@ -70,11 +67,6 @@ export async function generateAutoManifest({
7067
const sidecarAcc: SidecarAccumulator | undefined = computeArtifactsSidecar
7168
? new Map()
7269
: undefined
73-
// Reachability: the install-error gate decides abort; manifest path: socket.json.
74-
const resolveIgnoreUnresolved = (configured: boolean): boolean =>
75-
computeArtifactsSidecar
76-
? configured || Boolean(reachContinueOnInstallErrors)
77-
: configured
7870

7971
if (verbose) {
8072
logger.info(`Using this ${SOCKET_JSON} for defaults:`, sockJson)
@@ -99,8 +91,8 @@ export async function generateAutoManifest({
9991
await convertSbtToFacts({
10092
...sbtArgs,
10193
excludeConfigs: sockJson.defaults?.manifest?.sbt?.excludeConfigs ?? '',
102-
ignoreUnresolved: resolveIgnoreUnresolved(
103-
Boolean(sockJson.defaults?.manifest?.sbt?.ignoreUnresolved),
94+
ignoreUnresolved: Boolean(
95+
sockJson.defaults?.manifest?.sbt?.ignoreUnresolved,
10496
),
10597
includeConfigs: sockJson.defaults?.manifest?.sbt?.includeConfigs ?? '',
10698
sidecarAcc,
@@ -141,8 +133,8 @@ export async function generateAutoManifest({
141133
...gradleArgs,
142134
excludeConfigs:
143135
sockJson.defaults?.manifest?.gradle?.excludeConfigs ?? '',
144-
ignoreUnresolved: resolveIgnoreUnresolved(
145-
Boolean(sockJson.defaults?.manifest?.gradle?.ignoreUnresolved),
136+
ignoreUnresolved: Boolean(
137+
sockJson.defaults?.manifest?.gradle?.ignoreUnresolved,
146138
),
147139
includeConfigs:
148140
sockJson.defaults?.manifest?.gradle?.includeConfigs ?? '',
@@ -170,8 +162,8 @@ export async function generateAutoManifest({
170162
resolveBuildToolBin('maven', cwd),
171163
cwd,
172164
excludeConfigs: sockJson.defaults?.manifest?.maven?.excludeConfigs ?? '',
173-
ignoreUnresolved: resolveIgnoreUnresolved(
174-
Boolean(sockJson.defaults?.manifest?.maven?.ignoreUnresolved),
165+
ignoreUnresolved: Boolean(
166+
sockJson.defaults?.manifest?.maven?.ignoreUnresolved,
175167
),
176168
includeConfigs: sockJson.defaults?.manifest?.maven?.includeConfigs ?? '',
177169
mavenOpts: parseBuildToolOpts(

src/commands/scan/handle-create-new-scan.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export async function handleCreateNewScan({
143143
cwd,
144144
detected,
145145
outputKind,
146-
reachContinueOnInstallErrors: reach.reachContinueOnInstallErrors,
147146
verbose: false,
148147
})
149148
resolvedPathsSidecar = autoManifestResult.resolvedPathsSidecar

0 commit comments

Comments
 (0)