Skip to content

generate: stage local dependency closure before codegen - #12

Merged
TomChv merged 1 commit into
mainfrom
feat/aggregate-local-dep-in-worskpace-when-generating
Jul 28, 2026
Merged

TomChv merged 1 commit into
mainfrom
feat/aggregate-local-dep-in-worskpace-when-generating

Conversation

@TomChv

@TomChv TomChv commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Uses the new ModuleSource.generateLocalDependencies engine API. Before generating each managed module, generateAll (the @generate function) and Mod.generate stage the module's transitive local dependency closure onto the workspace via withChanges, 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

PR chain

Both SDK PRs depend on the engine PR (#13715). The polyfill scoping fix is merged.

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
TomChv force-pushed the feat/aggregate-local-dep-in-worskpace-when-generating branch from cabeb6c to de07a8b Compare July 27, 2026 14:53
@TomChv
TomChv marked this pull request as ready for review July 28, 2026 10:10
@TomChv
TomChv merged commit 2da7077 into main Jul 28, 2026
16 checks passed
TomChv added a commit that referenced this pull request Aug 7, 2026
Ports dagger/java-sdk#13: the repository's dagger.toml registered this SDK
against the e2e fixture modules and the fixture client, so the real workspace
advertised test fixtures as managed. That registration moves to a test-only
dagger.toml under the fixtures directory, reached through Fixtures.workspace.

Incomplete — pushed for discussion, not for merge.

discovery:* passes. generate:* and client:* cannot work as written, because
codegen needs the session's client-backed workspace and the fixtures config can
only be selected by a synthetic one:

  - asWorkspace(cwd:) re-runs config detection, so the nested dagger.toml is
    selected, but the workspace carries no client ID and
    ModuleSource.generateLocalDependencies (mod.dang:97, added in #12) fails in
    withWorkspaceClientContext.
  - Workspace.withWorkdir keeps the client but only clones and sets Cwd, so
    ConfigFile stays the repository's dagger.toml and currentModule.asSDK(ws)
    reports the SDK is not installed. Codegen then resolves "typescript" to the
    builtin SDK rather than this one, which passes for the wrong reason.

java-sdk does not hit this: its Mod.generate reads only introspectionSchemaJSON
and builds the generated files in its own container, so a synthetic workspace is
enough. Unblocking here needs an engine change — withWorkdir re-detecting
config, or generateLocalDependencies working on a synthetic workspace.

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