Repository navigation
fix(setup): resolve SDK installs in every migrated workspace config - #13653
Conversation
0b576b0 to
63bb355
Compare
Migration records builtin-SDK installs by their bare runtime short name (e.g. `source = "go"`), which `dagger setup` then resolves to a real, installable ref via sdks.json — the same result `dagger sdk install go` produces. That resolution pass only ran against the top-level workspace the setup command runs in, so SDK installs migration wrote into other configs it creates — nested workspace plans and locally-referenced modules discovered under them — kept their non-functional bare source. Scope the resolution to exactly the dagger.toml files the migration changeset wrote (from its added/modified paths) and resolve each, reusing the existing generic fixup logic. The top-level config keeps going through the workspace API; the rest are rewritten on disk. Because the set is the migration's own output, pre-existing workspace configs the migration treats as ownership boundaries are never touched, and a declined migration resolves nothing. Signed-off-by: Yves Brissaud <[email protected]>
63bb355 to
943278c
Compare
| for _, fix := range fixes { | ||
| fmt.Fprintf(out, " Resolved SDK %q to %s\n", fix.SDKName, fix.Ref) | ||
| } | ||
| } |
There was a problem hiding this comment.
Optional: since the migration is already exported to disk in this session, the top-level config could also go through resolveMigratedSDKsInConfigFile(out, filepath.Join(root, workspace.ConfigFileName)), which would let you drop this WithConfigValue/Export block and the filepath.Clean(rel) == workspace.ConfigFileName skip — unifying both paths on one code path. Defensible to keep the top-level on the workspace API though; just flagging the trade-off.
There was a problem hiding this comment.
It's not really possible to unify both. The config have to be written on the disk, but at the same time the we still need the workspace API because of recommend/install step later in the same session.
I'll merge that way for now, and if it can be improved later that will be good thing.
dagger setupmigration records builtin-SDK installs by bare short name (e.g.source = "go"), and a CLI pass then resolves them to real refs viasdks.json(the same resolution asdagger sdk install go). That pass only ran against the top-level workspace config — so the SDK installs migration wrote into the other configs it creates (nested workspace plans, and locally-referenced modules discovered under them, from #13620) kept a non-functional baresource.This scopes resolution to exactly the
dagger.tomlfiles the migration changeset wrote and resolves each, reusing the existing generic fixup logic. Pre-existing workspace configs (the migration's ownership boundaries) are never touched, and a declined migration resolves nothing.internal/cmd/dagger/setup.go— scope SDK-install resolution to the changeset-written configs.core/integration/workspace_migration_test.go— +3 regression tests.Verified: real before/after repro via engine-dev (the nested-config bare
sourcenow resolves after the fix); fullTestWorkspaceMigrationsuite (37 tests, incl. the 3 new) passes;core/workspace+internal/cmd/daggerunit tests pass; build / gofmt / vet clean.