Repository navigation
Bump to v1.0.0-beta.11 and write directories with the native workspace API - #37
Merged
TomChv merged 2 commits intoAug 28, 2026
Conversation
beta.11 lands Workspace.withDirectory, which the next patch needs, and changes the lockfile schema: git.ref carried an object value that beta.11's parser rejects outright, so every command — dagger check, and dagger update itself — fails with "lockfile line 6: invalid value" until the file is migrated. Regenerated by letting a beta.11 engine resolve the entries: git.ref splits into git-latest + git-sha and container.from becomes oci-sha. The legacy container.from lines are dropped rather than left in place; beta.11 no longer writes them, and engineVersion now rules out the beta.10 that read them. No dependency moves: sdk-sdk stays pinned at 3344489, the sha the old git.ref entry held. Signed-off-by: Yves Brissaud <[email protected]>
Both call sites carried scaffolding for a Workspace.withNewDirectory that meant two different things: it replaced the directory it wrote on a local-directory workspace and merged into it on a synthetic one, the shape a git-loaded workspace has. beta.11 makes it always replace and adds Workspace.withDirectory, which always merges. Confirmed against a beta.11 engine on both workspace kinds: withNewDirectory [added.txt] withDirectory [added.txt, existing.txt, keep.txt] init wants the merge, so it says so: the read-back of existingDir(ws, modPath) that hand-merged the starter onto the destination is now withDirectory. Clients want the opposite. Regeneration owns the *.gen.ts set and has to drop the bindings of a module that has left the closure, which a merge cannot do — so they keep withNewDirectory and rebuild the directory they replace it with. What goes away there is the second prune: the bindings came off the workspace with withoutFile as well as out of the baseline, purely to cover the merging half of the old split. One prune, in the baseline, now covers both kinds. The baseline still reads from the untouched workspace. Pruning the workspace and reading it back loses the directory outright on a local-directory workspace — still open as dagger/dagger#13955, still reproducible on beta.11: ws.withoutFile("/fixture/keep.txt").directory("/fixture").entries => stat fixture: no such file or directory Building the client on withDirectory instead fails for that reason, and fails loudly: generate-client-respects-existing-check reports main.ts removed. Verified with dagger check (59/59) and, on an engine-driven `dagger module init typescript busy --path ./busy-target`, over a directory holding foo.txt, existing.ts, nested/deep.txt and a package.json with its own scripts: all four survive, package.json keeps name and scripts, and the template lands beside them. Known and unchanged: generateAllClient rebuilds each client from the untouched workspace, so nested client paths (a client inside another client's directory) would have the outer one discard the inner. That predates this patch on a local-directory workspace, where withNewDirectory already replaced. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
marked this pull request as ready for review
August 27, 2026 13:01
TomChv
approved these changes
Aug 28, 2026
TomChv
added a commit
that referenced
this pull request
Aug 28, 2026
A TypeScript module's generated files — `sdk/`, `__dagger.entrypoint.ts`, and the config the runtime reads — were produced by the engine: `dagger generate` called into this SDK, which handed straight back to the engine's built-in TypeScript runtime, which ran `cmd/codegen` and `ts-introspector` in nested sessions. This SDK now produces them itself, the way it already produced clients: schema and module metadata in as plain data, container execs, changeset out, no round trip. Three reasons, the same ones the client move had. The SDK repo should own what the SDK emits, so a codegen fix is not an engine release. The upstream path carries three SDK-lib origins, a Go+TypeScript shared binary, module/client coexistence and per-runtime duplication, nearly all of which is dead on arrival for our narrower contract. And codegen becomes `go test` plus `dagger check` here instead of an engine integration test. Running a module stays with the engine's runtime. That split is the hardest constraint in the design: for a `dagger-module.toml` module the runtime does no codegen at call time, it mounts `sdk/` as `@dagger.io/dagger` and executes the committed entrypoint. Whatever generate writes *is* the artifact that runs, and it has to satisfy an unchanged runtime byte for byte in the parts it reads. **The library.** Generated bindings import their runtime from `./core.js`, a bundle that only existed inside the engine image. `library/` vendors dagger/dagger's `sdk/typescript` at v1.0.0-beta.11 and `.dagger/modules/packager` builds the bundle from it with the same recipe and pinned image the engine uses, committed so that generating a module needs no bun toolchain and no network. A copy has no merge base git can compute, so `library/VENDOR.md` records the one it would have had: source tag and commit, what was deliberately left behind, the exhaustive list of local deltas, and the re-import procedure. **Codegen.** `helpers/codegen` gains `module` (a module's own bindings, split per dependency), `entrypoint` (the static dispatcher, rendered from the introspector's typedef scan) and `library` (the vendored library's own bindings) alongside `client`. `helpers/config-updator` writes the module config the runtime reads. **Routing.** `Mod.generate` takes the local path for `dagger-module.toml` modules and keeps delegating for `dagger.json` ones, which regenerate at call time regardless. Both stage the local dependency closure first — a dependent's schema is only loadable once its deps' generated files exist — and both take that staging back out of the changeset, each in the way its route requires. Regeneration prunes the `*.gen.ts` it owns out of the baseline the generated tree is layered onto. Layering is what keeps the module's own source and config in the changeset, but it can only add, so a dependency dropped from the config would otherwise keep its `<dep>.gen.ts` — an API against a module that is no longer served, which a default tsc rejects. Pruned in one place, matching what #37 established for client generation once `withNewDirectory` stopped meaning different things on different workspace kinds. **Engine pairing.** Everything here is built for one release. The SDK states it once as `targetEngineVersion`; the runtime harness and every fixture read from there, and a check fails when they disagree. **Tests.** Golden tests over the renderers; e2e checks over the generated tree, the routing, dependency edges in both config formats, config preservation and binding pruning; a differential check that generates a fixture through this SDK and through the engine and diffs everything but the bundle; and one fixture per TypeScript runtime that loads a generated module and calls a function on it, which is the only thing that proves the on-disk contract end to end. Replaces the #18 → #34 stack, squashed: several of those PRs overwrote earlier ones, which made the intermediate states hard to reason about and impossible to test independently. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Aug 28, 2026
A TypeScript module's generated files — `sdk/`, `__dagger.entrypoint.ts`, and the config the runtime reads — were produced by the engine: `dagger generate` called into this SDK, which handed straight back to the engine's built-in TypeScript runtime, which ran `cmd/codegen` and `ts-introspector` in nested sessions. This SDK now produces them itself, the way it already produced clients: schema and module metadata in as plain data, container execs, changeset out, no round trip. Three reasons, the same ones the client move had. The SDK repo should own what the SDK emits, so a codegen fix is not an engine release. The upstream path carries three SDK-lib origins, a Go+TypeScript shared binary, module/client coexistence and per-runtime duplication, nearly all of which is dead on arrival for our narrower contract. And codegen becomes `go test` plus `dagger check` here instead of an engine integration test. Running a module stays with the engine's runtime. That split is the hardest constraint in the design: for a `dagger-module.toml` module the runtime does no codegen at call time, it mounts `sdk/` as `@dagger.io/dagger` and executes the committed entrypoint. Whatever generate writes *is* the artifact that runs, and it has to satisfy an unchanged runtime byte for byte in the parts it reads. **The library.** Generated bindings import their runtime from `./core.js`, a bundle that only existed inside the engine image. `library/` vendors dagger/dagger's `sdk/typescript` at v1.0.0-beta.11 and `.dagger/modules/packager` builds the bundle from it with the same recipe and pinned image the engine uses, committed so that generating a module needs no bun toolchain and no network. A copy has no merge base git can compute, so `library/VENDOR.md` records the one it would have had: source tag and commit, what was deliberately left behind, the exhaustive list of local deltas, and the re-import procedure. **Codegen.** `helpers/codegen` gains `module` (a module's own bindings, split per dependency), `entrypoint` (the static dispatcher, rendered from the introspector's typedef scan) and `library` (the vendored library's own bindings) alongside `client`. `helpers/config-updater` writes the module config the runtime reads. **Routing.** `Mod.generate` takes the local path for `dagger-module.toml` modules and keeps delegating for `dagger.json` ones, which regenerate at call time regardless. Both stage the local dependency closure first — a dependent's schema is only loadable once its deps' generated files exist — and both take that staging back out of the changeset, each in the way its route requires. Regeneration prunes the `*.gen.ts` it owns out of the baseline the generated tree is layered onto. Layering is what keeps the module's own source and config in the changeset, but it can only add, so a dependency dropped from the config would otherwise keep its `<dep>.gen.ts` — an API against a module that is no longer served, which a default tsc rejects. Pruned in one place, matching what different things on different workspace kinds. **Engine pairing.** Everything here is built for one release. The SDK states it once as `targetEngineVersion`; the runtime harness and every fixture read from there, and a check fails when they disagree. **Tests.** Golden tests over the renderers; e2e checks over the generated tree, the routing, dependency edges in both config formats, config preservation and binding pruning; a differential check that generates a fixture through this SDK and through the engine and diffs everything but the bundle; and one fixture per TypeScript runtime that loads a generated module and calls a function on it, which is the only thing that proves the on-disk contract end to end. Replaces the #18 → #34 stack, squashed: several of those PRs overwrote earlier ones, which made the intermediate states hard to reason about and impossible to test independently. Rebased onto #37 (beta.11) and #38 (the interface-return fix and the config-updater rename); the entrypoint golden #38 added is regenerated here, because this generator emits the source maps the engine expects and main's did not. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Sep 1, 2026
A TypeScript module's generated files — `sdk/`, `__dagger.entrypoint.ts`, and the config the runtime reads — were produced by the engine: `dagger generate` called into this SDK, which handed straight back to the engine's built-in TypeScript runtime, which ran `cmd/codegen` and `ts-introspector` in nested sessions. This SDK now produces them itself, the way it already produced clients: schema and module metadata in as plain data, container execs, changeset out, no round trip. Three reasons, the same ones the client move had. The SDK repo should own what the SDK emits, so a codegen fix is not an engine release. The upstream path carries three SDK-lib origins, a Go+TypeScript shared binary, module/client coexistence and per-runtime duplication, nearly all of which is dead on arrival for our narrower contract. And codegen becomes `go test` plus `dagger check` here instead of an engine integration test. Running a module stays with the engine's runtime. That split is the hardest constraint in the design: for a `dagger-module.toml` module the runtime does no codegen at call time, it mounts `sdk/` as `@dagger.io/dagger` and executes the committed entrypoint. Whatever generate writes *is* the artifact that runs, and it has to satisfy an unchanged runtime byte for byte in the parts it reads. **The library.** Generated bindings import their runtime from `./core.js`, a bundle that only existed inside the engine image. `library/` vendors dagger/dagger's `sdk/typescript` at v1.0.0-beta.11 and `.dagger/modules/packager` builds the bundle from it with the same recipe and pinned image the engine uses, committed so that generating a module needs no bun toolchain and no network. A copy has no merge base git can compute, so `library/VENDOR.md` records the one it would have had: source tag and commit, what was deliberately left behind, the exhaustive list of local deltas, and the re-import procedure. **Codegen.** `helpers/codegen` gains `module` (a module's own bindings, split per dependency), `entrypoint` (the static dispatcher, rendered from the introspector's typedef scan) and `library` (the vendored library's own bindings) alongside `client`. `helpers/config-updater` writes the module config the runtime reads. **Routing.** `Mod.generate` takes the local path for `dagger-module.toml` modules and keeps delegating for `dagger.json` ones, which regenerate at call time regardless. Both stage the local dependency closure first — a dependent's schema is only loadable once its deps' generated files exist — and both take that staging back out of the changeset, each in the way its route requires. Regeneration prunes the `*.gen.ts` it owns out of the baseline the generated tree is layered onto. Layering is what keeps the module's own source and config in the changeset, but it can only add, so a dependency dropped from the config would otherwise keep its `<dep>.gen.ts` — an API against a module that is no longer served, which a default tsc rejects. Pruned in one place, matching what different things on different workspace kinds. **Engine pairing.** Everything here is built for one release. The SDK states it once as `targetEngineVersion`; the runtime harness and every fixture read from there, and a check fails when they disagree. **Tests.** Golden tests over the renderers; e2e checks over the generated tree, the routing, dependency edges in both config formats, config preservation and binding pruning; a differential check that generates a fixture through this SDK and through the engine and diffs everything but the bundle; and one fixture per TypeScript runtime that loads a generated module and calls a function on it, which is the only thing that proves the on-disk contract end to end. Replaces the #18 → #34 stack, squashed: several of those PRs overwrote earlier ones, which made the intermediate states hard to reason about and impossible to test independently. Rebased onto #37 (beta.11) and #38 (the interface-return fix and the config-updater rename); the entrypoint golden #38 added is regenerated here, because this generator emits the source maps the engine expects and main's did not. Signed-off-by: Tom Chauveau <[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.
This moves the TypeScript SDK to engine
v1.0.0-beta.11and writes init and client directories through the native workspace API.dagger.jsonandREADME.md:engineVersionv1.0.0-beta.10→v1.0.0-beta.11.dagger.lockis migrated — forced, not cosmetic: beta.11's parser rejects the oldgit.refobject value outright (lockfile line 6: invalid value), breaking every command includingdagger updateitself. Regenerated by a beta.11 engine:git.ref→git-latest+git-sha,container.from→oci-sha. sdk-sdk stays at3344489, so no dependency moved.initModule: the read-back-and-merge workaround (existingDir(ws, modPath).withDirectory(...)fed intowithNewDirectory) collapses tows.withDirectory("/" + modPath, templateSource), now that dagger/dagger#13956 ships a mergingWorkspace.withDirectory.generateClient/generateAllClient: keepwithNewDirectory. Clients must prune stale*.gen.ts, which a merge cannot do. The double prune (baseline + workspace-levelwithoutFile) collapses to one, and thewithoutClientBindingshelper is deleted.Notes
generateAllClientrebuilds each client from the untouched workspace, so a nested client path (a client inside another client's directory) would have the outer discard the inner. This predates this branch on local-directory workspaces and is not addressed here.withoutFilefollowed by a read-back loses the directory on a local-directory workspace. That read is load-bearing and must not be "simplified" away.Test
dagger check59/59 against a
v1.0.0-beta.11engine, lockfile stable across runs. Livedagger module init typescript … --path …was driven end to end — onto an empty target, and onto a non-empty one holdingfoo.txt,existing.ts,nested/deep.txtand apackage.jsonwith its own scripts: all survive,package.jsonmerged, template lands beside them.