Repository navigation
feat: generate one module loading path, and write the entrypoint manifest through sdk-helpers - #55
Merged
Merged
Conversation
A module is loaded through its [runtime] or through its [entrypoint], and until now it got the files for both: __dagger.dispatch.ts and entrypoint/main.dang were written regardless of the setting, so `dagger module init typescript` produced a manifest-v2 entrypoint beside the dispatcher its runtime actually execs. Two files nothing read, under names one word apart from the one that matters. moduleDirectory now branches on the setting. Not naming a file also skips rendering it, so a [runtime] module no longer pays for the dang-entrypoint codegen exec at all. Writing is only half of it: what the other setting left on disk stays there. prunedLegacyEntrypoint becomes prunedInactiveDispatch and prunes in both directions — the legacy dispatcher under an entrypoint, the dispatcher and entrypoint/ otherwise. That is the upgrade path for every module an earlier build wrote both halves into. Signed-off-by: Tom Chauveau <[email protected]>
withEntrypointManifest was the only place in the repo that emitted a dagger-module.toml by hand, and the only source of `manifestVersion = 2`. It justified itself by pointing at dagger/dagger#14038's version gate: the builder never writes that field, so a builder-written manifest would not load there. That is the wrong way round. The builder's schema is the contract and making the engine read it is the engine's job — work that is under way. Targeting the version gate instead meant one generator path diverging from the schema every other path validates against, with TOML escaping done by hand. So: load the existing manifest when there is one, drop the legacy fields, add the Dang entrypoint, and generate. An entrypoint module's tree has no __dagger.entrypoint.ts, so `[runtime]` does not stay beside `[entrypoint]` — leaving it would only point an older engine at a file that is not there. Entrypoint modules therefore load nowhere until the gate comes out. That is accepted; design/module-entrypoint.md §7.1 records the decision and §7.1.1 says what not to do about it. The setting is off by default, so nothing a user generates changes. Signed-off-by: Tom Chauveau <[email protected]>
Member
Author
|
Tested manually with multiple cases:
All these tests are using dagger/dagger#14038 engine |
TomChv
added a commit
that referenced
this pull request
Sep 16, 2026
Brings in #55, which split module generation onto one loading path at a time and moved the entrypoint manifest onto the sdk-helpers builder. The conflict is moduleDirectory, which both sides restructured. Resolution keeps #55's shape — one branch per loading path, never both — and puts this branch's clients/ in the part common to them: the per-module bindings are what the module's own source imports, which is independent of how the module is loaded. The dispatcher keeps this branch's signature without targets, since serve moved onto each client here and the dispatcher no longer stages client meta. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Sep 16, 2026
#55 made a module get one loading path's files and not the other's, so a `[runtime]` module no longer carries a __dagger.dispatch.ts. generateSelfCallCheck still read one — it was written when both halves were generated — and failed on a missing file rather than on anything it was checking. The claim is worth keeping: serving moved onto the clients, so no dispatch file stages modules of its own. But it can only be asserted where a dispatcher exists, which is the entrypoint path. Gen.scope gains the `entrypoint` setting, and the assertion moves to a check of its own covering both paths — the entrypoint's dispatcher, which this branch took the serving out of, and the legacy entrypoint, which never had any. generateSelfCallCheck keeps what it is named for. Also drops the superseded dispatcher-serves-self bullet from the design note; the per-client serve below it replaced that mechanism. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Sep 16, 2026
#55 made a module get one loading path's files and not the other's, so a `[runtime]` module no longer carries a __dagger.dispatch.ts. generateSelfCallCheck still read one — it was written when both halves were generated — and failed on a missing file rather than on anything it was checking. The claim is worth keeping: serving moved onto the clients, so no dispatch file stages modules of its own. But it can only be asserted where a dispatcher exists, which is the entrypoint path. Gen.scope gains the `entrypoint` setting, and the assertion moves to a check of its own covering both paths — the entrypoint's dispatcher, which this branch took the serving out of, and the legacy entrypoint, which never had any. generateSelfCallCheck keeps what it is named for. Also drops the superseded dispatcher-serves-self bullet from the design note; the per-client serve below it replaced that mechanism. 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.
A module is loaded through its
[runtime]or through its[entrypoint]. Untilnow it got the files for both, and the manifest for neither —
dagger module init typescript test(no--entrypoint) wrote a correct[runtime]manifestand then
entrypoint/main.dangand__dagger.dispatch.tsbeside it, two filesnothing reads, under names one word apart from the one that matters.
Two commits, independent enough to review separately.
1. Generate one loading path's files, not both
moduleDirectorybranches on theentrypointsetting:sdk/,__dagger.entrypoint.tssdk/,__dagger.dispatch.ts,entrypoint/main.dangNot naming a file also skips rendering it, so a
[runtime]module no longerpays for the dang-entrypoint codegen exec at all.
Writing is only half of it — what the other setting left on disk stays there.
prunedLegacyEntrypointbecomesprunedInactiveDispatchand prunes both ways:the legacy dispatcher under an entrypoint, the dispatcher and
entrypoint/otherwise. That is the upgrade path for every module an earlier build wrote
both halves into.
2. Write the entrypoint manifest through the sdk-helpers builder
withEntrypointManifestwas the only place in the repo emitting adagger-module.tomlby hand, and the only source ofmanifestVersion = 2. Itjustified itself by pointing at dagger/dagger#14038's version gate: the builder
never writes that field, so a builder-written manifest would not load there.
That is the wrong way round. The builder's schema is the contract, and making
the engine read it is the engine's job — work that is under way. Targeting the
version gate instead meant one generator path diverging from the schema every
other path validates against, with TOML escaping by hand.
So: load the existing manifest when there is one, drop the legacy fields, add
the Dang entrypoint, generate. An entrypoint module's tree has no
__dagger.entrypoint.ts, so[runtime]does not stay beside[entrypoint]—leaving it would only point an older engine at a file that is not there.
Entrypoint modules therefore load nowhere until that gate comes out. That is
accepted, not a bug to route around: #14038 gates on
meta.ManifestVersion != 0and its legacy path ignores
[entrypoint]entirely. Re-addingmanifestVersion,prepending it to the builder's output, or falling back to a
[runtime]wouldall put the generator back in the business of writing a shape the builder does
not model.
design/module-entrypoint.md§7.1 records the decision (additivewon) and §7.1.1 says what not to do about it.
The setting is off by default, so nothing a user generates today changes.
Testing
dagger checkagainstv1.0.0-beta.13:manifest:entrypoint-manifest-check— a fresh entrypoint scopeasserts
[entrypoint]and nomanifestVersion; a[runtime]→ entrypointflip asserts the legacy fields go with it.
generate:generate-prunes-entrypoint-check— plants both entrypointfiles in a
[runtime]fixture, asserts regeneration removes them.init:init-checkgainsnotAddedfor both files;engine-e-2-e:dev-sdk-checkgains
test ! -efor both after a realdagger module init typescript.manifest:pins-check,generate:{generate-workspace-module,generate-idempotent}-check.Also driven end to end against a real workspace with the SDK vendored from this
checkout: init with and without
--entrypointproduces the two manifests aboveand the matching trees, and regenerating a
[runtime]module that had theentrypoint files on disk removes them while leaving the entrypoint module alone.
Relationship to #54
Branched off
mainrather than onto the unified-clients stack, because none ofthis has anything to do with unified clients. #54 is untouched.
They are siblings and both rewrite
moduleDirectory(pluse2e/generate.dangand
e2e/manifest.dang), so whichever lands second needs a rebase. Land #54first — rebasing these two commits over it is cheap, the reverse is not. The
resolution for the stack's shared-client layout is already written down locally
and will come with that rebase; the only extra piece there is
Mod.isEntrypointManifest, which does not exist onmainand matches an[entrypoint]table instead of the version field.