Skip to content

feat(setup): migrate local toolchains and dependencies in place - #13620

Merged
eunomie merged 3 commits into
dagger:mainfrom
eunomie:setup-module-tree-migration-8c6c4766
Jul 15, 2026
Merged

eunomie merged 3 commits into
dagger:mainfrom
eunomie:setup-module-tree-migration-8c6c4766

Conversation

@eunomie

@eunomie eunomie commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Extends dagger setup migration so the root dagger.json's locally-referenced toolchains and main-module dependencies — and their transitive local deps — are migrated from legacy dagger.json to dagger-module.toml in place (not moved), via a cycle/diamond-safe depth-first walk.

  • Each converted module's runtime SDK is installed and pinned in the owning workspace config, recorded under [[modules.<sdk>.as-sdk.modules]], sharing one install per runtime.
  • Modules that resolve outside the workspace, have no dagger.json, are absolute refs, sit under a hidden .dagger/modules path, or own their own toolchains/blueprint are left as legacy (safe — a legacy dagger.json still loads) with a migration warning.
  • Reuses core/workspace/migrate.go's PlanMigration and core/schema's install/conversion paths (shared AddMigratedModuleSDK helper + a shared config-targets helper).

Verification

  • TestWorkspaceMigration integration suite (32 subtests) passes via dagger call engine-dev test.
  • All core/workspace + core/schema unit tests pass; go build ./core/..., go vet, and gofmt are clean.

@eunomie
eunomie force-pushed the setup-module-tree-migration-8c6c4766 branch 2 times, most recently from b122afb to 42250b9 Compare July 15, 2026 07:57
@eunomie eunomie added this to the v1.0.0 milestone Jul 15, 2026
@eunomie
eunomie force-pushed the setup-module-tree-migration-8c6c4766 branch from 42250b9 to 61ab332 Compare July 15, 2026 11:15
@eunomie eunomie self-assigned this Jul 15, 2026
@eunomie
eunomie force-pushed the setup-module-tree-migration-8c6c4766 branch from 61ab332 to 4d1832a Compare July 15, 2026 14:14
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 TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread core/schema/workspace_migrate_parent.go Resolved
@eunomie
eunomie force-pushed the setup-module-tree-migration-8c6c4766 branch from 4d1832a to 1ffd397 Compare July 15, 2026 14:24
@TomChv

TomChv commented Jul 15, 2026

Copy link
Copy Markdown
Member

I wait for the CI to be green and I'm ready to approve this PR :)

eunomie added 2 commits July 15, 2026 16:38
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]>
@eunomie
eunomie force-pushed the setup-module-tree-migration-8c6c4766 branch from 1ffd397 to ee4fb5d Compare July 15, 2026 14:40
@eunomie
eunomie merged commit 973d8fc into dagger:main Jul 15, 2026
87 checks passed
@eunomie
eunomie deleted the setup-module-tree-migration-8c6c4766 branch July 15, 2026 15:11
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.

2 participants