Skip to content

feat(polyfill): support dagger-module.toml in workspace module generation - #7

Merged
tiborvass merged 3 commits into
mainfrom
as-sdk-dagger-module-toml
Jun 19, 2026
Merged

tiborvass merged 3 commits into
mainfrom
as-sdk-dagger-module-toml

Conversation

@eunomie

@eunomie eunomie commented Jun 19, 2026

Copy link
Copy Markdown
Member

Problem

On design/cli-1.0, generate-all for any SDK (go/python/typescript) silently fails to regenerate workspace-managed modules. After discovery is fixed (see below), generation still fails with module source dagger.json not found, because the workspace-module-generate polyfill helper only recognizes the legacy dagger.json config when building a workspace module's source view — but cli-1.0 modules use dagger-module.toml.

Change

workspaceModuleSourceInclude now detects dagger-module.toml first, falling back to dagger.json. The module directory is already loaded via **, so for dagger-module.toml modules the helper only needs to confirm the module exists; the engine resolves the module's includes/dependencies when it loads the source.

go build + helper tests pass. Verified end-to-end against a dev engine (deleting a Go SDK module's internal/ then dagger generate go-sdk:generate-all restores it).

Context

Part of fixing the cli-1.0 empty-changeset bug. Companion changes:

Depends on the engine asSDK API (#13522) being available in the engine these SDKs run against.

…tion

The workspace-module-generate helper only recognized legacy dagger.json when
building the source view for a workspace module, so generating an SDK module
configured with dagger-module.toml (the current cli-1.0 format) failed with
"module source dagger.json not found".

Detect dagger-module.toml first, falling back to dagger.json. The module
directory is already loaded via "**", so for dagger-module.toml modules the
helper only needs to confirm the module exists; the engine resolves its
includes and dependencies when the source is loaded.

Signed-off-by: Yves Brissaud <[email protected]>
mod-test runs black-box checks. It creates a container, downloads a Dagger CLI into that container, and then uses that downloaded CLI to call small fixture modules.

Before this change, the downloaded CLI version was latest. Today latest means the stable v0.21 CLI. These fixtures are meant to cover the CLI 1.0 workspace/module behavior, so running them with v0.21 tests the wrong product shape.

Pin the downloaded CLI to the published 1.0.0-beta.3 artifact. This only changes the CLI binary used inside these fixture tests. It does not change the sdk-sdk module engine version or the production helper code.

The fixture modules live below their fixture directories, but the downloaded CLI starts from /work. Some fixture calls take a Workspace! argument, and that workspace is resolved from the current working directory before the -m fixture module is loaded.

For those calls, /work must have a module config. Build the test view so the fixture module config also appears at /work/dagger.json. That makes /work a valid workspace root while keeping the fixture config as the single source of truth.

The test still selects the fixture module with -m; the temporary view only gives the inner CLI a valid starting workspace.

Signed-off-by: Guillaume de Rouville <[email protected]>
workspace-module-generate is built from Go source when the module runs. The
checked-in binary is build output, not source, and makes the PR harder to
review.

Remove it.

Signed-off-by: Guillaume de Rouville <[email protected]>
@tiborvass
tiborvass merged commit 90ecbe4 into main Jun 19, 2026
21 checks passed
@tiborvass
tiborvass deleted the as-sdk-dagger-module-toml branch June 19, 2026 23:43
eunomie added a commit that referenced this pull request Jun 25, 2026
#7 added dagger-module.toml support to workspace-module-generate but, for
toml modules, returned an empty source config on the assumption that the
engine resolves includes and dependencies when the source is loaded. That
holds for a module's own files (loaded via "**"), but not for local
directory dependencies: their directories live outside the module and must
be added to the loaded context explicitly, or the engine fails with "dir
module source does not contain a dagger config file" during dagger generate.

Parse the dagger-module.toml dependencies (and include) so moduleSourceInclude
recurses into local dir dependencies and pulls their directories into the
loaded context.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit that referenced this pull request Jun 26, 2026
#7 added dagger-module.toml support to workspace-module-generate but, for
toml modules, returned an empty source config on the assumption that the
engine resolves includes and dependencies when the source is loaded. That
holds for a module's own files (loaded via "**"), but not for local
directory dependencies: their directories live outside the module and must
be added to the loaded context explicitly, or the engine fails with "dir
module source does not contain a dagger config file" during dagger generate.

Parse the dagger-module.toml dependencies (and include) so moduleSourceInclude
recurses into local dir dependencies and pulls their directories into the
loaded context.

Signed-off-by: Yves Brissaud <[email protected]>
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