Repository navigation
generate: stage local dependency closure before codegen - #12
Conversation
717dd26 to
fef8c1e
Compare
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]>
fef8c1e to
ec033e3
Compare
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]>
6199fae to
14fdae2
Compare
Fix for the
|
| Chain | Result |
|---|---|
a←b←c←d (Go, Go→TS, TS — closure 3) |
✅ 0 errors, 0 nested leaks; c/sdk/b.gen.ts, d/sdk/c.gen.ts, b/internal/dagger/a.gen.go all present |
a←b←e←f (pure Go — closure 3) |
✅ 0 errors, 0 nested leaks; leaf-first bindings correct |
Real apply lands every file at the correct path with 0 nested-leak dirs; a second generate reports no changes to apply (idempotent — #13's fix intact).
Uses the new
ModuleSource.generateLocalDependenciesengine API. Before generating each managed module,generateAll(the@generatefunction) andMod.generatestage the module's transitive local dependency closure onto the workspace viawithChanges, then generate against the staged workspace — so the module's codegen sees up-to-date dependency bindings, including dependencies owned by other SDKs.Depends on
generateLocalDependenciesengine field + regenerated bindings.dagger.jsonis back onpolyfill@main.PR chain
ModuleSource.generateLocalDependencies(+ the runtime fixes found in validation)@generateuses the API@generateuses the APIBoth SDK PRs depend on the engine PR (#13715). The polyfill scoping fix is merged.