Skip to content

generate: merge module changesets directly - #16

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

vito merged 4 commits into
mainfrom
fix-generate-2

Conversation

@vito

@vito vito commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What this is now

Earlier revisions of this PR carried a workaround: rebasing every module changeset onto the shared unstaged workspace before merging, because the engine's Changeset.withChangesets applied git patches over a union of the inputs' before directories and assumed they share a common base. With per-module dependency staging, sibling changesets disagree on their befores, and the patch merge either duplicated repetitive generated code (two identical AsVolume blocks in dagger.gen.go) or failed hunks outright.

The engine now builds merge branches from changeset content rather than patches (dagger/dagger#13773), which removes the common-base requirement entirely. The workaround is gone, and this PR shrinks to a single commit that simplifies generate on top of the reworked polyfill:

  • Bump polyfill to eliminate the workspace-module-generate helper polyfill#6, where PolyfillModuleSource.generate returns a Changeset! directly — the .generate.changes re-diffing disappears.
  • GoSdk.generate merges module changesets directly: changeset.withChangesets(modules ... .map { ... .generate }). The fold onto pws.fork.changes (with its nested-generate caveats) and the {{isEmpty}} evaluation-forcing hack are gone — the engine's withChangesets now computes paths in parallel and drops empty changesets itself.
  • Per-module dependency staging stays: each module's codegen still runs against its staged local dependency closure (generateLocalDependencies), and its changeset still carries only the module's own files. The staged befores still diverge across siblings — that's now fine, because content already present in the merge base is a no-op instead of a double-apply.
  • mod.dang: drops stray pub markers on module-internal helpers, formatting.

Blocked on

Verification

On dagger/dagger with an engine including dagger/dagger#13773: full-repo dagger generate dagger-go-sdk using this branch's Dang code applies cleanly, produces exactly one copy of the new API bindings (previously duplicated), is byte-identical to the output the workaround-based revision produced, compiles across all toolchains, and rerunning on a regenerated tree is a no-op.

🤖 Generated with Claude Code

@vito
vito force-pushed the fix-generate-2 branch from d6820e3 to ab2a5a0 Compare July 29, 2026 19:42
@vito vito changed the title generate: rebase module changesets onto a common base generate: merge module changesets directly Jul 29, 2026
Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the fix-generate-2 branch from ab2a5a0 to 71890b4 Compare July 30, 2026 14:34
vito added 2 commits July 30, 2026 11:21
used for LSP setup, too much variance

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the fix-generate-2 branch from d248851 to 66fe207 Compare July 30, 2026 16:37
otherwise it generates the fixture, which makes e2e fail

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito merged commit 5949949 into main Jul 30, 2026
17 checks passed
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