Skip to content

feat(manifest): configure and skip single builds for --dynamic-sbom-inference - #1721

Merged
Jeppe Fredsgaard Blaabjerg (jfblaa) merged 7 commits into
v1.xfrom
jfblaa/discovery-redesign
Nov 16, 2026
Merged

Jeppe Fredsgaard Blaabjerg (jfblaa) merged 7 commits into
v1.xfrom
jfblaa/discovery-redesign

Conversation

@jfblaa

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

Copy link
Copy Markdown
Contributor

Heads up, reviewer

Dynamic sbom inference in socket-cli requires identifying project 'roots' in order to evaluate projects appropriately.
For example, a project may have root ./pom.xml which has submodules ./a/pom.xml and ./b/pom.xml.
If users wish to (for whatever reason) opt out generating dynamic sbom for the project, socket-cli currently has no good way of finding out that ./a/pom.xml and ./b/pom.xml are part of the same project, and in many cases, ./a/pom.xml and ./b/pom.xml cannot be evaluated on their own.
This PR seeks to improve that, but better aligning project discovery with how the build-tools actually behave.
This also fixes a number of edge-cases issues in the current, directory-guided discovery.


Claude Code · claude-opus-5-5

--dynamic-sbom-inference now decides which builds to run from what each build loads, whatever order directories are visited in, and lets users configure or skip a single build without hand-editing socket.json. Design walkthrough, aimed at readers new to this: Build Root Discovery.

What users see
  • socket manifest setup --dynamic-sbom-inference asks about each build no other build includes: leave as-is, configure, or skip. Skipping a build Socket can load skips it and exactly what it loads, leaving the builds beside and beneath it alone.
  • When a build can't be loaded, the wizard shows the build tool's error and offers to fix its settings first; the fallback skips its directory and everything beneath it, and says how to bring a nested project back.
  • A directory with several build files gets a prompt per file, so pom.xml can be skipped while pom-alt.xml beside it is built.
  • Nothing is written until the user confirms the list of files.
  • docs/dynamic-sbom-inference-settings.md documents the settings for anyone, or any agent, writing them by hand. Scan failures link to it and to the wizard.
Settings model
  • Every socket.json from the filesystem root down to a build's directory applies, nearest field wins. This reverses the earlier boundary at the scan directory.
  • defaults.manifest.builds["<build file>"] in a build's own directory holds settings for that build alone, applied after the cascade.
  • builds[...].disabled: true skips the build and what it loads: the scan loads it, resolving nothing, and fails if it can't. A section-level disabled skips the directory and everything beneath it without loading anything; a nearer disabled: false turns builds back on.
Discovery behaviour changes
  • Coverage counts build files and project directories anywhere in the scan root, so a module outside its reactor's directory (<module>../core</module>) is built only inside the reactor. This reverses REA-706's standalone build of such modules, as agreed.
  • A run that a later build turns out to include is dropped and its facts file put back as it was.
  • A Gradle build with its own settings file, or an sbt build with its own project/, nested in another build, runs on its own and is dropped if the outer build loads everything it loads.
  • A failure holds back only the builds in and beneath its directory, and is excused when a kept or skipped build loads the failed root.
Testing
  • Unit suites for manifest, scan, fix and utils pass (1454 tests); pnpm run check passes. In the full pnpm test:unit run, the login and wrapper smoke tests time out under load and pass when run alone.
  • End to end with real Maven and Gradle: a flat ../ module layout that fails today now passes; per-build skips with modules; a directory skip with a nested re-enable; an unloadable skipped build failing with the fix named; a nested Gradle settings build covering its own subproject; and the wizard driven through all of its prompts.
Known gaps and follow-ups
  • A module of a build that runs can't be skipped: the build resolves its modules itself. The scan warns that such a setting has no effect. Excluding it needs an exact-directory exclude in the build scripts, which belongs with their move to Coana.
  • Loading a skipped build uses the workspace-enumeration scripts, so they move to Coana together with facts generation.
  • socket manifest maven and the other single-build commands, and --auto-manifest, don't read builds entries yet.
  • generateRecursiveManifests restores process.exitCode when a later build excuses a failure, because runManifestFacts sets it and the single-build commands rely on that.

…nference

Discovery now decides what to build from what each build loads, in any
order, and settings can target one build.

- socket.json settings cascade from every directory up to the filesystem
  root, and `defaults.manifest.builds["<build file>"]` applies to that
  build alone, after the cascade.
- A build skipped under its own name is loaded without resolving
  anything, and what it loads is skipped with it. A directory skip loads
  nothing; a nearer socket.json can turn builds back on.
- A module outside its reactor's directory is built only inside the
  reactor; a run a later build turns out to include is dropped and its
  facts file restored.
- A Gradle or sbt build nested in another runs on its own; a failure holds
  back only the builds in and beneath its directory, and is excused when a
  kept or skipped build loads it.
- `socket manifest setup --dynamic-sbom-inference` asks about each build
  (leave, configure, skip), offers to fix a build it cannot load before a
  directory skip, and writes nothing until the user confirms.
- docs/dynamic-sbom-inference-settings.md documents the settings for
  anyone, or any agent, writing them by hand.
@cursor

cursor Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Large changes to recursive manifest generation and build coverage logic affect multi-build monorepos; failures are better scoped but behavior shifts (ordering, skips, exit codes).

Overview
--dynamic-sbom-inference now applies socket.json from every directory above the scan root (nearest wins), and adds defaults.manifest.builds["<build file>"] for per-build JDK, opts, and skips without affecting siblings in the same folder.

Discovery was reworked around what each build loads (dirs + files), not just covered paths: reactor modules outside their folder are built only in the reactor; redundant runs are dropped and facts files restored; Gradle/sbt settings-level nested builds can run separately when they load more than the parent. Failures abort only builds in/under the failed root and can be ignored when another build already loads them.

socket manifest setup --dynamic-sbom-inference walks each independent build (configure / inherit / skip), loads skipped builds to learn modules, stages edits, and writes only after confirmation. New docs/dynamic-sbom-inference-settings.md documents the model for humans and agents; scan failures point to the wizard and that doc.

Reviewed by Cursor Bugbot for commit 4f2c82b. 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 1 potential issue.

Fix All in Cursor

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

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can 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 4f2c82b. Configure here.

…e skip settings

A build covered by a kept build was reported as skipped when a skipped
build also loaded it, or when its own entry skipped it, if only the full
coverage check (a .NET solution's projects) showed the kept build covers
it.

@mtorp Martin Torp (mtorp) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed commit 023a21a with Dale's review and an independent critique pass. The six P2 findings are attached as inline comments, with implementation context, concrete triggers, and suggested fixes.

Validation used focused reproductions against the reviewed source with controlled build output or prompt responses. The sidecar regression was also compared with the base revision. No full test suite, real Maven or Gradle build, Coana analysis, or upload was run.

…wizard set every build's own settings

- Runs writing one facts file form a chain: dropping one restores the
  previous run's facts and sidecar entry together, never a kept run's.
- A dropped run's facts file that no kept run owns is reported, and scan
  create, reach and fix leave it out of the files they collect.
- A Gradle or sbt entry applies only when it names a build file that
  exists; two entries for one build are an error, and the wizard writes
  to the one the build already has.
- The wizard asks about the builds in its own directory like any other,
  offering their own skips back.
- Configuring a build drops a field the user leaves to its default.
- Move the settings docs URL next to its only use.
…alidate builds entries up front

- Each run's output is kept aside, so a later run writing the same facts
  file through Gradle's `-p` restores the kept run's own facts when
  dropped, not its own.
- Two entries for one build fail when socket.json is read, before any
  build runs.
- The wizard keeps the defaults prompt for a build here that has its own
  entry, which would override defaults set from its prompt.
- `fix` removes a discarded facts file a dropped run left behind.
- Each run's facts and sidecar entry are saved aside and the original put
  back; kept runs are written when the walk ends, so dropping a run no
  longer needs a restore chain.
- The resolver memoizes each build's settings and shares one entry-key
  lookup with validation.
- The wizard's build review returns its decision and the caller loads it,
  and one predicate decides whether settings go in a build's own entry.
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) merged commit f5d365d into v1.x Nov 16, 2026
23 checks passed
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) deleted the jfblaa/discovery-redesign branch November 16, 2026 20:41
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.

2 participants