Repository navigation
Conversation
SDK code generation over a workspace with many locally-managed modules folds over currentModule.asSDK.modules in list order. Until now that list was a pure pass-through of the [[modules.<sdk>.as-sdk.modules]] entries in dagger.toml declaration order, with zero dependency awareness, so a module could be regenerated before a locally-managed module it depends on. Order the list leaf-first in currentModuleAsSDK: read each managed module's dagger-module.toml, build a dependency graph over the managed set (local deps only; git/registry and out-of-set refs are external leaves), and emit a deduplicated topological order (a module's deps before it). A real dependency cycle between managed modules errors with the cycle named, rather than emitting an arbitrary order the module loader would reject anyway. The ordering is engine-side only: SDK generators need no change (verified against dagger/go-sdk's generateAll). Only the runtime ordering of an existing list field changes, not its type or shape, so no new version gate is needed; the asSDK surface is already gated to the v1 view. Signed-off-by: Yves Brissaud <[email protected]>
Contributor
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Contributor
|
This PR was closed because it has been stalled for 7 days with no activity. |
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.
Makes the engine return
currentModule.asSDK.modulesin leaf-first dependency order — a workspace-managed module's locally-managed dependencies come before it — instead of rawdagger.tomldeclaration order.Motivation: SDK code generation over a workspace with many modules (e.g. right after
dagger setup) currently generates them in declaration order, which breaks when modules depend on each other. SDK generators (dagger/go-sdk'sgenerateAll) just fold over this list in order, so the fix is engine-side only — zero SDK changes (verified againstgo-sdk.dang).currentModuleAsSDK(core/schema/module_as_sdk.go), reading each managed module'sdagger-module.tomlfor its[[dependencies]];currentModuleAsSDKModulesstays a pass-through.OrderSDKModulesLeafFirst(core/workspace/sdkorder.go): depth-first post-order, dedup by canonical path, edges restricted to the managed set (git/registry, absolute, and out-of-set refs are external leaves).asSDKsurface is alreadyView(AfterVersion("v1.0.0-0"))-gated.Design note:
hack/designs/assdk-leaf-first-ordering.md.Verification
go build/go vet/gofmt+go test ./core/workspace/ ./core/schema/green; staticcheck U1000 clean.TestGenerators/TestSDKGeneratorModulesLeafFirst): a diamonda → {b, c} → don the real Go SDK runtime returns exactlyd, b, c, a.No changelog entry:
asSDKis unreleased v1-prerelease API, so a changie entry for an unshipped surface would be noise — happy to add one if a reviewer prefers.