Repository navigation
feat(setup): migrate local toolchains and dependencies in place - #13620
Conversation
b122afb to
42250b9
Compare
42250b9 to
61ab332
Compare
61ab332 to
4d1832a
Compare
Design + reviewed plan for migrating the locally-referenced toolchains and dependencies of the root dagger.json (and their transitive local deps) to the new workspace format in place during `dagger setup`. Signed-off-by: Yves Brissaud <[email protected]>
TomChv
left a comment
There was a problem hiding this comment.
Reviewed design + correctness + style. In-place-vs-move split is the right shape and every gate on DiscoveredLocalModule is consistent. Verified the DFS is cycle/diamond-safe by construction and the AddMigratedModuleSDK extraction is behavior-preserving. No correctness issues found. Two nits below (test coverage + changie), otherwise LGTM.
| ref.Name, ref.Source)) | ||
| continue | ||
| } | ||
| if _, ok := visited[modDir]; ok { |
There was a problem hiding this comment.
The doc comment promises diamond-dedup and cycle-safety, and the code delivers it (visited[modDir] is marked before the push, seeds pre-seed visited). But nothing tests it — the integration suite covers transitive/nested/absolute/hidden, not a diamond (A→B, A→C, B→D, C→D ⇒ D converted once) or a cycle (A→B→A). Both are cheap and would catch a future reorder of this marking. Worth adding one of each.
4d1832a to
1ffd397
Compare
|
I wait for the CI to be green and I'm ready to approve this PR :) |
Extend `dagger setup` migration to convert the locally-referenced modules of the root dagger.json — its toolchains and the main module's dependencies — and their transitive local dependencies, from legacy dagger.json to dagger-module.toml, in place. A schema-layer depth-first walk discovers these modules starting from the selected config and the .dagger/modules glob, deduping by canonical directory (diamond-safe) with a visited set seeded from every initial config dir (cycle-safe). Discovered modules convert in place regardless of a non-root source (a normal toolchain), and never route through PlanMigration or a parent plan. Modules that resolve outside the workspace, that have no dagger.json, or that own toolchains/blueprint (a genuine nested workspace) are left as legacy — safe, since a legacy dagger.json still loads — with a migration warning. Each converted module's runtime is installed and pinned in the workspace config that owns it, recorded under [[modules.<sdk>.as-sdk.modules]] and sharing one install per runtime, so a module loaded from a local ref inside the workspace has its SDK present. The root module's SDK install is refactored to share this AddMigratedModuleSDK helper. Signed-off-by: Yves Brissaud <[email protected]>
Unit tests for LocalModuleRefs / HasOwnWorkspaceSemantics and the discovered-local-module conversion routing, plus integration coverage for in-place toolchain and dependency migration, transitive dependencies, and the nested-workspace skip. Signed-off-by: Yves Brissaud <[email protected]>
1ffd397 to
ee4fb5d
Compare
Extends
dagger setupmigration so the rootdagger.json's locally-referenced toolchains and main-module dependencies — and their transitive local deps — are migrated from legacydagger.jsontodagger-module.tomlin place (not moved), via a cycle/diamond-safe depth-first walk.[[modules.<sdk>.as-sdk.modules]], sharing one install per runtime.dagger.json, are absolute refs, sit under a hidden.dagger/modulespath, or own their own toolchains/blueprint are left as legacy (safe — a legacydagger.jsonstill loads) with a migration warning.core/workspace/migrate.go'sPlanMigrationandcore/schema's install/conversion paths (sharedAddMigratedModuleSDKhelper + a shared config-targets helper).Verification
TestWorkspaceMigrationintegration suite (32 subtests) passes viadagger call engine-dev test.core/workspace+core/schemaunit tests pass;go build ./core/...,go vet, and gofmt are clean.