Skip to content

explicitly pass workspace to currentModule.asSDK - #11

Merged
TomChv merged 1 commit into
mainfrom
feat/as-sdk-ws
Jul 27, 2026
Merged

TomChv merged 1 commit into
mainfrom
feat/as-sdk-ws

Conversation

@TomChv

@TomChv TomChv commented Jul 27, 2026

Copy link
Copy Markdown
Member

Port of dagger/go-sdk#14, pairing with dagger/dagger#13727.

currentModule.asSDK now takes an optional workspace argument, so an SDK module driven as a dependency can resolve its as-sdk role against the workspace it was handed instead of an ambient current workspace it cannot see.

modules() was working around the missing argument with ws.sdk(name: currentModule.name), which resolved the workspace's SDK list by module entry name — correct only because the entry happens to be named after the module. It now reads currentModule.asSDK(workspace: ws).modules, matching the Go SDK.

Differences from the Go SDK PR

  • No e2e change was needed. The Go SDK's modulesCwdCheck snapshots the workspace through an include filter and had to add dagger.toml so the re-anchored workspace still carries the [[modules.<sdk>.as-sdk.modules]] list. The Python SDK's moduleDiscoveryCheck re-anchors with an unfiltered ws.directory("/"), so the workspace config is already present.
  • mod() has no managedBase helper to thread a workspace through — the Python SDK resolves module lookup from config files only, so the Go SDK's second call site has no counterpart here.

Test

dagger --x-release=main check — 11/11 passing.

dagger/dagger#13727 added an optional `workspace` argument to
`currentModule.asSDK`, so the SDK-role data resolves against an explicitly
passed workspace instead of the ambient current workspace — which dependency
modules cannot see since workspace inheritance was disabled.

Use it instead of the `ws.sdk(name: currentModule.name)` workaround: looking the
SDK up by module entry name only worked by coincidence of the entry being named
after the module, and it read the workspace's SDK list rather than the current
module's own as-sdk role.

Signed-off-by: Tom Chauveau <[email protected]>
@TomChv
TomChv requested a review from tiborvass July 27, 2026 12:12
@TomChv
TomChv merged commit 3c2ec24 into main Jul 27, 2026
12 checks passed
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.

1 participant