Skip to content

module-codegen: remove self-call bindings - #92

Merged
eunomie merged 3 commits into
mainfrom
remove-self-calls
Nov 23, 2026
Merged

eunomie merged 3 commits into
mainfrom
remove-self-calls

Conversation

@vito

@vito vito commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Self-calls are now dagger module client add . (per @eunomie): a module's own client is generated from the schema the engine serves for it, like any dependency client. The module generator no longer needs to predict that schema, so this removes the self-call machinery from module-codegen.

What's deleted

  • helpers/module-codegen/gogenerator/schema_merge.go: the port of core.Schema.Merge that merged the module's predicted types into the dependency schema.
  • In generate.go: the module self-introspection, the merge, and the second client pass over the merged schema. The client is rendered from the schema the engine served, and the package is loaded once.
  • templates/introspect_emit.go and templates/introspect_collection.go, with their tests: the emitter that predicted the module's own types, enum members and namespaced names with strcase.
  • ModuleIntrospectionEmitter / NewModuleIntrospectionEmitter in templates/functions.go.
  • The self-call asserts in roundtrip_test.go, and TestGenerateUnifiedModuleProjectsOwnChecks (fix(go): type checks as Check in unified bindings #83), which only checked the self-call binding. Check projection for clients stays covered by TestUnifiedClientProjectsChecks.
  • The self-call steps in design/manifest-v2-prototype.md.

The embedded bootstrap render stays, with a corrected comment: unified bindings are rendered against the module's sources, which need the complete core surface and a tidy go.sum to list cleanly. Embedded bindings are now that bootstrap, rendered once.

The collection check (a stored keys field and a one-argument get function) lived only in the deleted emitter. It moves to where the entrypoint declares the collection, with the same messages, so an incomplete collection is still refused at generation rather than at load.

Who is affected

Users of unreleased main with dangEntrypoint = true whose module calls itself through its generated bindings (the <OwnModule> field on the client root, e.g. dag.Hello()) or uses its own types from internal/dagger. The next generation removes the generated internal/dagger/<module>.gen.go as a stale binding, and such code stops compiling. The fix is dagger module client add . with unifiedClients = true.

Released v1.1.1 has no module-codegen and is unaffected.

Known gap (follow-up)

  • A fresh unified module's own client needs a second generation, or a reorder in generateScope: clients are rendered before the module's entrypoint exists.
  • Embedded entrypoint scopes (unifiedClients = false) refuse clients, so they cannot add themselves.

Testing

  • go vet ./... and go test ./... in cmd/dagger-go-sdk-codegen and helpers/module-codegen.
  • e2e on the session's stock engine: entrypoint/generate-check, entrypoint/module-init-check, sources/collection-check, target/default-check, target/dependency-check, entrypoint/global-client-compatibility-check. The unified calls checks run only through engine-e2e on a development engine and were not run.

@vito
vito added this pull request to stack #93 October 30, 2026 17:55
@vito
vito force-pushed the remove-self-calls branch from 5436366 to b94fcc6 Compare November 4, 2026 16:46
@vito
vito force-pushed the remove-self-calls branch from b94fcc6 to 9fa8ad1 Compare November 5, 2026 22:43
@vito
vito marked this pull request as ready for review November 6, 2026 17:54
@vito
vito force-pushed the remove-self-calls branch from 9fa8ad1 to 8fc94de Compare November 6, 2026 17:56
@eunomie
eunomie force-pushed the remove-self-calls branch 2 times, most recently from 7ee689f to 416ff2b Compare November 16, 2026 17:29
vito added 3 commits November 19, 2026 18:49
Self-calls are now `dagger module client add .`: a module's own client is
generated from the schema the engine serves for it, like any dependency
client. The module generator no longer predicts that schema: drop module
self-introspection (introspect_emit, introspect_collection and the emitter
API), the port of core.Schema.Merge, and the second client pass over the
merged schema.

The embedded bootstrap render stays: unified bindings are rendered against
the module's sources, which need the complete core surface and a tidy go.sum
to list cleanly. A previously generated <module>.gen.go is removed as a stale
binding on the next generation.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
A collection without a stored keys field or a one-argument get function was
refused while generating the self-call schema. With that gone, generation
succeeded and the module failed only when the engine loaded it. Refuse it
again where the entrypoint declares the collection, with the same messages.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
Without self-calls, embedded bindings are the bootstrap itself; rendering
them again only removed stale bindings, which the bootstrap now does. The
design doc no longer lists <module>.gen.go and says self-calls need unified
bindings, since embedded bindings refuse clients.

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie merged commit d7b7346 into main Nov 23, 2026
63 checks passed
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