Skip to content

feat(sdk/typescript): no codegen at runtime - #13621

Merged
TomChv merged 1 commit into
dagger:mainfrom
TomChv:workspace-typescript-no-codegen-at-runtime
Jul 29, 2026
Merged

TomChv merged 1 commit into
dagger:mainfrom
TomChv:workspace-typescript-no-codegen-at-runtime

Conversation

@TomChv

@TomChv TomChv commented Jul 13, 2026

Copy link
Copy Markdown
Member

Align the TypeScript SDK with the Go SDK's no-codegen-at-runtime model: modules in the workspace config format (dagger-module.toml) run at dagger call time straight from their committed generated files, with no codegen pass. The engine gates this by config format and omits the moduleRuntime introspectionJson argument for those modules.

  • Drop the ModuleTypes SDK function: remove the method, Introspector.AsEntrypoint, and the dispatcher case in the generated client. Type discovery now flows through the runtime getModDef path, served by the committed static __dagger.entrypoint.ts register(), mirroring the Go SDK.

  • Add the no-codegen runtime path: mark ModuleRuntime's introspectionJSON argument optional so the engine can omit it; each runtime's SetupContainer (node/deno/bun) then branches on nil and mounts the committed tree, installs dependencies and runs the committed entrypoint instead of regenerating. requireGeneratedFiles fails with an actionable "run dagger generate" error when a committed file is missing.

  • Add a DaggerModule -> introspection-JSON emitter (introspection_json.ts) and an EMIT_INTROSPECTION_JSON_FILE introspector sink, mirroring the Go introspect_emit.go. Staged for self-call bindings; not yet wired into Codegen (self calls are a follow-up).

  • Add the design doc under hack/designs.

@TomChv
TomChv requested a review from a team as a code owner July 13, 2026 15:15
@TomChv TomChv self-assigned this Jul 13, 2026
@TomChv
TomChv force-pushed the workspace-typescript-no-codegen-at-runtime branch from ecc2435 to 63878d4 Compare July 13, 2026 15:39
@TomChv
TomChv force-pushed the workspace-typescript-no-codegen-at-runtime branch 2 times, most recently from f5816c2 to 8ee95f3 Compare July 15, 2026 10:11
@TomChv

TomChv commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

I tested the PR manually and so far so good, the only issue is the same as in #13593 (comment), if you have a module that install another local module that exist in the workspace, dagger generate will fails.

List of things I tested:

  • Install the typescript sdk
  • Create a module hello
  • Run generate -> the skip correctly work and so my generation is completed
  • dagger api functions
  • dagger api call --help
  • add function to the code and run dagger api call --help -> doesn't not exist which is expected, we need to run dagger generate first
  • delete the sdk dir and do api call -> fails as expected, the error message is clear: run dagger generate
    dagger generate work after and the module is back to normal 🚀

Multi module test

@TomChv
TomChv force-pushed the workspace-typescript-no-codegen-at-runtime branch 2 times, most recently from 4a913de to 132435c Compare July 16, 2026 14:18
@TomChv
TomChv force-pushed the workspace-typescript-no-codegen-at-runtime branch from 132435c to 9412566 Compare July 21, 2026 15:28
@TomChv

TomChv commented Jul 21, 2026 •

Copy link
Copy Markdown
Member Author

Ok so I tested with the new typescript-sdk that supports cwd aware and so far it works.

If you change something in a local dep of a local module, you need to run generate 2 times:

  • 1 time will update the dep entrypoint (to register the new function in the entrypoint schema)
  • another time so the module that uses that dependency will have the binding generated to call it

You do not need to change your cwd but that's possible if something goes wrong so you can on purpose regenerate the 1 local dep and then the second.

The DX is slightly weird but it works, it will be better once we support collection.
The simplest Dx when working on a module is:

  • Update the module you want, cd in it (or stay in root but it feels weird) and run dagger generate to update entrypoint.
  • Go add the root of the workspace and rerun dagger generate to update modules that use the precedent module as a dependency.

This behaviour should be fixed by #13662

@TomChv TomChv added this to the v1.0.0 milestone Jul 21, 2026
@TomChv

TomChv commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

The PR is mergeable but I'm gonna wait for #13593 to be mergeable too so we have both in the same beta release.

@TomChv

TomChv commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

We should wait for #13706 to be complete before merging this PR so we have a nice DX.

@TomChv

TomChv commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

I'm rebasing this PR since the work to fix dependency loading is merge on both engine and the typescript-sdk, so this PR is mergeable now with the expected DX

Align the TypeScript SDK with the Go SDK's no-codegen-at-runtime model:
modules in the workspace config format (dagger-module.toml) run at
`dagger call` time straight from their committed generated files, with no
codegen pass. The engine gates this by config format and omits the
moduleRuntime introspectionJson argument for those modules.

- Drop the `ModuleTypes` SDK function: remove the method,
  `Introspector.AsEntrypoint`, and the dispatcher case in the generated
  client. Type discovery now flows through the runtime `getModDef` path,
  served by the committed static `__dagger.entrypoint.ts` `register()`,
  mirroring the Go SDK.

- Add the no-codegen runtime path: mark `ModuleRuntime`'s
  `introspectionJSON` argument optional so the engine can omit it; each
  runtime's `SetupContainer` (node/deno/bun) then branches on nil and
  mounts the committed tree, installs dependencies and runs the committed
  entrypoint instead of regenerating. `requireGeneratedFiles` fails with an
  actionable "run `dagger generate`" error when a committed file is missing.

- Make the static `register()` a faithful replacement for the old runtime
  introspection: propagate source-map locations for objects, functions,
  fields, arguments, enums and enum members through the typedef JSON into
  the generated entrypoint, and register explicit `null` argument defaults.
  Without this, a no-codegen dependency lost its source-map comments and
  null defaults in dependents' bindings.

- Add a `DaggerModule` -> introspection-JSON emitter
  (`introspection_json.ts`) and an `EMIT_INTROSPECTION_JSON_FILE`
  introspector sink, mirroring the Go `introspect_emit.go`. Staged for
  self-call bindings; not yet wired into Codegen (self calls are a
  follow-up).

- Add the design doc under hack/designs.

Signed-off-by: Tom Chauveau <[email protected]>
@TomChv
TomChv force-pushed the workspace-typescript-no-codegen-at-runtime branch from e393d0a to d6963b6 Compare July 29, 2026 11:20
@TomChv

TomChv commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

Same as #13720 (comment), it looks like there's a flack in golang:test-all

@TomChv
TomChv merged commit 5216c9f into dagger:main Jul 29, 2026
87 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