Repository navigation
feat: discover managed modules via CurrentModule.asSDK - #4
Merged
Merged
Conversation
generateAll discovered modules by scanning the workspace for legacy dagger.json files with sdk.source "go". cli-1.0 workspace modules use dagger-module.toml and are tracked in [[modules.<sdk>.as-sdk.modules]], so that scan finds nothing and generate-all returns an empty changeset (e.g. it won't restore a deleted internal/). Discover managed modules from the engine's source of truth instead, via currentModule.asSDK.modules. Signed-off-by: Yves Brissaud <[email protected]>
Problem: generateAll now reads currentModule.asSDK.modules. That field is part of the CLI 1.0 schema view, so this SDK module has to load with a v1 engine contract. Leaving the module on the v0.20/v0.21 schema makes the new discovery path fail before the generator logic can run. Change: - set engineVersion to v1.0.0-0 - pin polyfill to the sdk-sdk commit that handles dagger-module.toml - update Dang field projections to the v1 syntax This does not change what generated Go modules contain. It makes the SDK helper module load against the schema it now uses. Signed-off-by: Guillaume de Rouville <[email protected]>
Problem: The e2e workspace only loaded the e2e module. That was enough while generateAll scanned dagger.json files, but it no longer matches the CLI 1.0 contract. generateAll now reads currentModule.asSDK.modules, which only exists when the SDK module is installed in the workspace with an as-sdk entry. Change: Install the local Go SDK module in dagger.toml and list the fixture modules it manages. That makes the e2e workspace look like the user-facing flow after `dagger sdk install go`: the SDK owns a set of modules recorded under [[modules.go-sdk.as-sdk.modules]]. The SDK root also exposes @generate functions. Unqualified `dagger check` treats those generators as checks and would fail because go-sdk:generate-all produces fixture changes. Add check.skip = ["*"] on the SDK root entry so the repo's default check runs the e2e checks without treating the SDK helper's own generators as repo checks. The e2e module still calls generateAll directly, so coverage for the new discovery path remains. Signed-off-by: Guillaume de Rouville <[email protected]>
tiborvass
approved these changes
Jun 20, 2026
Contributor
|
@grouville updated the PR description, explained the chicken n egg problem in Dependency Cycle, it was tested locally, we're going ahead and merging it. |
This was referenced Jul 10, 2026
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.
Why
On the CLI 1.0 branch,
dagger generatecould return an empty changeset for modules managed by the Go SDK.The bug was in module discovery.
generateAllstill found modules by scanning the workspace for legacydagger.jsonfiles whosesdk.sourcewasgo. CLI 1.0 modules usedagger-module.toml, and the workspace records SDK ownership under[[modules.<sdk>.as-sdk.modules]], so the old scan can miss the modules the SDK is supposed to generate.What Changed
Use
currentModule.asSDK.modulesas the source of truth for managed Go modules, then feed those paths into the existingMod(...).generateflow.This means the SDK generates the modules explicitly assigned to it by the workspace, instead of guessing by walking config files.
This PR also updates the e2e workspace so the local Go SDK is installed as an SDK during tests. That matters because
currentModule.asSDK.modulesonly exists when the workspace has anas-sdkregistration, which is the same shape users get fromdagger sdk install go.Dependency Cycle
There is a small chicken-and-egg here.
This PR needs the new engine API from
dagger/dagger#13522becausecurrentModule.asSDK.modulesis not available in the released beta yet. At the same time, the Dagger engine resolves the built-in Go SDK fromgithub.com/dagger/go-sdk, so the beta 4 engine should pick up this SDK change when it ships.So CI may need the beta 4 engine before it can prove this PR by itself. I validated it locally against the current beta-4-ish dev engine built from the Dagger branch.
Shared dependency:
dagger/sdk-sdk#7, fordagger-module.tomlsupport in the shared polyfill helperEngine dependency:
dagger/dagger#13522, forCurrentModule.asSDKValidation
Focused Go SDK e2e checks against the local dev engine:
target-runtime-check: https://dagger.cloud/dagger/traces/d7bc46814817205a553d5b5c4b09594ainit-client-check: https://dagger.cloud/dagger/traces/b6724587ebf302cfab423556a17e4954generate-check: https://dagger.cloud/dagger/traces/24e6b92b246cf986cb29c853296499c5generate-all-check: https://dagger.cloud/dagger/traces/ec7be62618e59a14ecf8e66bafb9a923Full Go SDK
dagger checkagainst the local dev engine:Manual product-flow repro against the local dev engine:
dagger sdk install -y go: https://dagger.cloud/dagger/traces/6877447af0336e275482c018d2b4b7c4dagger module init -y go hello: https://dagger.cloud/dagger/traces/4cd3668e2f72e2fbd525070f9ae0d6d8dagger generate -y: https://dagger.cloud/dagger/traces/12fee79465d8496a8a0dd794aa570d5fThat manual flow verified the important behavior:
dagger module initcreates the module config and starter sourcedagger module initdoes not create generated Go filesdagger generate -ycreates the generated Go files afterward