Skip to content

feat(manifest): generate Socket facts with Coana - #1726

Open
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 1 commit into
v1.xfrom
jfblaa/facts-2-generate-facts
Open

Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 1 commit into
v1.xfrom
jfblaa/facts-2-generate-facts

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Heads up, reviewer

This PR changes socket facts SBOM generation to use coana.


LLM Description written by Claude Code:claude-opus-5-5

Socket facts for Gradle, Maven, sbt and .NET builds are generated by Coana's generate-socket-facts, one run per build root, instead of socket-cli's own build-tool scripts (deleted in #1727). With --dynamic-sbom-inference, reachability and socket fix then read the state each root's run kept, so reachability analyses each JVM project on the classpath its build resolved.

Merges with the stack; the release gates and the expected e2e failures are in #1725.

What changes for users
  • socket manifest gradle|kotlin|scala|maven|dotnet, manifest auto, --auto-manifest, --dynamic-sbom-inference and its setup wizard go through Coana, so they download it (network access and a Socket API token) unless SOCKET_CLI_COANA_LOCAL_PATH names one; the standalone build always needs that variable.
  • --reach-version and --fix-version also select the Coana that generates facts, which must be the pinned version or newer.
  • --ignore-unresolved no longer lets through a build whose resolution didn't run, or a failure that names no project.
  • socket fix resolves each changed build again with the settings it was generated with, and restores its files when an upgrade didn't take.
  • --dynamic-sbom-inference builds each POM by its own file, so it ignores a --file in mavenOpts, with a warning.
Implementation
  • runManifestFacts sends Coana one request per build root, with the hints its failure report names remedies from.
  • The walk generates every root into a work dir and copies the facts of the roots it keeps to their target at the end, so a dropped run never touches the file there. Only reachability has Coana install the files its analysis reads.
  • The kept roots' state goes to Coana as --socket-facts-sidecar.
Stack
  1. fix: keep the API token and settings socket-cli passes Coana out of the build tools it runs #1725: Keep the Socket API token out of the tools Coana runs
  2. feat(manifest): generate Socket facts with Coana #1726: Generate Socket facts with Coana (this PR)
  3. refactor(manifest): delete socket-cli's build-tool scripts and facts assembly #1727: Delete socket-cli's build-tool scripts and facts assembly (internal)
  4. feat(manifest): add socket.json reachability settings for the build tools #1728: socket.json reachability settings for the build tools
  5. feat(manifest): ask for the reachability settings in the setup wizards #1729: Reachability settings in the setup wizards
  6. refactor: follow-ups to generating Socket facts with Coana #1733: Follow-ups (draft)

Changelog

In CHANGELOG.md under [Unreleased]:

Added

  • Socket facts for a self-contained .NET build include its runtime packs.

Changed

  • Coana now generates Socket facts for Gradle, Maven, sbt and .NET builds, so generating them downloads Coana and needs network access and a Socket API token; the standalone build needs SOCKET_CLI_COANA_LOCAL_PATH.
  • --reach-version and --fix-version also select the Coana that generates Socket facts, which must be the pinned version or newer.
  • With --dynamic-sbom-inference, reachability analyzes each JVM project on the classpath its build resolved, and socket fix restores a build's files when an upgrade does not take.
  • --ignore-unresolved no longer lets through a build whose resolution did not run, or a failure that names no project.
  • --dynamic-sbom-inference builds each POM by its own file, so it ignores a --file in mavenOpts, with a warning.

🤖 Generated with Claude Code

@cursor

cursor Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
Rewires core manifest, DSI, fix, and reachability to an external Coana download with API auth, and changes sidecar semantics and failure handling for multi-build repos.

Overview
Coana now owns Socket facts generation for Gradle, Maven, sbt, and .NET: runManifestFacts (and listing helpers) invoke Coana's generate-socket-facts instead of the removed in-process converters (convert-*-to-facts, enumerate-workspaces, env-var expansion). Manifest subcommands, auto-manifest, recursive DSI, and fix all route through this path, passing org/version context and downloading Coana when needed.

Facts placement and fix/reach sidecars change materially. Builds write into a caller-owned work dir; kept runs are copied to their target paths via keepFacts, and downstream Coana calls take --socket-facts-sidecar (replacing --compute-artifacts-sidecar) as a JSON list of per-root state, not per-project classpaths. Fix generation passes coanaVersion and orgSlug into dynamic SBOM inference.

Recursive manifest walk behavior is tightened: project membership uses absolute SocketFactsProject dirs/files; Maven mavenOpts --file is stripped/warned so each POM builds on its own; skipped-build discovery uses listBuildProjects / listDotnetSolutionMembers from the same Coana pipeline.

Reviewed by Cursor Bugbot for commit c681bbc. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c681bbc. Configure here.

factsPath: result.factsPath,
projects: result.projects,
sidecarEntry: result.sidecarEntry,
targetPath: result.targetPath,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Facts file not verified after Coana

Medium Severity

runManifestFacts treats Coana status: 'generated' as success without checking that factsPath exists. This command used to write the facts file itself; now Coana may exit 0 without producing it. keepFacts then copyFiles a missing path and throws, so the walk dies instead of failing closed with a clear error.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c681bbc. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[agent] Not changing: Coana writes the facts file before it reports generated (generateRootFacts in coana-tech/coana-package-manager#2778, generate.ts#L281-L283), and minimumVersion keeps socket-cli on a Coana that does. A missing file would be a Coana bug, not a build outcome, so socket-cli doesn't check for it again.

// project, OOM, plugin error), not an unresolved dependency, so it fails
// regardless of `ignoreUnresolved` — that flag only tolerates dependencies a
// successful run couldn't resolve.
return result.status === 'listed' ? result.projects : undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty project listing treated as success

Medium Severity

listBuildProjects accepts status: 'listed' with an empty projects array. The old enumerator treated zero records as “the task never ran,” because every real Gradle, Maven, or sbt build reports at least its root. A skipped build that listed nothing now looks loaded, so its modules are not skipped with it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c681bbc. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[agent] Not changing: the zero-projects rule moved into Coana with the enumerator. listRootProjects (coana-tech/coana-package-manager#2778, generate.ts#L160-L166) returns failed when the build reports no projects or no root, so listed always has at least the root and socket-cli doesn't check it twice.

dir: path.join(manifestTmpDir, 'socket-facts-work'),
entries: new Map(),
withFiles: true,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work directory never created before Coana

Medium Severity

socket scan create --reach and socket fix pass Coana a --work-dir that is never created. socket scan reach uses withTmpDir so the directory exists. If Coana requires that path the way it requires the --output-file parent, facts generation fails only on those two commands.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c681bbc. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[agent] Not changing: Coana creates it. generate-socket-facts makes each build's state dir under --work-dir with mkdir(stateDir, { recursive: true }) (coana-tech/coana-package-manager#2778, cli-generate-socket-facts.ts#L94-L95), which creates the work dir too. Unlike --output-file, whose parent Coana does not create, nothing needs it to exist beforehand.

socket-cli now asks `coana generate-socket-facts` for each build root
instead of running its own build-tool scripts, and lists a build's
projects and a .NET solution's members through the same command.

- Coana writes a root's facts into its state dir under --work-dir and
  names where they belong. The walk always generates into a work dir, its
  own when no later Coana run reads one, and copies the facts of the roots
  it keeps to their target at the end; a dropped run never touches the
  file there. This replaces the save/restore of predicted facts files.
- The kept roots' sidecar entries go to reachability and socket fix as
  --socket-facts-sidecar.
- --auto-manifest builds through the same settings as the walk. Maven
  builds pom.xml by name, so its facts and state stay apart from a Gradle
  build in the same directory, and a --file in mavenOpts becomes the POM
  it builds instead of a build option.
- A --reach-version or --fix-version older than the pinned Coana fails
  facts generation with a message naming that version.
- The standalone build's README says every Coana use needs
  SOCKET_CLI_COANA_LOCAL_PATH.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant