Skip to content

feat: discover managed modules via CurrentModule.asSDK - #5

Merged
tiborvass merged 3 commits into
mainfrom
as-sdk-discovery
Jun 20, 2026
Merged

tiborvass merged 3 commits into
mainfrom
as-sdk-discovery

Conversation

@eunomie

@eunomie eunomie commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Why

On the CLI 1.0 branch, dagger generate could return an empty changeset for modules managed by the Python SDK.

The bug was in module discovery. generateAll still found modules by scanning the workspace for legacy dagger.json files whose sdk.source was python. CLI 1.0 modules use dagger-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.modules as the source of truth for managed Python modules, then feed those paths into the existing Mod(...).generate flow.

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 Python SDK is installed as an SDK during tests. That matters because currentModule.asSDK.modules only exists when the workspace has an as-sdk registration, which is the same shape users get from dagger sdk install python.

Dependency Cycle

There is a small chicken-and-egg here.

This PR needs the new engine API from dagger/dagger#13522 because currentModule.asSDK.modules is not available in the released beta yet. At the same time, the Dagger engine resolves the built-in Python SDK from github.com/dagger/python-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, for dagger-module.toml support in the shared polyfill helper

Engine dependency:

  • dagger/dagger#13522, for CurrentModule.asSDK

Validation

Focused Python SDK e2e checks against the local dev engine:

Full Python SDK dagger check against the local dev engine:

generateAll discovered modules by scanning the workspace for legacy
dagger.json files with sdk.source "python". 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.

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.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 Python 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 Python 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 python`: the SDK owns a set of modules recorded under
[[modules.python-sdk.as-sdk.modules]].

The SDK root also exposes @generate functions. Unqualified `dagger check` treats
those generators as checks and would fail because python-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]>
@grouville
grouville requested a review from tiborvass June 20, 2026 00:33
@tiborvass

Copy link
Copy Markdown
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.

@tiborvass
tiborvass merged commit 41a0f90 into main Jun 20, 2026
1 check failed
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.

3 participants