Repository navigation
fix: scope module generation to the module path - #5
Merged
Merged
Conversation
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 23, 2026
Temporary: point the polyfill dependency at fix/module-generate-scope-to-path (dagger/polyfill#5) so multi-module / workspace-root generate works. Revert to @main once that PR merges. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 23, 2026
Temporary: point the polyfill dependency at fix/module-generate-scope-to-path (dagger/polyfill#5) so multi-module / workspace-root generate works. Revert to @main once that PR merges. Signed-off-by: Vasek - Tom C <[email protected]>
This was referenced Jul 23, 2026
PolyfillModuleSource.generate rooted the generated context and fork at the
caller cwd. At the workspace root (cwd '.') that captured the whole
workspace — including any staged dependency codegen — in the changeset's
before/after snapshots. When several modules are generated and their
changesets merged (e.g. a root 'dagger generate'), the staged dependencies
leak across modules: they cancel out (a dependency's codegen goes missing)
or conflict on apply ('already exists').
Root the generated context at the module's own path and stage it on an
empty fork base, so each module's changeset contains only its own files.
Unchanged for a subdir cwd, where path already equals the cwd.
Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
force-pushed
the
fix/module-generate-scope-to-path
branch
from
July 23, 2026 14:21
c2a9322 to
4357bc1
Compare
kpenfound
approved these changes
Jul 23, 2026
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 24, 2026
dagger/polyfill#5 merged; point the polyfill dependency back at @main. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 24, 2026
dagger/polyfill#5 merged; refresh the polyfill @main pin to include it. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 24, 2026
dagger/polyfill#5 merged; point the polyfill dependency at @main. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 27, 2026
Temporary: point the polyfill dependency at fix/module-generate-scope-to-path (dagger/polyfill#5) so multi-module / workspace-root generate works. Revert to @main once that PR merges. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 27, 2026
dagger/polyfill#5 merged; point the polyfill dependency at @main. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 27, 2026
Temporary: point the polyfill dependency at fix/module-generate-scope-to-path (dagger/polyfill#5) so multi-module / workspace-root generate works. Revert to @main once that PR merges. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 27, 2026
dagger/polyfill#5 merged; point the polyfill dependency back at @main. Signed-off-by: Vasek - Tom C <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 27, 2026
dagger/polyfill#5 (scope module generate to path) is merged, so pick it up from @main. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 27, 2026
Before generating each managed module, stage its transitive local dependency closure via ModuleSource.generateLocalDependencies and overlay it onto the workspace, so the module's codegen sees up-to-date dependency bindings — including dependencies owned by other SDKs. The staged dependency codegen is ephemeral: it appears in both the fork's before and after, so it cancels in the merge, leaving only each module's own changes. Bumps the polyfill pin to pick up dagger/polyfill#5, which scopes module generation to the module path. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 27, 2026
Before generating each managed module, stage its transitive local dependency closure via ModuleSource.generateLocalDependencies and overlay it onto the workspace, so the module's codegen sees up-to-date dependency bindings — including dependencies owned by other SDKs. The staged dependency codegen is ephemeral: each changeset is taken against the staged workspace, so it cancels out, leaving only each module's own changes. Bumps the polyfill pin to pick up dagger/polyfill#5 (scope module generate to path) from @main. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
to dagger/go-sdk
that referenced
this pull request
Jul 28, 2026
Before generating each managed module, stage its transitive local dependency closure via ModuleSource.generateLocalDependencies and overlay it onto the workspace, so the module's codegen sees up-to-date dependency bindings — including dependencies owned by other SDKs. The staged dependency codegen is ephemeral: each changeset is taken against the staged workspace, so it cancels out, leaving only each module's own changes. Bumps the polyfill pin to pick up dagger/polyfill#5 (scope module generate to path) from @main. When @generate runs nested under the engine's ModuleSource.generateLocalDependencies (the SDK generator invoked per local dependency), the workspace it receives already has the leaf dependency closure staged. #13 assembles the result as ws.changes.withChangesets(changes); in that nested context ws.changes re-included the staged closure, which then (a) got re-rooted under the dependent's path by the engine (b/.dagger/modules/a/...) and (b) octopus-merged against the freshly generated, overlapping files (apply ours patch: ... already exists) — for Go modules with a local-dependency closure of 3+. Fold onto pws.fork.changes (an empty changeset) instead, keeping #13's parallel map + {{isEmpty}} force. Only each module's own changes remain, so nothing re-enters the result. Matches the TypeScript SDK, which never reproduced this. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Jul 28, 2026
Before generating each managed module, stage its transitive local dependency closure via ModuleSource.generateLocalDependencies and overlay it onto the workspace, so the module's codegen sees up-to-date dependency bindings — including dependencies owned by other SDKs. The staged dependency codegen is ephemeral: it appears in both the fork's before and after, so it cancels in the merge, leaving only each module's own changes. Bumps the polyfill pin to pick up dagger/polyfill#5, which scopes module generation to the module path. Signed-off-by: Tom Chauveau <[email protected]>
vito
added a commit
that referenced
this pull request
Jul 28, 2026
The generate docstring still described paths as workspace-root-relative, which stopped being true when the changeset was re-rooted onto the caller cwd. It also never said why the module-path scoping from #5 is gone: the engine diffs the generated context against the same base it generated from, so the changeset only ever carries this module's own generated files — staged dependency codegen appears on both sides and cancels out before it can leak. State both, since the old fork pipeline's leak is exactly what a reader of #5 will worry about here. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Jul 28, 2026
The generate checks covered a single module with no dependencies, so they said nothing about the multi-module merge that #5 was about, and their membership-only assertions would pass over leaked extra paths. Add a fixture with two sibling modules sharing a local dependency, generate all three, and assert each changeset stays inside its own subtree and that the octopus merge is the exact union of the parts — the two ways dependency leakage would show up (conflict, or cancellation dropping paths from the union). Also address the subdir check's module the way a caller standing in it does — a cwd-relative ref, exercising moduleSourcePath's cwd-joining branch — and assert no path carries the workspace-root prefix, the signature of the doubled-path bug. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Jul 29, 2026
The generate docstring still described paths as workspace-root-relative, which stopped being true when the changeset was re-rooted onto the caller cwd. It also never said why the module-path scoping from #5 is gone: the engine diffs the generated context against the same base it generated from, so the changeset only ever carries this module's own generated files — staged dependency codegen appears on both sides and cancels out before it can leak. State both, since the old fork pipeline's leak is exactly what a reader of #5 will worry about here. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Jul 29, 2026
The generate checks covered a single module with no dependencies, so they said nothing about the multi-module merge that #5 was about, and their membership-only assertions would pass over leaked extra paths. Add a fixture with two sibling modules sharing a local dependency, generate all three, and assert each changeset stays inside its own subtree and that the octopus merge is the exact union of the parts — the two ways dependency leakage would show up (conflict, or cancellation dropping paths from the union). Also address the subdir check's module the way a caller standing in it does — a cwd-relative ref, exercising moduleSourcePath's cwd-joining branch — and assert no path carries the workspace-root prefix, the signature of the doubled-path bug. Signed-off-by: Alex Suraci <[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.
PolyfillModuleSource.generaterooted the generated context and the fork at the caller cwd. In a module subdirectory that's fine (the cwd is the module). But at the workspace root (cwd = ".") it captured the whole workspace — including any staged dependency codegen — in the changeset'sbefore/aftersnapshots.When several modules are generated and their changesets merged (e.g. a root
dagger generaterunning the Go and TypeScript SDK generators), the staged dependency codegen leaks across modules:beforesnapshot and cancels out (goes missing from the output), orbefores and then conflicts on apply (.dagger/modules/b/... already exists).Fix
Root the generated context at the module's own path and stage it on an empty fork base, so each module's changeset contains only its own files. Behavior is unchanged for a subdir cwd (there
path == cwd).This unblocks
ModuleSource.generateLocalDependencies(dagger/dagger#13706) for the multi-module / workspace-root case.PR chain
ModuleSource.generateLocalDependencies(+ the runtime fixes found in validation)@generateuses the API@generateuses the APIThe two SDK PRs depend on both the engine PR and the polyfill PR. The engine and polyfill PRs are independent of each other.