Skip to content

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

Merged
Jeppe Fredsgaard Blaabjerg (jfblaa) merged 29 commits into
v1.xfrom
jfblaa/facts-2-generate-facts
Nov 26, 2026
Merged

Jeppe Fredsgaard Blaabjerg (jfblaa) merged 29 commits 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 Coana release it needs is pinned on v1.x since #1762.

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.
  • --reach-version and --fix-version also select the Coana that generates facts, which must be 15.15.4 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 passes mavenOpts to Maven as written, without warning about a --file in them: each POM is still built by its own file.
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 (merged)
  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

  • The Coana CLI now generates Socket facts for Gradle, Maven, sbt and .NET builds, so generating them downloads the Coana CLI and needs network access and a Socket API token.
  • --reach-version and --fix-version also select the Coana CLI that generates Socket facts, which must be 15.15.4 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 passes mavenOpts to Maven as written, without warning about a --file in them: each POM is still built by its own file.

🤖 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.

getCoanaCliDir's doc again says it returns the version it resolved, and
the test header again lists the minimum-version tests, plus the
standalone build's.
…turn type

The minimum-version bullet repeats its test's name, and getCoanaCliDir's
doc repeats CoanaCliDir's version field.
The standalone build downloads Coana like the npm CLI, so no test covers
caching embedded components.
Coana generates .NET facts, as it does JVM facts, and the standalone build
downloads Coana at runtime with the user's credentials, which its offline
smoke test does not have. The step only exercised the .NET facts helper the
build used to embed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[agent] Simplification pass over this PR. Findings that later PRs in the stack fix or delete are left out.

Generating Socket facts only needs a Coana that has the
generate-socket-facts command, so a --reach-version or --fix-version older
than the pinned Coana but new enough for that command keeps working.
discover-manifest-roots re-exported both after buildRootPath moved to
the build-tool module.
readJson already reads the file as UTF-8, strips a BOM and names the
file in a parse error.
Only run-manifest-facts uses the purpose type, and the request builder
was the one caller of toRequestHints.
Both callers passed the exclusion base as the scan root too, so the two
could only drift apart.
The project listing and the build already took runOptions, so the member
listing now runs with the same hints and settings. Its cache stays keyed
per build root.
The sbt and Gradle pom modes repeated the bin, options and verbose rules
that resolveEcosystemConfig already applies for their facts modes.
Coana's resolver puts the root's own POM as the first --file, ahead of
the user's options, and Maven reads an option's first value, so a --file
in mavenOpts never changes which POM is built. socket-cli no longer parses
Maven's option grammar to strip it, or warns about it.
Only the walk has a reason to wait, as it may drop a run that a later
build covers. Auto-manifest and the .NET entries placed theirs right
after generating, and a caller that forgot to would have left its facts
where nothing reads them.
The consumer union, the target type and the purpose-less work dir all
restated the work dir's purpose. A work dir is now created, and its
sidecar entries read, by helpers next to keepFacts, and socket fix hands
facts generation its Coana context as a whole.
A reachability run's remedies name --reach-continue-on-install-errors
because of the purpose the request already carries, so the request
builder adds it rather than each caller. The command now states once
which flags it takes, and scan create passes that to both the walk and
auto-manifest instead of the walk assuming --exclude-paths.
The walk tests wrote projects in the old facts shape and converted them.
They now build the projects Coana reports with helpers they share with the
setup wizard's tests.
A build's coverage listings now take the same run options as its facts
generation, built once per build root, so the walk, the wizard and
buildUncoveredRoot send one request shape. The DSI hints, the purpose
checks and the walk's upload work dir each come from one helper; hints
are required where every caller passes them. Tests check the real
constants and use the shared project fixtures.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM ✅

Comment thread src/utils/coana/release.mts Resolved
Comment thread src/utils/coana-release.test.mts Resolved
Comment thread CHANGELOG.md Resolved
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) merged commit c01e288 into v1.x Nov 26, 2026
22 checks passed
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) deleted the jfblaa/facts-2-generate-facts branch November 26, 2026 13:17
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.

3 participants