Repository navigation
fix: refuse to move a module whose source is a subdirectory onto an entrypoint - #85
Merged
Merged
Conversation
…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]>
TomChv
force-pushed
the
fix/entrypoint-source-subpath
branch
from
October 12, 2026 10:03
b28b9ba to
4f3abb5
Compare
TomChv
added a commit
that referenced
this pull request
Oct 13, 2026
generateScope passed `hasToml` to withEntrypointManifest where the `[runtime]` path passes `hasJSON`, so a scope arriving with only a pre-1.0 dagger.json built a fresh, empty entrypoint manifest and never read the file — while `generate(legacyJson: false)` deleted it. Its `[[dependencies]]`, `include`, `toolchains`, `blueprint` and even a foreign `"sdk"` went with it: exit 0, no message. An entrypoint manifest has no table for any of them, so there is nothing to carry them into. Refuse instead, the way #85 already does for a `source` subpath: read the config the scope arrived with, and name `legacyRuntime = true` as the layout that can hold them. A dagger.json declaring none of them still migrates onto the entrypoint. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Oct 13, 2026
generateScope passed `hasToml` to withEntrypointManifest where the `[runtime]` path passes `hasJSON`, so a scope arriving with only a pre-1.0 dagger.json built a fresh, empty entrypoint manifest and never read the file — while `generate(legacyJson: false)` deleted it. Its `[[dependencies]]`, `include`, `toolchains`, `blueprint` and even a foreign `"sdk"` went with it: exit 0, no message. An entrypoint manifest has no table for any of them, so there is nothing to carry them into. Refuse instead, the way #85 already does for a `source` subpath: read the config the scope arrived with, and name `legacyRuntime = true` as the layout that can hold them. A dagger.json declaring none of them still migrates onto the entrypoint. Fixes #88 Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Oct 14, 2026
generateScope passed `hasToml` to withEntrypointManifest where the `[runtime]` path passes `hasJSON`, so a scope arriving with only a pre-1.0 dagger.json built a fresh, empty entrypoint manifest and never read the file — while `generate(legacyJson: false)` deleted it. Its `[[dependencies]]`, `include`, `toolchains`, `blueprint` and even a foreign `"sdk"` went with it: exit 0, no message. An entrypoint manifest has no table for any of them, so there is nothing to carry them into. Refuse instead, the way #85 already does for a `source` subpath: read the config the scope arrived with, and name `legacyRuntime = true` as the layout that can hold them. A dagger.json declaring none of them still migrates onto the entrypoint. Fixes #88 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.
Follow-up to #73, found while Tom tested #78 on a real migrated module.
Problem
dagger generatedies on a module whose manifest aimssourcesomewhere other than the scope:Since #73 made the entrypoint the default,
typescript-sdk.dang:257hard-set the source directory to the scope:so a module with
source = "hello-world"has generation look for<scope>/src, which is not there.Bisected:
v1.0.1and94a66a4(#73's parent) pass;8a7c580onward fail with a byte-identical message.git log -Lblames the line to #73. The unmigrateddagger.jsonform fails the same way, so the blast radius is any pre-1.0 module whose config aimssourceat a subdirectory — the layoutdagger initwrote inside an existing project ("source": ".dagger"). Migration preservessource, so the firstgenerateafter migrating is where people land.Fix
Hard-setting the source is deliberate — an entrypoint manifest has no
sourcefield to record anywhere else, so the module root is the only answer it can give. What was missing is saying so instead of inventing a path:entrypointSourcePathreads the config the scope arrived with (seeded, notconfigured) —withEntrypointManifesthas already droppedsourceby then, which is also why a second generation of an already-flipped module resolves"."and passes.This refuses; it does not support. Supporting a subdirectory
sourceunder an entrypoint needs somewhere to persist it across generations, and the manifest'ssourceis gone by design (withoutLegacyFields). The one viable carrier is the[entrypoint] sourceitself — writing"./hello-world/entrypoint"and reading the module path back off it;--module-pathis already workspace-root-relative (entrypoint_dang.go), so the generated recipe could address a subdirectory today. That is a design change, not a bug fix, so it is deliberately not here.Also: the README named a setting that does nothing
README.md:115said to setlegacy-runtimein the scope's settings. The engine silently ignores an unknown settings key — no error, no warning — so the kebab-case form reports success and leaves the module on the entrypoint path. The field islegacyRuntime, as the settings table five lines earlier says. That silent drop is engine-side and worth its own report: every scope-settings typo is invisible.Verification
generate:generate-refuses-entrypoint-source-subpath-check— new, and it goes red without the fix (generating an entrypoint for a module whose source is elsewhere should be refused), green with it. It reuses the existingparent-sourcefixture, whose manifest already carriessource = "../../../ci", so no new fixture.generate:generate-split-source-runtime-checkandmanifest:split-source-client-check— the two existing checks over that fixture — still green, so the[runtime]path is unaffected.v1.0.0-beta.16.stat .../src; withlegacyRuntime = trueit generates, and a second run reports no changes.