Repository navigation
Generate a module entrypoint by default, targeting engine v1.0.0-beta.15 - #73
Conversation
The generated entrypoint/main.dang passed it on the exec that runs the TypeScript dispatcher, so the dispatcher could open its own session back to the engine. Container nesting has been on by default since dagger/dagger#14082, which makes the argument redundant everywhere the entrypoint can be loaded at all. Signed-off-by: Tom Chauveau <[email protected]>
The `entrypoint` setting becomes `legacyRuntime`, inverted: a module now declares an `[entrypoint]` with entrypoint/main.dang and the __dagger.dispatch.ts it shells out to, and the `[runtime]` layout — sdk/ as the package, a committed __dagger.entrypoint.ts — is what you opt into for an engine too old to load one. The 16 branch sites keep reading in terms of the path they pick, through one private derived field rather than an inverted condition each. The check suite stays on the path it was written against. Gen.scope defaults to `legacyRuntime: true` and says why; the checks that assert the legacy layout by path pin it, the three entrypoint checks pass `legacyRuntime: false`, and the engine-e2e CLI checks pass `--legacy-runtime` because their second half calls the module — which an `[entrypoint]` manifest cannot do until the builder emits a manifestVersion (dagger/dagger#14038). Signed-off-by: Tom Chauveau <[email protected]>
The entrypoint a module now generates by default is only read by an engine carrying dagger/dagger#14038, which first shipped in beta.15 — so that is the release this SDK's bundle is paired with. The nine managed fixture manifests move with it, which is what fixture-engine-version-check holds. The pairing moves without the vendored sources, and library/VENDOR.md records why rather than letting its "move together or not at all" rule go quietly stale: client.gen.ts is regenerated here and already matches beta.15's schema, and the runtimes checks run the committed bundle in a beta.15 engine. Upstream's beta.12–15 changes to the runtime sources are vendoring lag, and taking them is its own change. The SDK module's own engineVersion stays at beta.11: nothing here uses a newer core API, and raising it would lock out the engines --legacy-runtime exists to serve. Signed-off-by: Tom Chauveau <[email protected]>
The dependency is the range `dagger.io/sdk/helpers@v1`, so only the two lockfiles held v1.0.5. No call site changes: v1.0.6 makes the generic `withLegacyRuntime` public, and `withLegacyTypescriptRuntime` — which this SDK calls — was already a wrapper around it and is byte-identical in the release. `dagger lock update` also re-resolved four unrelated base-image digests (alpine, busybox, golang 1.26, verdaccio). Those are put back: moving the images everything builds on is its own change, not a dependency bump. The playground's workspace.lock is written by engine-e2e's generator, so the hand-applied edit there is only correct if the generator agrees — `engine-e-2-e:generate/stale` is what says it does. Signed-off-by: Tom Chauveau <[email protected]>
| legacyRuntime: Boolean! = false | ||
|
|
||
| """ | ||
| Whether this scope is generated as an entrypoint module. |
There was a problem hiding this comment.
Do we actually need to keep that flag?
There was a problem hiding this comment.
Dropped it in 144bd29. The 16 branch sites now test legacyRuntime directly, keeping their branch order so the comment above each one still describes the branch under it:
let configured = if (legacyRuntime == false) {
withEntrypointManifest(seeded, scope, name, hasToml)
} else if (hasToml) {
...
Two sites came out better rather than wordier — the self-target condition was a negation of a negation:
-let selfTargets = if (entrypoint == false or selfRecorded) { ... }
+let selfTargets = if (legacyRuntime or selfRecorded) { ... }== false rather than ! to match the rest of the file, which spells it that way in seven other places.
If you meant the legacyRuntime setting itself rather than the derived field: it is still load-bearing, and not only for old engines — #14038 gates the entrypoint path on a manifestVersion the manifest builder has no field for, so an [entrypoint] manifest written here does not load anywhere yet, including on beta.15. That is why the whole check suite pins it. Happy to look at removing it once the builder can emit the marker.
Full suite green after the change: 68 checks, no failures, all three staleness checks included.
Review: the private `entrypoint` alias was one name for the inverse of another, and a reader had to hold both. Gone — the 16 branch sites test the setting, keeping their branch order so the comment above each one still describes the branch under it. Two sites read better for it: the self-target condition is `legacyRuntime or selfRecorded` rather than a negation of a negation. Signed-off-by: Tom Chauveau <[email protected]>
Turning `legacyRuntime` off moves a module onto an entrypoint, because
withEntrypointManifest rewrites the manifest on every run. Turning it back on
did nothing of the sort: generateScope left an existing manifest alone whenever
the scope already had one, so a module that declared `[entrypoint]` and no
`[runtime]` kept that manifest while the rest of the run generated for a
runtime. Both halves of the legacy path then failed on it, and neither error
named the setting:
- withClientDependencies asked the builder to hang a dependency off a runtime
the manifest does not declare, which it refuses: "module manifest legacy
runtime is required when legacy fields are set".
- moduleSourcePath asked the engine for a sourceSubpath an entrypoint manifest
has not got, read the empty answer as ".", and generation looked for the
module's src/ at the workspace root: "stat src: no such file or directory".
The setting asks for a `[runtime]` module, so write that manifest. generateScope
now routes an entrypoint manifest through withModuleManifest, whose no-config
branch already emits exactly what is wanted — a fresh legacy manifest with the
engine release this SDK ships for — and the scope's clients come back as
`[[dependencies]]` through withClientDependencies on the same run. Nothing from
the entrypoint manifest needs carrying over: it holds only the name and the
`[entrypoint]` table.
The rest of the legacy path already cleaned up after the other layout:
prunedInactiveDispatch takes __dagger.dispatch.ts and entrypoint/, and
prunedEmbeddedClientsDir takes clients/ with the packaged clients/dagger and
clients/<name>/ packages in it. What was missing was the link into them:
package.json kept its `file:./clients/<name>` dependencies on packages the flip
had just removed, so the runtime's install failed at call time. config-updater's
package-json pass now prunes those, by the same scope-local rule shared-deps
already prunes with, leaving a client installed from anywhere else alone.
This matters more since #73 made the entrypoint layout the default: a fresh
module declares `[entrypoint]`, while the `[runtime]` layout is the one every
released engine loads, so flipping back is what a user on a released engine
does.
Signed-off-by: Tom Chauveau <[email protected]>
…ntrypoint Since #73 made the entrypoint the default, generateScope hard-sets an entrypoint module's source directory to the scope, ignoring what the manifest's `source` says. A module whose files live elsewhere — the layout `dagger init` wrote inside an existing project, `"source": ".dagger"`, and the one migration carries into dagger-module.toml — then generates against a directory that is not there and dies on stat <scope>/src: no such file or directory naming neither the source it ignored nor the setting that keeps the module's own layout. Reported by Tom hitting it on a migrated playground module with `source = "hello-world"`; bisected to 8a7c580 (#73), and the unmigrated dagger.json form fails the same way. Hard-setting the source is deliberate: an entrypoint manifest has no `source` field to record anywhere else, so the module root is the only answer it can give. What was missing is saying so. entrypointSourcePath reads the config the scope arrived with and refuses when it points somewhere else, naming `legacyRuntime = true` as the way to keep the `[runtime]` layout. The read is off `seeded` rather than `configured` deliberately: withEntrypointManifest has already dropped `source`, which is also why a second generation of an already-flipped module resolves "." and passes. README also told people to set `legacy-runtime` in the scope's settings. The engine silently ignores an unknown settings key, so the kebab-case form reports success and changes nothing; the field is `legacyRuntime`. Signed-off-by: Tom Chauveau <[email protected]>
…ntrypoint (#85) Since #73 made the entrypoint the default, generateScope hard-sets an entrypoint module's source directory to the scope, ignoring what the manifest's `source` says. A module whose files live elsewhere — the layout `dagger init` wrote inside an existing project, `"source": ".dagger"`, and the one migration carries into dagger-module.toml — then generates against a directory that is not there and dies on stat <scope>/src: no such file or directory naming neither the source it ignored nor the setting that keeps the module's own layout. Reported by Tom hitting it on a migrated playground module with `source = "hello-world"`; bisected to 8a7c580 (#73), and the unmigrated dagger.json form fails the same way. Hard-setting the source is deliberate: an entrypoint manifest has no `source` field to record anywhere else, so the module root is the only answer it can give. What was missing is saying so. entrypointSourcePath reads the config the scope arrived with and refuses when it points somewhere else, naming `legacyRuntime = true` as the way to keep the `[runtime]` layout. The read is off `seeded` rather than `configured` deliberately: withEntrypointManifest has already dropped `source`, which is also why a second generation of an already-flipped module resolves "." and passes. README also told people to set `legacy-runtime` in the scope's settings. The engine silently ignores an unknown settings key, so the kebab-case form reports success and changes nothing; the field is `legacyRuntime`. Signed-off-by: Tom Chauveau <[email protected]>
`dagger generate` on default settings deleted a scope's `dagger.json` and replaced it with a manifest carrying none of what it declared. Exit 0, no output. A module declaring `[[dependencies]]` and calling them through `dag.<dep>()` was left broken: `dag.legacydep is not a function`. `generateScope` branches on the config a scope arrived with. The `[runtime]` path passes `hasJSON` to `withModuleManifest`, which loads the file and round-trips it; the entrypoint path — the default since #73 — passed `hasToml`, false for a dagger.json-only scope, so `withEntrypointManifest` built a fresh empty manifest and never read the file while sdk-helpers deleted it. The fix is not to migrate it better but to leave it alone. A pre-1.0 module is not this SDK's to generate: the engine's builtin TypeScript runtime loads it and does its codegen at call time, which is what the workspace config already says — "a legacy dagger.json module is regenerated by the engine's runtime at call time, not by an SDK scope". Turning one into a manifest is `dagger module migrate`, which carries the contents across and records dependencies as workspace clients. So the scope is skipped, in a branch beside the existing skip-marker one. `legacyRuntime = true` is unchanged. The manifest that path writes is a `[runtime]` one, which has a field for everything a dagger.json may declare, so migrating onto it loses nothing. No refusals, which an earlier revision of this had: `include` is obsolete since outside files are derived from imports, `toolchains` and `blueprint` are not worth a guard, a non-TypeScript `sdk` is unreachable now that the engine selects scopes rather than the SDK discovering them, and translating `[[dependencies]]` into clients belongs to the engine's migration planner, not to an SDK writing into a CLI-managed config block. `runtimes:legacy-module-runs-check` is the one that answers whether it still works: a committed pre-1.0 fixture whose @check calls the dependency its dagger.json declares. It generates the scope, asserts nothing was written, then runs it — so a generate that drops the edge fails there rather than hiding in a manifest diff. Reverting typescript-sdk.dang to main turns it red, naming the deleted dagger.json. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
`dagger generate` on default settings deleted a scope's `dagger.json` and replaced it with a manifest carrying none of what it declared. Exit 0, no output. A module declaring `[[dependencies]]` and calling them through `dag.<dep>()` was left broken: `dag.legacydep is not a function`. `generateScope` branches on the config a scope arrived with. The `[runtime]` path passes `hasJSON` to `withModuleManifest`, which loads the file and round-trips it; the entrypoint path — the default since #73 — passed `hasToml`, false for a dagger.json-only scope, so `withEntrypointManifest` built a fresh empty manifest and never read the file while sdk-helpers deleted it. The fix is not to migrate it better but to leave it alone. A pre-1.0 module is not this SDK's to generate: the engine's builtin TypeScript runtime loads it and does its codegen at call time, which is what the workspace config already says — "a legacy dagger.json module is regenerated by the engine's runtime at call time, not by an SDK scope". Turning one into a manifest is `dagger module migrate`, which carries the contents across and records dependencies as workspace clients. So the scope is skipped, in a branch beside the existing skip-marker one. `legacyRuntime = true` is unchanged. The manifest that path writes is a `[runtime]` one, which has a field for everything a dagger.json may declare, so migrating onto it loses nothing. No refusals, which an earlier revision of this had: `include` is obsolete since outside files are derived from imports, `toolchains` and `blueprint` are not worth a guard, a non-TypeScript `sdk` is unreachable now that the engine selects scopes rather than the SDK discovering them, and translating `[[dependencies]]` into clients belongs to the engine's migration planner, not to an SDK writing into a CLI-managed config block. `runtimes:legacy-module-runs-check` is the one that answers whether it still works: a committed pre-1.0 fixture whose @check calls the dependency its dagger.json declares. It generates the scope, asserts nothing was written, then runs it — so a generate that drops the edge fails there rather than hiding in a manifest diff. Reverting typescript-sdk.dang to main turns it red, naming the deleted dagger.json. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
`dagger generate` on default settings deleted a scope's `dagger.json` and replaced it with a manifest carrying none of what it declared. Exit 0, no output. A module declaring `[[dependencies]]` and calling them through `dag.<dep>()` was left broken: `dag.legacydep is not a function`. `generateScope` branches on the config a scope arrived with. The `[runtime]` path passes `hasJSON` to `withModuleManifest`, which loads the file and round-trips it; the entrypoint path — the default since #73 — passed `hasToml`, false for a dagger.json-only scope, so `withEntrypointManifest` built a fresh empty manifest and never read the file while sdk-helpers deleted it. The fix is not to migrate it better but to leave it alone. A pre-1.0 module is not this SDK's to generate: the engine's builtin TypeScript runtime loads it and does its codegen at call time, which is what the workspace config already says — "a legacy dagger.json module is regenerated by the engine's runtime at call time, not by an SDK scope". Turning one into a manifest is `dagger module migrate`, which carries the contents across and records dependencies as workspace clients. So the scope is skipped, in a branch beside the existing skip-marker one. `legacyRuntime = true` is unchanged. The manifest that path writes is a `[runtime]` one, which has a field for everything a dagger.json may declare, so migrating onto it loses nothing. No refusals, which an earlier revision of this had: `include` is obsolete since outside files are derived from imports, `toolchains` and `blueprint` are not worth a guard, a non-TypeScript `sdk` is unreachable now that the engine selects scopes rather than the SDK discovering them, and translating `[[dependencies]]` into clients belongs to the engine's migration planner, not to an SDK writing into a CLI-managed config block. `runtimes:legacy-module-runs-check` is the one that answers whether it still works: a committed pre-1.0 fixture whose @check calls the dependency its dagger.json declares. It generates the scope, asserts nothing was written, then runs it — so a generate that drops the edge fails there rather than hiding in a manifest diff. Reverting typescript-sdk.dang to main turns it red, naming the deleted dagger.json. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
`dagger generate` on default settings deleted a scope's `dagger.json` and replaced it with a manifest carrying none of what it declared. Exit 0, no output. A module declaring `[[dependencies]]` and calling them through `dag.<dep>()` was left broken: `dag.legacydep is not a function`. `generateScope` branches on the config a scope arrived with. The `[runtime]` path passes `hasJSON` to `withModuleManifest`, which loads the file and round-trips it; the entrypoint path — the default since #73 — passed `hasToml`, false for a dagger.json-only scope, so `withEntrypointManifest` built a fresh empty manifest and never read the file while sdk-helpers deleted it. The fix is not to migrate it better but to leave it alone. A pre-1.0 module is not this SDK's to generate: the engine's builtin TypeScript runtime loads it and does its codegen at call time, which is what the workspace config already says — "a legacy dagger.json module is regenerated by the engine's runtime at call time, not by an SDK scope". Turning one into a manifest is `dagger module migrate`, which carries the contents across and records dependencies as workspace clients. So the scope is skipped, in a branch beside the existing skip-marker one. `legacyRuntime = true` is unchanged. The manifest that path writes is a `[runtime]` one, which has a field for everything a dagger.json may declare, so migrating onto it loses nothing. No refusals, which an earlier revision of this had: `include` is obsolete since outside files are derived from imports, `toolchains` and `blueprint` are not worth a guard, a non-TypeScript `sdk` is unreachable now that the engine selects scopes rather than the SDK discovering them, and translating `[[dependencies]]` into clients belongs to the engine's migration planner, not to an SDK writing into a CLI-managed config block. `runtimes:legacy-module-runs-check` is the one that answers whether it still works: a committed pre-1.0 fixture whose @check calls the dependency its dagger.json declares. It generates the scope, asserts nothing was written, then runs it — so a generate that drops the edge fails there rather than hiding in a manifest diff. Reverting typescript-sdk.dang to main turns it red, naming the deleted dagger.json. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
Four changes, one commit each.
1. Drop
experimentalPrivilegedNestingfrom the Dang entrypointThe generated
entrypoint/main.dangpassed it on the exec that runs the TypeScript dispatcher, so the dispatcher could open its own session back to the engine. Container nesting has been on by default since dagger/dagger#14082, so the argument is redundant on every engine that can load an entrypoint at all.2.
entrypoint→legacyRuntime, invertedA module now declares an
[entrypoint]withentrypoint/main.dangand the__dagger.dispatch.tsit shells out to. The[runtime]layout —sdk/as the package, a committed__dagger.entrypoint.ts— is what you opt into, for an engine too old to load the other one.The 16 branch sites keep reading in terms of the path they pick, through one private derived field rather than an inverted condition each:
The check suite stays on the path it was written against
Almost every check asserts the legacy layout by path, so they pin it rather than silently moving:
Gen.scopedefaults tolegacyRuntime: true, with a docstring saying why it is the one setting that does not follow the SDK's own default.typescriptSdk(...)constructions inmanifest.dangand the threeruntimesexecution checks pass it explicitly.legacyRuntime: false.engine-e2eCLI checks pass--legacy-runtime:dev-sdk-checkassertssdk/client.gen.ts+__dagger.entrypoint.tsand then calls the module, which an[entrypoint]manifest cannot do until the builder emits amanifestVersion(Load modules through manifest v2 entrypoints dagger#14038). It also covers the new flag, which is the only place the CLI's flattening of that setting is exercised.Net effect: the default path's coverage is unchanged from before the flip — generation shape only, nothing loads it.
The repo's own fixtures are untouched: both fixture trees carry
.typescript-ignore-generate, sodagger generatewrites nothing into them either way.3. Target engine
v1.0.0-beta.15targetEngineVersionwas1.0.0-beta.11, which predates both #14038 (entrypoint loading) and #14082. The default a module now gets would have been unloadable on the release its own bundle claimed to be paired with, so the pairing moves to beta.15, and the nine managed fixture manifests move with it — which is whatfixture-engine-version-checkholds.The pairing moves without the vendored library sources, and
library/VENDOR.mdnow records why rather than letting its "the vendored sources, the bindings generated from them, the committedbundle/, and the Go generator all move together or not at all" rule go quietly stale:library/src/core/client.gen.tsis regenerated here, not vendored, andpackager:library-bindings/staleis green inside a beta.15 engine — the bindings half of the pairing is already beta.15's.runtimes:{node,bun,deno}-runs-checkload and run modules built from the committedbundle/in that same engine.Upstream
sdk/typescriptchanged 24 files between the two tags (introspector, decorators, registry,compute_query,provisioning/default.ts'sCLI_VERSION), several of which carry local work here that a re-vendor has to merge against rather than overwrite. That is vendoring lag, and taking it is its own change — it is what moves the tag.Two things left deliberately at beta.11:
engineVersion(rootdagger-module.toml/dagger.json) and the README's stated floor. Those say what engine can run this SDK, which is a different fact from what the bundle is paired with; nothing here uses a newer core API, and raising it would lock out exactly the engines--legacy-runtimeexists to serve.4. Lock
sdk-helpersat v1.0.6The dependency is the range
dagger.io/sdk/helpers@v1, so onlydagger.lockand the playground'sworkspace.lockheld v1.0.5. No call-site change: v1.0.6 makes the genericwithLegacyRuntime(runtime, moduleSource, engineVersion)public, andwithLegacyTypescriptRuntime— the setter this SDK calls — was already a one-line wrapper around it and is byte-identical in the release. What v1.0.6 newly enables is naming a runtime that isn't built in (a./pathor a module ref), which is what python-sdk needs and TypeScript does not.dagger lock updatealso re-resolved four unrelated base-image digests (alpine, busybox, golang 1.26, verdaccio). Those are put back — moving the images everything builds on is its own change, not a dependency bump.The playground's
workspace.lockis written byengine-e2e's generator, so the edit there is only correct if the generator agrees;engine-e-2-e:generate/staleis what says it does.Worth a look before merging
--legacy-runtimeis currently the only loadable option on any engine, not just older ones: #14038 gates the entrypoint path on amanifestVersionthe sdk-helpers builder has no field for, so an[entrypoint]manifest written here reads as a runtime-less module. The default is what the generated tree should be; the flag is what runs today. The README now says so, and it is the reason the whole check suite pins the legacy path.Verification
go test ./...inhelpers/codegen— green.--x-release=1.0.0-beta.15.dagger check -m .dagger/modules/e2e generate init manifest client— 43/43 green, including the three entrypoint-path checks.dagger check --generated) — green, re-run after each of the last two commits. Final run: 63 checks, no failures, covering every nestede-2-e:*group pluspackager:*, the threeruntimes:*execution checks,engine-e-2-e:dev-sdk-check,dev-sdk-settings-check, and all three staleness checks (packager:library-bindings/stale,packager:library-bundle/stale,engine-e-2-e:generate/stale).dev-sdk-settings-checkpassing is also what confirms the flag spelling: an unrecognized--legacy-runtimewould have failed that exec.