Repository navigation
feat(manifest): generate Socket facts with Coana, and add reachability build and Java settings - #1722
Draft
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 23 commits into
Draft
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 23 commits into
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 23 commits into
Conversation
…cripts socket-cli keeps discovering build roots, resolving each root's options from the socket.json cascade, walking them depth-first and aborting a tool's walk on a failure. It now hands each root to `coana generate-socket-facts --request`, takes coverage from the result's coveredBuildFiles and a dotnet solution's members from `--list-members`. Reachability and `socket fix --dynamic-sbom-inference` give Coana a work dir owned by socket-cli (with `--with-files` for reachability), collect each root's sidecarEntry and pass them back with `--socket-facts-sidecar` in place of `--compute-artifacts-sidecar`. The work dir is removed after Coana's run, and both phases run the same Coana version. Removed: the Gradle facts init script, the sbt facts plugin, the Maven extension's facts participant, the sidecar builder, the resolution-report classifiers and renderer, and their tests and compat suites. The setup wizard still lists workspaces with socket-cli's own scripts, Maven extension and dotnet tool, so those stay, trimmed to that use.
Discovery decides which builds to keep from what each build loads: its projects' directories as well as their build files, anywhere in the scan root. A Gradle or sbt build of its own nested in another is covered only by a build that loads all of its project directories, and a project without a build file is loaded only through its directory. coveredBuildFiles carries neither the directories nor the build files outside the build root, so socket-cli now reads the generated result's `projects`, each with its absolute `dir` and `buildFiles`, and keeps what lies in the scan root. This needs a Coana that reports `projects` in place of coveredBuildFiles.
`socket manifest setup --dynamic-sbom-inference` skips the build roots a parent build already declares. It now learns which build files a build covers from `coana generate-socket-facts --list-projects`, which lists the build's projects without resolving it (`sparjvm workspaces` for Gradle, Maven and sbt, the dotnet tool's workspaces mode for .NET). That was the last use of socket-cli's own build-tool machinery, so it goes: the workspace enumeration runner, the Gradle init script and sbt plugin, the Maven extension, the dotnet tool, the records parser and assembler, the exclude-path glob compiler, the javaHome expander, their tests and compat suites, the Rollup copy step, the build:dotnet-tool and build:maven-extension scripts, and the steps that built them for npm, the package matrix and the standalone build. The standalone build no longer embeds the .NET facts helper or lists manifest-dotnet-facts as available.
- An unreadable result file now fails the build root with a message, as a missing one does, instead of throwing out of the walk or the wizard. - spawnCoana looks the default org up once per process, failure included, so a scan no longer repeats the lookup for every build root and solution listing. The lookup is silent: downloading Coana still reports a failed one when it needs the org. - Coana runs in socket-cli's own working directory, so the paths in its log lines read from there rather than as bare file names. Coana takes every path in the request as absolute and runs build tools in the build root. - When a pinned --reach-version or --fix-version Coana writes no result, socket-cli says it may predate facts generation and names the bundled version as the minimum. - Generation, the wizard's project listing and the dotnet members listing take one options type and build their request with one toSocketFactsRequest. An unresolvable build tool comes back as a failed CResult that each caller handles its own way, and the members listing now sends javaHome as the others do.
convert-gradle-to-facts, convert-maven-to-facts and convert-sbt-to-facts only renamed their tool's options to buildOpts and set the ecosystem. The gradle, kotlin, scala and maven commands and auto-manifest now pass both to runManifestFacts themselves, and the three files go.
`defaults.manifest.{gradle,maven,sbt}.reachability.javaHome` in socket.json
names the JDK the reachability run analyses against, which can differ from
the one the build runs on. It cascades through nested socket.json files like
`javaHome`, field by field within `reachability`, and null clears an
inherited value.
Each JVM build root's request to `coana generate-socket-facts` carries it,
as written, as `config.reachability.javaHome`; Coana keeps it with the
root's state for the later reachability run. Facts generation ignores it.
The setup wizard now compares a nested section field by field when deciding
what to write, so configuring a project no longer pins an inherited
`reachability` value into its own socket.json.
The Gradle, Maven and sbt sub-wizards end with a reachability step: "Use a different Java for reachability analysis?". Only a yes asks for the JDK, written to `reachability.javaHome`; a no leaves the setting as it is, so an inherited value is neither pinned nor cleared. Pom mode skips the step, as it produces no facts for a reachability run. When configuring a nested project, the wizard seeds `reachability` from the inherited and the project's own fields together, as the cascade merges them.
`defaults.manifest.{dotnet,gradle,maven,sbt}.reachability.build` says
whether reachability analysis builds the project first: "compile" or
"none", with unset meaning "none". It cascades through nested socket.json
files field by field within `reachability`, as `javaHome` does, so a
nested "none" overrides an inherited "compile". dotnet gains a
`reachability` section for it; `javaHome` stays JVM-only.
Reading a socket.json now rejects any other value, naming the key and the
allowed values. The reads that fall back to the default socket.json on an
unreadable file fail the command instead, so a mistyped value is never
dropped silently.
Each build root's request to `coana generate-socket-facts` carries the
tool's `reachability.build` from socket.json, as configured ("none" or
"compile"), as `config.reachability.build` next to
`config.reachability.javaHome`; it is absent when unset. This covers
dotnet roots too. Facts generation ignores it; Coana keeps it with the
root's state for the later reachability run.
The dotnet, Gradle, Maven and sbt sub-wizards' reachability step now asks "Build project before reachability analysis? Note: A failed build fails the scan." A yes writes "compile" to `reachability.build`. A no leaves it unset, except where the project would otherwise inherit "compile" from an ancestor socket.json; there it writes "none" so the answer takes effect. The JDK question that follows stays JVM-only. Pom mode still skips the step, as it produces no facts for a reachability run.
Every command that generates Socket facts takes --exclude-paths, so each request's hints now carry it as excludePathsFlag. Coana offers it where a project resolved no dependencies and can only be left out of the scan.
Loading a build that its own socket.json entry skips listed it with no Coana context and the plain-command hints, so it ignored the scan's pinned Coana version, its org and the dynamic SBOM inference hints. The walk now builds one set of options per build root and both the listing and facts generation use it.
Coana's facts path and the walk's path to the same file can differ when a directory is reached through a symlink, such as /var and /private/var on macOS, and then a kept run's sidecar entry was not found. The work dir now holds its entries in a map keyed by the real path, resolved in setSidecarEntry and sidecarEntryOf alone.
Only defaults.manifest.<tool>.reachability.build was checked, so a reachability that is not an object, a non-string javaHome, or any bad value in a defaults.manifest.builds entry reached the Coana request unchecked. Each tool section and each builds entry now rejects them, naming the key and the values it takes.
The fields table now lists reachability.build and reachability.javaHome, which only reachability runs read, and says how they cascade.
The plain `socket manifest setup` did not tell its reachability step what the directory inherits, so under an ancestor socket.json that sets reachability.build to "compile" a no deleted the key instead of writing "none", and the build question defaulted to no. It now reads the ancestor socket.json files, and the build question defaults to the inherited value when the directory sets none. A no to the reachability JDK keeps a value already set; its label now says so and names the value, and says "leave unset" only when none is.
They went with the records parser they read their entry files from; they now pass the entry files directly.
The comment on how the build tool command is resolved named a runner that no longer exists and left out that the standalone executable takes only the SOCKET_CLI_*_PATH override for JVM tools. Others restated their code and now keep only what it does not say.
The "no" to the reachability JDK said it would leave the JDK unset even when a parent socket.json set one, which the scan then used. Setup now shows the inherited JDK, offers it as the default, and a blank answer clears it rather than falling back to it. Plain `socket manifest setup` also read every ancestor socket.json before any build tool was chosen, so an invalid one stopped setup for conda or on exit. It now reads them only for the build tool it sets up.
Reachability analysis of a .NET build takes no JDK, so the setting was accepted and then silently ignored, in a .NET section and in a `builds` entry for a solution or project file alike.
`socket ci --auto-manifest` shares auto-manifest generation with `socket scan create`, so Coana's error report told its users to pass --exclude-paths, which `socket ci` does not take. The invoking command now names the flag when it has one.
The walk, uncovered build roots and the setup wizard each spelled out the same mapping from a build root's settings to Coana's run options.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-factsinstead of socket-cli's own build-tool scripts. Each build root's build tool runs once, and the SBOM and reachability analysis read the same resolution. Two per-tool reachability settings are added to socket.json and the setup wizard:reachability.javaHome, the JDK reachability analysis assumes the program runs on, andreachability.build, where"compile"builds the project before it is analysed.Draft until:
projectsresult shape this branch reads) is out andCOANA_CLI_VERSIONis bumped to it.factsrelease component, which SBOM generation now needs, without tier 1 reachability.What changes for users
socket manifest gradle|kotlin|scala|maven|dotnet,socket manifest autoand--dynamic-sbom-inferencegenerate the facts through Coana. Resolution failures are reported grouped by kind, each with what to fix.defaults.manifest.<tool>.reachability.javaHomeandreachability.build("none"or"compile", absent meaning"none"), cascading like the other build settings; a per-buildbuilds[...]entry'sreachabilitymerges field by field. An invalid value is an input error naming the setting."none"only to override an inherited"compile".socket manifest setuplists a build's projects with Coana. Configuring or skipping a single build works as before.socket scan create --reachandsocket fixhand Coana each build root's kept state (--socket-facts-sidecar) instead of a compute-artifacts sidecar.Implementation
runManifestFactssends Coana one request per build root (tool, root, bin, build options, javaHome, include/exclude configs, exclude paths, ignoreUnresolved, verbose,reachability) and keeps its state dir for the later reach or fix step.--exclude-pathswhere the command takes it.Tests
pnpm run check:tscpasses on every commit, and the full unit suite passes on the tip. Integration tests were not run; they need the Coana release above.🤖 Generated with Claude Code