Repository navigation
Go SDK: no-codegen-at-runtime + single-pass codegen - #13381
Merged
Merged
Conversation
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. |
eunomie
force-pushed
the
workspace-go-no-codegen-at-runtime
branch
2 times, most recently
from
June 25, 2026 10:05
1ce7e3c to
d861b65
Compare
eunomie
force-pushed
the
workspace-go-no-codegen-at-runtime
branch
17 times, most recently
from
July 7, 2026 10:43
0fb26f5 to
cfcd657
Compare
eunomie
force-pushed
the
workspace-go-no-codegen-at-runtime
branch
2 times, most recently
from
July 7, 2026 13:29
fe9304c to
cc4ee87
Compare
When codegen.automaticGitignore=false, the Go SDK trusts the committed dagger.gen.go + internal/dagger files and skips the codegen pass at runtime. Codegen still runs at init/develop/generate time. The opt-out is only honored when the module's engineVersion is at least as new as the running engine; on version skew we fall back to runtime codegen so stale committed files never silently run. Signed-off-by: Yves Brissaud <[email protected]>
… SDK
The Go generator used to build and run the module once just to discover
its own types (moduleTypes), then run codegen again. It now emits those
types from its existing packages.Load analysis and merges them into the
deps schema with the engine's schema-merge tool: one pass. moduleTypes
is dropped from the Go SDK; type discovery goes through the generated
invoke() empty-parentName arm, and sources persisted by an older engine
fall back to the runtime path instead of erroring.
Self calls are always enabled for Go, no SELF_CALLS flag: every module
gets bindings for its own types, generated into their own <module>.gen.go
like any dependency. A dependency installed under the module's own name
is rejected.
Compatibility notes:
- schema views < v0.12.0 skip the merge: their layout puts everything in
package main, where self types would collide with user code
- user-declared "id" members are not emitted (engine-reserved)
- a module type shadowing a core or dependency type is skipped in the
bindings and no longer fails the load; the name keeps resolving to the
original type
- Go keywords and predeclared identifiers used as field/argument names
get a trailing underscore in the bindings ("error" excepted: already
shipped by the core API, never collides)
- the emitted introspection mirrors the engine schema: namespaced type
names, synthetic id fields (plus legacy <T>ID scalars pre-v0.21),
object/interface args passed as ID with @expectedType, engine enum
member naming, NON_NULL stripped only for +optional args
- the legacy-dagger.json workspace warning is only emitted for clients
that load modules, so the codegen client (which now always connects)
doesn't leak it into the caller's output
Signed-off-by: Yves Brissaud <[email protected]>
Direct self-calls (arguments, defaults, exported fields, enums, secondary objects, objects passed by ID), self-calls through a dependency, and through a transitive dependency. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
force-pushed
the
workspace-go-no-codegen-at-runtime
branch
from
July 7, 2026 13:39
cc4ee87 to
c16fd22
Compare
TomChv
reviewed
Jul 7, 2026
This was referenced Jul 8, 2026
kpenfound
added a commit
to kpenfound/dagger
that referenced
this pull request
Jul 14, 2026
f81f5d0 reduced the runtime-codegen gate to config format alone: dagger-module.toml modules always build their committed generated files as-is. But bindings generated before v1.0.0-beta.6 cannot serve type discovery: the generated invoke() dispatcher's empty-parentName typedef-registration arm — which module loading (getModDef) relies on — was removed from codegen in dagger#10584 and only reintroduced in dagger#13381, first released in v1.0.0-beta.6. Loading such a module fails with "unknown object", and there is no way out from the CLI, since regenerating the bindings requires loading the module first. Gate the committed-files path on a fixed capability floor: modules pinned below v1.0.0-beta.6 fall back to runtime codegen so their bindings are regenerated to match; anything pinned at or above the floor keeps the committed-files behavior regardless of how much newer the running engine is. The floor is compared with full prerelease precision — it landed in a beta, so base-version comparison would wrongly trust bindings from earlier betas. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: kpenfound <[email protected]>
kpenfound
added a commit
to kpenfound/dagger
that referenced
this pull request
Jul 14, 2026
f81f5d0 reduced the runtime-codegen gate to config format alone: dagger-module.toml modules always build their committed generated files as-is. But bindings generated before v1.0.0-beta.6 cannot serve type discovery: the generated invoke() dispatcher's empty-parentName typedef-registration arm — which module loading (getModDef) relies on — was removed from codegen in dagger#10584 and only reintroduced in dagger#13381, first released in v1.0.0-beta.6. Loading such a module fails with "unknown object", and there is no way out from the CLI, since regenerating the bindings requires loading the module first. Gate the committed-files path on a fixed capability floor: modules pinned below v1.0.0-beta.6 fall back to runtime codegen so their bindings are regenerated to match; anything pinned at or above the floor keeps the committed-files behavior regardless of how much newer the running engine is. The floor is compared with full prerelease precision — it landed in a beta, so base-version comparison would wrongly trust bindings from earlier betas. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: kpenfound <[email protected]>
kpenfound
added a commit
to kpenfound/dagger
that referenced
this pull request
Jul 20, 2026
f81f5d0 reduced the runtime-codegen gate to config format alone: dagger-module.toml modules always build their committed generated files as-is. But bindings generated before v1.0.0-beta.6 cannot serve type discovery: the generated invoke() dispatcher's empty-parentName typedef-registration arm — which module loading (getModDef) relies on — was removed from codegen in dagger#10584 and only reintroduced in dagger#13381, first released in v1.0.0-beta.6. Loading such a module fails with "unknown object", and there is no way out from the CLI, since regenerating the bindings requires loading the module first. Gate the committed-files path on a fixed capability floor: modules pinned below v1.0.0-beta.6 fall back to runtime codegen so their bindings are regenerated to match; anything pinned at or above the floor keeps the committed-files behavior regardless of how much newer the running engine is. The floor is compared with full prerelease precision — it landed in a beta, so base-version comparison would wrongly trust bindings from earlier betas. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: kpenfound <[email protected]>
marcosnils
pushed a commit
to kpenfound/dagger
that referenced
this pull request
Jul 22, 2026
f81f5d0 reduced the runtime-codegen gate to config format alone: dagger-module.toml modules always build their committed generated files as-is. But bindings generated before v1.0.0-beta.6 cannot serve type discovery: the generated invoke() dispatcher's empty-parentName typedef-registration arm — which module loading (getModDef) relies on — was removed from codegen in dagger#10584 and only reintroduced in dagger#13381, first released in v1.0.0-beta.6. Loading such a module fails with "unknown object", and there is no way out from the CLI, since regenerating the bindings requires loading the module first. Gate the committed-files path on a fixed capability floor: modules pinned below v1.0.0-beta.6 fall back to runtime codegen so their bindings are regenerated to match; anything pinned at or above the floor keeps the committed-files behavior regardless of how much newer the running engine is. The floor is compared with full prerelease precision — it landed in a beta, so base-version comparison would wrongly trust bindings from earlier betas. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: kpenfound <[email protected]>
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.
Replaces #13210.
Reworks the Go SDK codegen path:
codegen.automaticGitignore=falsethe SDK trusts the committeddagger.gen.go+internal/daggerfiles instead of regenerating them onevery load. Only honored when the module's
engineVersionis at least asnew as the running engine; on skew it falls back to runtime codegen so
stale files never silently run.
generate-moduleruns once. The generator emits the module's own typesfrom its
packages.Loadanalysis and merges them into the deps schema viathe engine's schema tool, instead of building and running the module first.
moduleTypesis dropped from the Go SDK.SELF_CALLSflag: every module getsbindings for its own types, generated into their own
<module>.gen.golikeany dependency.