Skip to content

generate-all: parallelize, fix losing changes - #13

Merged
vito merged 2 commits into
mainfrom
fix-generate
Jul 24, 2026
Merged

vito merged 2 commits into
mainfrom
fix-generate

Conversation

@vito

@vito vito commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This changes generateAll to generate all modules in parallel, and also fixes no changes to apply when there clearly were changes. I'm not entirely sure why the latter is fixed by this - still investigating.

For posterity, here's the original repro for "the latter":

diff --git a/toolchains/engine-dev/dagger.gen.go b/toolchains/engine-dev/dagger.gen.go
index 0c9fe5f82c..5bb0bc7731 100644
--- a/toolchains/engine-dev/dagger.gen.go
+++ b/toolchains/engine-dev/dagger.gen.go
@@ -802,7 +802,7 @@ func invoke(ctx context.Context, parentJSON []byte, parentName string, fnName st
                                        panic(fmt.Errorf("%s: %w", "failed to unmarshal input arg clientDockerConfig", err))
                                }
                        }
-                       return New(source, subnetNumber, clientDockerConfig), nil
+                       return New(nil, subnetNumber, clientDockerConfig), nil
                default:
                        return nil, fmt.Errorf("unknown function %s", fnName)
                }
  • in repo root, dagger --x-release 1.0.0-beta.7 generate dagger-go-sdk:generate-all => no changes to apply
  • used touch to make dagger.gen.go older => no effect, still no changes to apply
  • cd toolchains/engine-dev and run same generate command => that works

vito added 2 commits July 23, 2026 11:45
"""
The helper should expose the generate skip marker used by callers.
"""
pub skipGenerateFilenameCheck: Void @check {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all the functions are not public anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not needed anymore by Dang, the formatter removes them. pub is default so it looks more like graphql

@vito
vito merged commit ca29eb9 into main Jul 24, 2026
14 of 17 checks passed
TomChv added a commit that referenced this pull request Jul 27, 2026
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: Vasek - Tom C <[email protected]>
TomChv added a commit 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants