Resolve modules through dagger-module.toml#7
Closed
eunomie wants to merge 1 commit into
Closed
Conversation
mod() resolved a workspace path to its owning module with a single find-up for dagger.json. Modules that carry a dagger-module.toml instead have no dagger.json to find, so every lookup against them failed with "no Dagger module found containing path". Find up both markers and keep the closest match. Comparing them in one pass rather than trying dagger-module.toml first keeps find-up's closest-wins semantics: an ancestor's dagger-module.toml must not shadow a legacy module that sits deeper, which is the shape a partially migrated workspace has. Report the runtime that owns a module when it is not dang, so a lookup against another SDK's module says so instead of reporting no module. Signed-off-by: Yves Brissaud <yves@dagger.io>
eunomie
marked this pull request as draft
July 16, 2026 11:22
grouville
self-requested a review
July 20, 2026 17:24
Member
|
Fixed by #8 already |
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.
The dang-sdk half of dagger/go-sdk#10 — the same bug, in the same shape.
The bug
mod()resolved a workspace path to its owning module with a single find-up fordagger.json. Modules carrying adagger-module.tomlinstead have nodagger.jsonto find, so every lookup against them failed withno Dagger module found containing path. Once dagger/dagger#13651 lands, that is every workspace-managed module.Verified: against a migrated module,
modreportsno Dagger module found containing path: toml-appbefore this change and resolves after it.The fix
Find up both
dagger-module.tomlanddagger.jsonand keep the closest match, checking[runtime] source = "dang"for the former and leaving the existingdagger.jsoncheck untouched.Comparing both in one pass — rather than trying
dagger-module.tomlfirst and falling back — is what keeps find-up's closest-wins semantics: an ancestor'sdagger-module.tomlmust not shadow a legacy module that sits deeper, which is the shape a partially migrated workspace has.A lookup against another SDK's module now names the runtime that owns it —
does not use the Dang SDK: <path> (runtime source: go)— instead of reporting no module at all.findUp: falseis untouched and still bypasses resolution.Scope: no as-sdk tier here
dagger/go-sdk#10 has a third, higher-precedence tier reading the workspace's
[[modules.<sdk>.as-sdk.modules]]entries. It is deliberately absent here: this module declaresengineVersion = "v0.20.8", andcurrentModule.asSDKdoes not exist at that version — referencing it is a compile error, not a catchable one. This repo also has nodagger.tomland no as-sdk config, andgenerateAllstill discovers modules by scanning the filesystem.Adding that tier means migrating this SDK to the 1.0 schema first (engine version bump,
.{x}→.{{x}}), which is its own change. The two-tier resolver here fixes the reported bug on the current schema.Verification
There is no e2e module in this repo, so this was checked against a synthetic workspace: a migrated
dagger-module.tomlmodule resolves; legacy find-up from a nested path resolves; a go-owned module is rejected naminggo; a partially migrated workspace resolves to the deeper legacy module rather than the migrated ancestor; a legacy non-dang module is rejected; andfindUp: falsewith/x/still returnsx/. Worth noting that none of that is committed — this repo has no test harness to put it in.