diff --git a/src/commands/fix/coana-fix-dynamic-sbom-inference.test.mts b/src/commands/fix/coana-fix-dynamic-sbom-inference.test.mts index b62fe4bfe..1d93feaa8 100644 --- a/src/commands/fix/coana-fix-dynamic-sbom-inference.test.mts +++ b/src/commands/fix/coana-fix-dynamic-sbom-inference.test.mts @@ -122,7 +122,7 @@ describe('socket fix --dynamic-sbom-inference', () => { } const uploadManifestFiles = vi.fn() const generated = { - artifactsFlags: ['--maven-use-only-socket-facts'], + artifactsFlags: ['--use-only-socket-facts-artifacts', 'maven'], paths: [FACTS], sidecarFile: '/tmp/socket-fix-facts/sidecar.json', remove: vi.fn(), @@ -155,7 +155,7 @@ describe('socket fix --dynamic-sbom-inference', () => { { pathsRelativeTo: '/test/cwd' }, ) const args = coanaCalls('compute-fixes-and-upgrade-purls')[0]! - expect(args).toContain('--maven-use-only-socket-facts') + expect(args).toContain('--use-only-socket-facts-artifacts') expect(args).toContain('--socket-facts-sidecar') expect(args[args.indexOf('--socket-facts-sidecar') + 1]).toBe( generated.sidecarFile, @@ -177,7 +177,7 @@ describe('socket fix --dynamic-sbom-inference', () => { await coanaFix({ ...baseConfig, all: true, ghsas: [] }) const args = coanaCalls('find-vulnerabilities')[0] - expect(args).toContain('--maven-use-only-socket-facts') + expect(args).toContain('--use-only-socket-facts-artifacts') expect(args).not.toContain('--socket-facts-sidecar') }) @@ -225,7 +225,7 @@ describe('socket fix --dynamic-sbom-inference', () => { expect(mockGenerateSocketFactsForFix).not.toHaveBeenCalled() expect(coanaCalls('compute-fixes-and-upgrade-purls')[0]).not.toContain( - '--maven-use-only-socket-facts', + '--use-only-socket-facts-artifacts', ) }) diff --git a/src/commands/fix/generated-socket-facts.test.mts b/src/commands/fix/generated-socket-facts.test.mts index cf50966d0..101cc41c9 100644 --- a/src/commands/fix/generated-socket-facts.test.mts +++ b/src/commands/fix/generated-socket-facts.test.mts @@ -112,7 +112,10 @@ describe('generateSocketFactsForFix', () => { const { artifactsFlags, sidecarFile } = await generate() - expect(artifactsFlags).toEqual(['--maven-use-only-socket-facts']) + expect(artifactsFlags).toEqual([ + '--use-only-socket-facts-artifacts', + 'maven', + ]) expect(JSON.parse(await fs.readFile(sidecarFile, 'utf8'))).toEqual([]) }) diff --git a/src/commands/manifest/generate-recursive-manifests.mts b/src/commands/manifest/generate-recursive-manifests.mts index 99b3d7510..6298bf482 100644 --- a/src/commands/manifest/generate-recursive-manifests.mts +++ b/src/commands/manifest/generate-recursive-manifests.mts @@ -191,7 +191,7 @@ function statusOf(loader: Loader | undefined): RecursiveManifestOutcomeStatus { } // The options a build's listings take besides the build itself. -export function buildToolScriptOptions( +export function buildListingOptions( config: Pick, excludeBase: string | undefined, excludePaths: string[] | undefined, @@ -338,7 +338,7 @@ async function walkTool( }) const scriptOpts = (candidate: Candidate) => - buildToolScriptOptions( + buildListingOptions( configFor(candidate), ctx.realCwd, ctx.excludePaths, @@ -765,7 +765,7 @@ export async function buildUncoveredRoot({ covered, ecosystem, root, - buildToolScriptOptions(config, excludeBase, excludePaths, context), + buildListingOptions(config, excludeBase, excludePaths, context), ) ) { return 'covered' diff --git a/src/commands/manifest/setup-recursive-manifest-config.mts b/src/commands/manifest/setup-recursive-manifest-config.mts index 18b7cf140..769a13585 100644 --- a/src/commands/manifest/setup-recursive-manifest-config.mts +++ b/src/commands/manifest/setup-recursive-manifest-config.mts @@ -21,7 +21,7 @@ import { withoutDisabledFlags, } from './discover-manifest-roots.mts' import { - buildToolScriptOptions, + buildListingOptions, resolveWalkConfig, socketFactsRunOptions, } from './generate-recursive-manifests.mts' @@ -440,11 +440,7 @@ async function isLoadedBy( covered, build.ecosystem, build.root, - buildToolScriptOptions( - buildConfig(walk, build), - walk.cwd, - walk.excludePaths, - ), + buildListingOptions(buildConfig(walk, build), walk.cwd, walk.excludePaths), ) } diff --git a/src/commands/scan/perform-reachability-analysis.test.mts b/src/commands/scan/perform-reachability-analysis.test.mts index 7f2ea4980..3efa65faa 100644 --- a/src/commands/scan/perform-reachability-analysis.test.mts +++ b/src/commands/scan/perform-reachability-analysis.test.mts @@ -267,11 +267,7 @@ async function coanaArgsFor( function factsOnlyArgs(args: string[]): string[] { return args.flatMap((arg, i) => - arg === '--maven-use-only-socket-facts' - ? [arg] - : arg === '--use-only-socket-facts-artifacts' - ? [arg, args[i + 1]!] - : [], + arg.includes('use-only-socket-facts') ? [arg, args[i + 1]!] : [], ) } @@ -370,10 +366,10 @@ describe('performReachabilityAnalysis --use-only-socket-facts-artifacts gating', expectedSidecar: sidecar, }, { - name: 'keeps the Maven-only flag older Coana releases know, with an empty sidecar', + name: 'names Maven alone the same way, with an empty sidecar', factsOnlyTypes: ['maven'], socketFactsSidecar: undefined, - expected: ['--maven-use-only-socket-facts'], + expected: ['--use-only-socket-facts-artifacts', 'maven'], expectedSidecar: [], }, { diff --git a/src/utils/coana.mts b/src/utils/coana.mts index 3c478f5e4..c543c86d0 100644 --- a/src/utils/coana.mts +++ b/src/utils/coana.mts @@ -310,12 +310,8 @@ export function isFactsOnlyTypes( return !!types.length } -// Maven alone keeps the older flag, which Coana releases before 15.14.1 also -// know. export function useOnlySocketFactsArtifactsFlags( types: FactsOnlyTypes, ): string[] { - return types.length === 1 && types[0] === 'maven' - ? ['--maven-use-only-socket-facts'] - : ['--use-only-socket-facts-artifacts', [...types].sort().join(',')] + return ['--use-only-socket-facts-artifacts', [...types].sort().join(',')] } diff --git a/src/utils/coana.test.mts b/src/utils/coana.test.mts index 0bb1bde68..a87e077fe 100644 --- a/src/utils/coana.test.mts +++ b/src/utils/coana.test.mts @@ -483,8 +483,10 @@ describe('coana facts-file utils', () => { describe('useOnlySocketFactsArtifactsFlags', () => { it.for([ - // Maven alone keeps the flag Coana releases before 15.14.1 also know. - { types: ['maven'], expected: ['--maven-use-only-socket-facts'] }, + { + types: ['maven'], + expected: ['--use-only-socket-facts-artifacts', 'maven'], + }, { types: ['nuget', 'maven'], expected: ['--use-only-socket-facts-artifacts', 'maven,nuget'],