Skip to content

cli: default targetVersion to the engine at module init - #14862

Closed
eunomie wants to merge 1 commit into
dagger:mainfrom
eunomie:sdk-target/init-target-version
Closed

eunomie wants to merge 1 commit into
dagger:mainfrom
eunomie:sdk-target/init-target-version

Conversation

@eunomie

@eunomie eunomie commented Oct 26, 2026

Copy link
Copy Markdown
Member

When the selected SDK module declares a targetVersion setting and the author does not pass --target-version, dagger module init now records the running engine's version, without build metadata, in the module's scope setting. The flag itself already exists for every SDK constructor field.

The fill is skipped when the flag is passed, or when a module-wide targetVersion is already configured. Init asks the engine for the SDK module's effective settings, so a value in the repository config or the user config counts, and an SDK-declared default does not suppress the fill. A scope setting would otherwise override a deliberate module-wide choice.

Also corrects the comment in engine/version.go, whose example of a -dev- build predates the VERSION file scheme.

No SDK declares targetVersion yet, so this has no effect until one does.

Checks run: the new table test (six cases) and the existing internal/cmd/dagger tests it touches; go test ./engine/; go vet. Mutation checks show the tests fail when either old behaviour is restored. TestCloudLoginExplicitAuthentication is flaky on a host with real cloud credentials, with or without this change.

Checks not run here: engine-backed integration tests and golangci-lint.

Dev builds report the VERSION file's version plus build metadata, not a
-dev- prerelease suffix.

Signed-off-by: Yves Brissaud <[email protected]>
@vito

vito commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🤖 (posted on behalf of @vito) Apologies in advance if this is confusing; happy to sync on Discord if so.

A heads-up for the v1.0.0-beta.22 cut: we're aiming to ship the identifier-casing stack in beta.22 (#14810 merged; #14891, #14895 and #14902 to follow). With this PR, dagger module init on a beta.22 engine would write targetVersion = v1.0.0-beta.22. go-sdk#85 (merged) and java-sdk#42 refuse a target newer than the SDK's own (defaultTarget = beta.21: "targets v1.0.0-beta.21 at most"). So dagger module init --sdk=go would fail on beta.22 until those SDKs raise their target.

Could this hold until after the cut? Or the fill could cap at the SDK's own target instead of the engine's version. Separately, a beta.22 target would put new modules past the cut: new modules at beta.22 get GraphQL-style naming, which the unported SDK codegen doesn't produce yet. That's another reason to keep new modules on the SDK's default target for now.

@eunomie

eunomie commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

This PR is irrelevant, I forgot to close it, but I don't know why it's referenced somewhere else

@eunomie eunomie closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants