Skip to content

feat(manifest): ask for the reachability settings in the setup wizards - #1729

Open
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 4 commits into
jfblaa/facts-4-reachability-settingsfrom
jfblaa/facts-5-wizards
Open

Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 4 commits into
jfblaa/facts-4-reachability-settingsfrom
jfblaa/facts-5-wizards

Conversation

@jfblaa

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

Copy link
Copy Markdown
Contributor

Heads up, reviewer

Update wizard to configure reachability settings 🧙‍♂️


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

socket manifest setup and socket manifest setup --dynamic-sbom-inference ask for #1728's reachability settings for each build tool that generates Socket facts, so they can be set without editing socket.json by hand.

Merges with the stack. The Coana release it needs is pinned on v1.x since #1762.

Questions
  • Whether to build before reachability analysis; a no writes "none" only to override an inherited "compile".
  • Maven, Gradle and sbt: whether to use a different JDK for the analysis, showing the one in effect and whether a parent socket.json sets it.
  • .NET: whether to start a framework-dependent build's analysis on a given runtime.
  • Gradle and sbt in pom mode aren't asked.
  • The wizards run even when a reachability value is invalid: they warn about one in the socket.json they write and replace it with the answers.
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
  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 (this PR)
  6. refactor: follow-ups to generating Socket facts with Coana #1733: Follow-ups (draft)

Changelog

In CHANGELOG.md under [Unreleased]:

Added

  • socket manifest setup and socket manifest setup --dynamic-sbom-inference ask for the reachability settings, so there is no need to edit socket.json by hand.

🤖 Generated with Claude Code

@cursor

cursor Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Interactive configuration and socket.json write logic only; no change to scan/reachability execution paths beyond what users opt into via the wizard.

Overview
socket manifest setup and the dynamic-sbom-inference recursive wizard now walk through defaults.manifest.*.reachability for .NET, Gradle, Maven, and sbt when Socket facts generation is in play, so users do not have to edit socket.json by hand.

The wizards ask whether to compile before reachability (reachability.build: compile vs overriding an inherited compile with none), whether to set a separate JDK for JVM tools (reachability.javaHome, distinct from build javaHome), and for .NET whether to pin reachability.runtimeVersion. Defaults and “no” labels reflect the effective value, including settings inherited from parent socket.json files; clearing with a blank answer writes null so a parent value is not silently kept.

Invalid or tool-incompatible reachability values are warned and stripped before prompting. Gradle/sbt in pom mode skip the reachability step. The recursive setup passes inherited reachability into each wizard and only persists fields that differ from the cascade (including nested reachability keys).

Changelog and broad unit/integration tests cover inheritance, overrides, validation, and write behavior.

Reviewed by Cursor Bugbot for commit 78fadc7. Configure here.

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

Two wizard choices can change which settings a scan actually uses. The inline comments trace both cases and include the source-comment notes.

name: 'no',
value: false,
description: effective
? `Keep ${effective} ${prompts.keep}${Object.hasOwn(reachability, field) ? '' : ', as a parent socket.json sets it'}`

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.

POLA-02 This choice promises to keep the parent’s JDK. Choosing No writes no local override, but socket scan create --reach --auto-manifest reads only the current directory’s socket.json. Running it from the child can silently select a different JDK. The same goes for an inherited .NET runtime.

Could the wizard and auto-manifest use the same lookup for reachability settings, including an explicit child clear? A test can choose No in a child with a parent JDK and check which JDK the scan sends to Coana. Auto-manifest lookup

// eslint-disable-next-line no-await-in-loop
const result = await runEcosystemWizard(ecosystem, section)
const result = await runEcosystemWizard(ecosystem, section, {
inheritedReachability: inherited['reachability'],

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.

POLA-04 In a directory with only nested Maven projects, accepting an inherited compile at every prompt writes compile into this directory’s own socket.json. Accepting a prefilled JDK or runtime can do the same. When the parent later changes, this subtree stays on the old value.

Could we use the field comparison already used for individual builds when staging these directory defaults? That would preserve existing explicit local choices and let untouched inherited values keep following the parent. Existing comparison

inheritedReachability?: unknown
}

// As written, so that the wizard can replace an invalid value.

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.

CMT-33 I read this as saying the wizard can repair an invalid value in the parent file. It edits the current directory’s file and filters invalid inherited values out of the prompt defaults. Could the comment make that scope explicit?

Comment on lines +785 to +786
// The fields of `value` that `tool`'s builds take, warning about the rest the
// answers replace; an inherited invalid value is its own socket.json's to fix.

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.

CMT-34 Wording nit. Could we give local and inherited settings their own sentences?

Suggested change
// The fields of `value` that `tool`'s builds take, warning about the rest the
// answers replace; an inherited invalid value is its own socket.json's to fix.
// The wizard warns about invalid local values and replaces them with the answers.
// Invalid inherited values need to be fixed in the socket.json that sets them.

Comment on lines +832 to +833
// A "no" to a value's question keeps the value in effect; "none" is written
// only to override an inherited "compile".

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.

CMT-35 Wording nit. Could we separate the two wizard choices?

Suggested change
// A "no" to a value's question keeps the value in effect; "none" is written
// only to override an inherited "compile".
// Answering no to a value prompt keeps the effective value.
// The wizard writes "none" to override an inherited "compile".

Comment on lines +106 to +107
// Answers the reachability question with `wantsJavaHome` and its JDK prompt
// with `javaHome`; every other prompt keeps its default.

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.

CMT-36 Wording nit. Could we put the unrelated prompt defaults in a second sentence?

Suggested change
// Answers the reachability question with `wantsJavaHome` and its JDK prompt
// with `javaHome`; every other prompt keeps its default.
// Answers the JDK choice with `wantsJavaHome` and the path prompt with `javaHome`.
// Other prompts keep their defaults.

Comment on lines +276 to +277
// Answers the build question with `wantsBuild`; every other prompt keeps
// its default. Returns the build question's shown default per call.

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.

CMT-37 Wording nit. Could we give the recorded default its own sentence?

Suggested change
// Answers the build question with `wantsBuild`; every other prompt keeps
// its default. Returns the build question's shown default per call.
// Answers the build prompt with `wantsBuild` and accepts the other defaults.
// Returns the build prompt’s displayed default for each call.

Comment on lines +414 to +415
// Answers the runtime question with `wantsRuntime` and its prompt with
// `runtimeVersion`; records each runtime prompt.

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.

CMT-38 Wording nit. Could we separate the answers from what the helper records?

Suggested change
// Answers the runtime question with `wantsRuntime` and its prompt with
// `runtimeVersion`; records each runtime prompt.
// Answers the runtime choice with `wantsRuntime` and the version prompt with `runtimeVersion`.
// Records each runtime prompt.

if (applyAnswer(reachability as Record<string, string>, field, answer)) {
return canceledByUser()
}
// A blank answer must also clear an inherited value, not fall back to it.

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.

CMT-39 Wording nit. Could we state the effect of a blank answer directly?

Suggested change
// A blank answer must also clear an inherited value, not fall back to it.
// A blank answer writes null to clear an inherited value.

`socket manifest setup` and `socket manifest setup
--dynamic-sbom-inference` ask, for each build tool that generates facts:

- whether to build the project before reachability analysis. A no writes
  "none" only to override an inherited "compile", and otherwise leaves the
  setting unset;
- Maven, Gradle and sbt: whether to use a different JDK for the analysis,
  showing the one in effect, inherited or not;
- .NET: whether to start a framework-dependent build's analysis on a given
  runtime, taking major.minor or major.minor.patch[-prerelease].

The wizards read socket.json as written, so they run under an invalid
reachability value: they warn about what a build tool cannot take and
replace it with the answers, and ignore an invalid inherited value for
their defaults.
`socket manifest setup --dynamic-sbom-inference` wrote every accepted
default of a directory's section into its socket.json, so accepting an
inherited reachability value pinned it there. It now keeps only the fields
that differ from what the directory inherits, as it does for a build.
Answering no to a different JDK in a directory under a socket.json that
sets one writes nothing, and the scan there reads the parent's JDK;
answering yes with a blank JDK writes null, and the scan reads none.

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.

2 participants