Skip to content

engine: honor declared versions in module clients - #14881

Merged
eunomie merged 2 commits into
mainfrom
yves/engine-client-version
Oct 28, 2026
Merged

eunomie merged 2 commits into
mainfrom
yves/engine-client-version

Conversation

@eunomie

@eunomie eunomie commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Module clients currently lose their declared API version when the engine applies the module's view. Honor DAGGER_CLIENT_VERSION and nested clients' own announced versions, cap declared core views at the running engine version, and preserve module context and dependency-module versions.

Validation:

  • Focused tests passed in engine/server, engine/engineutil, core, core/schema, and engine. Coverage includes runtime initialization, HTTP __schemaVersion, version gates, engine caps, legacy fallback, nested-client registration, metadata conflicts, and the schema allowlist.
  • Formatting, diff checks, and go vet -lostcancel=false passed. The vet flag matches the repository configuration; default vet reports four existing lostcancel findings in untouched code.

Full SDK/container smoke and the full lint suite were not run. Candidate engine paths were exercised in process. The shared engine was unchanged.

📄 Understanding this change

@eunomie

eunomie commented Oct 27, 2026 •

Copy link
Copy Markdown
Member Author

Why this new env variable and not the existing header?

This is only for clients from inside of a module. Clients outside of modules are using the existing way. But because of SDK entrypoints, this is now different.
The engine starts to call the dang code of the entrypoint using the module's view, before the SDK to run. And once the view is set, the client can't change it using the existing header, it would change the client.
Go has a WithVersionOverride but it works when we connect, and in case of a module the core will attach to the supplied session so it can't work.

In an entrypoint, we already set a specific env variable for the call (to deal with cache).

  pub call(
    receiverType: String!,
    receiverValue: JSON,
    fnName: String!,
    fnArgs: JSON!,
    callDigest: String,
  ): JSON! {
    let request = JSON.encode({{
      receiverType: receiverType,
      receiverValue: receiverValue,
      fnName: fnName,
      fnArgs: fnArgs,
    }})
    let result = container
      .from("alpine:3.22")
      .withFile("/usr/local/bin/dispatch", dispatch, permissions: 755)
      .withMountedDirectory("/workspace", currentModule.contextDirectory)
      .withWorkdir("/workspace/" + currentModule.sourceSubpath)
      .withEnvVariable("DAGGER_MODULE_CALL_DIGEST", callDigest ?? "")
      .withExec(
        ["/usr/local/bin/dispatch", "engine-call", "/dagger/result.json"],
        stdin: request,
        experimentalPrivilegedNesting: true,
      )
      .file("/dagger/result.json")
      .contents
    (result :: JSON!)
  }

The idea is simply to add an extra one

      .withEnvVariable("DAGGER_MODULE_CALL_DIGEST", callDigest ?? "")
      .withEnvVariable("DAGGER_CLIENT_VERSION", "v1.0.0-beta.20")
      .withExec(

And so the withExec will use this version to serve the right view.

@eunomie
eunomie marked this pull request as ready for review October 27, 2026 17:14
@eunomie
eunomie merged commit ee8e3bd into main Oct 28, 2026
92 checks passed
@eunomie
eunomie deleted the yves/engine-client-version branch October 28, 2026 09:51
vito added a commit that referenced this pull request Oct 28, 2026
Refusing modules whose view is past the engine's made prerelease engines
refuse every module declaring bare v1.0.0: sdk-helpers tags, go-sdk main
and this repo's toolchains. Load them instead, served the engine's own
view: ModuleAPIViewVersion caps APIViewVersion at
APIViewVersion(engine.Version). It backs every place a module's
engineVersion becomes a view (default schema builders, module client
sessions) and APIVersionAtLeast, so __schemaVersion reports the capped
view. Clients outside a module are not capped.

A module client that declared its version (DAGGER_CLIENT_VERSION or the
client metadata header, #14881) was already capped at the engine's view by
hand; it now goes through ModuleAPIViewVersion too, and its tests expect
prerelease views.

The max-version check goes back to comparing base versions
(CheckMaxVersionCompatibility): a later base version, such as v2.0.1 on a
v2.0.0 engine, is still refused, since it may need more than view-gated
API. Every prerelease and build of the engine's own base version loads.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 28, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 28, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
Refusing modules whose view is past the engine's made prerelease engines
refuse every module declaring bare v1.0.0: sdk-helpers tags, go-sdk main
and this repo's toolchains. Load them instead, served the engine's own
view: ModuleAPIViewVersion caps APIViewVersion at
APIViewVersion(engine.Version). It backs every place a module's
engineVersion becomes a view (default schema builders, module client
sessions) and APIVersionAtLeast, so __schemaVersion reports the capped
view. Clients outside a module are not capped.

A module client that declared its version (DAGGER_CLIENT_VERSION or the
client metadata header, #14881) was already capped at the engine's view by
hand; it now goes through ModuleAPIViewVersion too, and its tests expect
prerelease views.

The max-version check goes back to comparing base versions
(CheckMaxVersionCompatibility): a later base version, such as v2.0.1 on a
v2.0.0 engine, is still refused, since it may need more than view-gated
API. Every prerelease and build of the engine's own base version loads.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Oct 29, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 2, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 4, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 4, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 4, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 5, 2026
Core enum arguments passed into a module function are spelled for the
module's view, not the view a declared runtime client (#14881) is served:
the engine converts them before the runtime connects. Record the gap.

Signed-off-by: Alex Suraci <[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