Skip to content

python-sdk: read a scope's targetVersion from the engine - #83

Merged
eunomie merged 10 commits into
dagger:mainfrom
eunomie:scope-settings-target-version
Nov 17, 2026
Merged

eunomie merged 10 commits into
dagger:mainfrom
eunomie:scope-settings-target-version

Conversation

@eunomie

@eunomie eunomie commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

A Python module generated directly, as dagger call python-sdk mod --path X generate does, now reads its scope's targetVersion through the engine's WorkspaceSDK.scopeSetting. The SDK no longer parses dagger.toml itself.

The SDK's engine floor is v1.0.0-beta.26, and its default targeted release is v1.0.0-beta.27. WorkspaceSDK.scopeSetting comes from dagger/dagger#15084, first released in v1.0.0-beta.26; nothing the SDK uses needs v1.0.0-beta.27.

Based on main at 3d84461d.

What changes

python-sdk: read a scope's targetVersion from the engine

  • mod calls ws.sdk(name: currentModule.name).scopeSetting(path: "/" + modPath, key: "targetVersion").
    • A null result keeps the SDK's own targetVersion.
    • A recorded pin wins over --target-version, as before.
    • A value that is not a string is refused with its JSON text, as dagger generate refuses it.
  • recordedTargetVersion, scopeSettings, sdkModuleName and scopeKeyPath are deleted. Their copy of the engine's config rules had drifted from it: it missed upper-case tables and scope keys above the workspace root.
  • dagger-module.toml declares v1.0.0-beta.26, the first release with WorkspaceSDK.scopeSetting.
  • That release also renames core identifiers for a module that declares it (dagger/dagger engine.IdentifierCasingVersion). scope.dang reads ModuleSource.clientSchemaIntrospectionJson in place of clientSchemaIntrospectionJSON, and the e2e module names this SDK's type PythonSDK in place of PythonSdk.

e2e: probe a numeric scope pin under upper-case tables

  • Adds scopeSettingProbe, a function, not a check. It records targetVersion = 18 under [SDKS.python.SCOPES."<path>".SETTINGS] and asserts that mod refuses "18" as no engine release:

    dagger call -m .dagger/modules/e2e scope-setting-probe

e2e: run the e2e checks on the engine that runs them

  • dagger.toml installs the e2e module in place of engine-e2e. dagger check without a pattern, which CI runs, now runs the e2e checks on the engine that runs it.
  • Two checks assumed engine-e2e's on-disk playground and nested CLI:
    • client-target-manifest-check loses its Git-workspace branch. Since aceb533e, a same-repo client in a Git workspace binds by path, so generation refuses an unmigrated target there too, with the same dagger module migrate advice.
    • root-init-ignores-check runs its CLI with daggerInDaggerNewSession. A nested CLI receives only its own spans, so check_uploads.py saw no uploading /repo span. A CLI in a session of its own receives the engine's spans, the uploads among them.

engine-e2e: remove the module CI no longer runs

python-sdk: name v1.0.0-beta.18 as the pin bound

  • v1.0.0-beta.18 is no longer the SDK's floor, only the oldest release a targetVersion pin may name. The refusal of a lower pin now says so.

e2e: drop the bindings check every engine skips

  • Deletes sdk-bindings-check. It compared sdk/src/dagger/client/gen.py only on a v1.0.0-beta.18 engine, which can no longer load the SDK, so it passed without comparing anything.

  • The command that regenerates the file stays:

    dagger call -m .dagger/modules/e2e sdk-bindings export --path sdk/src/dagger/client/gen.py

python-sdk: correct stale engine versions in the docs

  • docs/collections.md and the docstring of remoteEntrypointReplacedCheck named v1.0.0-beta.18 as what generation needs. They now name v1.0.0-beta.26 for generation, and v1.0.0-beta.18 for what a generated entrypoint runs on.
  • AGENTS.md no longer ties dagger call exiting 0 on a failing check to v1.0.0-beta.18.

python-sdk: target v1.0.0-beta.27

  • The SDK generates for v1.0.0-beta.27 by default: engineTarget, the vendored library's CLI_VERSION, the README and the golden entrypoints move to it.
  • The reach probe of entrypoint-client-call-check calls ModuleSource.withSdk, the name from v1.0.0-beta.26 on: the caller module now runs in the v1.0.0-beta.27 view.
  • The README's dang.toml paragraph now says that core: version entrypoint modules via dang.toml dagger#14902 shipped in v1.0.0-beta.26, where it read "not merged". Engines up to v1.0.0-beta.25 ignore the file, and an entrypoint whose dang.toml declares no Dagger version gets v1.0.0-beta.25.

e2e: check collections without batch, gone in v1.0.0-beta.22

  • The engine removed the collection batch operation in v1.0.0-beta.22. A collection now keeps its own functions beside keys, list, get and subset, so the delta checks call selected, removed, change and fresh directly.
  • Two assertions cannot be kept. A collection's batch generator no longer replaces its item's: the engine runs the item's generator once per selected item, which collection-kinds-check now asserts. A repeated selector no longer selects a subset for a collection function: collections-check calls subset by name.
  • docs/collections.md no longer describes batch, says that Apply artifact filters to collection views dagger#14802 removed it in v1.0.0-beta.22, and describes the dagger check selector example as a check on the item type, run once per selected item.

e2e: hold the reach probe to what the SDK holds

  • On v1.0.0-beta.27, module code under an entrypoint reads the caller's workspace through a raw currentWorkspace query. A nested client inherits its parent's workspace binding, and the resolver has no guard for module code. The engine's own tests (TestCurrentWorkspaceError) state that module SDKs do not get currentWorkspace; codegen only hides the field. This reproduces on main at 3d84461d with v1.0.0-beta.27, and passed on v1.0.0-beta.18.
  • The probe now reports reads through the module's own currentWorkspace apart from reads through IDs the SDK holds. A read through that workspace's ID counts as the engine's only when the SDK does not hold the same ID itself. The check still fails on any read through an SDK-held ID, and notes the engine's read.

Compatibility

  • Loading the SDK, and so generating a module, needs an engine v1.0.0-beta.26 or later.
  • On an engine without WorkspaceSDK.scopeSetting, the SDK fails while it loads, before it writes anything: Dang type-checks the whole module first. The design accepted this in place of the SDK's own version refusal.
  • mod needs this SDK registered under [sdks] in dagger.toml: an entry whose module is this SDK's installed module, such as [sdks.python] with module = "python-sdk". This now applies with --find-up=false too.
  • A module generated without a targetVersion pin now targets v1.0.0-beta.27. A pin may still name any release from v1.0.0-beta.18 to v1.0.0-beta.27, and the generated entrypoint still needs an engine v1.0.0-beta.18 or later to run.

Testing

Ran on an engine v1.0.0-beta.26, the floor. The released registry.dagger.io/engine:v1.0.0-beta.26 image no longer starts: one root of the cache bundle it ships, the Go SDK's go-includes file, expired on 2026-11-17 at 04:46 UTC, seven days after the image was built, and the engine refuses to start on an expired root. The engine used is that image with /usr/local/share/dagger/entries removed, which starts it with an empty cache.

  • cd sdk && uv run --frozen pytest -q -m "not slow": 568 passed.
  • dagger check -m .dagger/modules/e2e generate-scope-init-check generate-scope-clients-check generate-scope-existing-check generated-ruff-skip-check runtime-call-check: all five pass.
  • dagger check -m .dagger/modules/e2e collections-check collection-kinds-check collections-client-check client-target-manifest-check entrypoint-client-call-check root-init-ignores-check, the checks that failed CI on 81f33eee: all six pass.
  • dagger call -m .dagger/modules/e2e scope-setting-probe: WorkspaceSDK.scopeSetting returns the numeric pin, and mod refuses it as no engine release.

On v1.0.0-beta.27, CI passed on 81fb9d0a, where the SDK declared v1.0.0-beta.27.

  • Locally the workspace is on disk. CI loads it from Git, the case client-target-manifest-check changes for; that path is checked against scope.dang, not run.
  • No check compares sdk/src/dagger/client/gen.py with what the generator writes, so its freshness is not checked. This PR does not change gen.py.

Before merge

  • CI's dagger check passes on v1.0.0-beta.27.

@eunomie
eunomie force-pushed the scope-settings-target-version branch from 1c7916f to f08ce5b Compare November 6, 2026 10:35
The SDK's parse missed upper-case tables and scope keys above the root.
dagger-module.toml declares v1.0.0-beta.26, the first with scopeSetting;
its casing cut needs clientSchemaIntrospectionJson and PythonSDK.

Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
@eunomie
eunomie force-pushed the scope-settings-target-version branch from f08ce5b to 81f33ee Compare November 17, 2026 09:07
CI now loads the workspace from Git, where same-repo clients bind by
path, and a nested CLI there receives none of the engine's spans.

Signed-off-by: Yves Brissaud <yves@dagger.io>
Its engines, built at v1.0.0-beta.17, beta.18 and beta.24, lack
WorkspaceSDK.scopeSetting, so none of them can load this SDK.

Signed-off-by: Yves Brissaud <yves@dagger.io>
The SDK itself now needs v1.0.0-beta.26, so v1.0.0-beta.18 is no longer
its floor, only the oldest release a pin may name.

Signed-off-by: Yves Brissaud <yves@dagger.io>
It compared only on v1.0.0-beta.18, which can no longer load the SDK,
so it reported success without comparing anything.

Signed-off-by: Yves Brissaud <yves@dagger.io>
@eunomie
eunomie force-pushed the scope-settings-target-version branch from 81f33ee to 81fb9d0 Compare November 17, 2026 13:05
@eunomie
eunomie marked this pull request as ready for review November 17, 2026 13:17
Signed-off-by: Yves Brissaud <yves@dagger.io>
Signed-off-by: Yves Brissaud <yves@dagger.io>
Delta checks call the collection's functions directly. A batch generator
replacing its item's, and repeated selectors on a collection function,
cannot be kept: the checks cover per-item generators and subset instead.

Signed-off-by: Yves Brissaud <yves@dagger.io>
beta.27 serves module code its caller's workspace as currentWorkspace,
against the engine's own contract; the check notes that read.

Signed-off-by: Yves Brissaud <yves@dagger.io>
@eunomie
eunomie force-pushed the scope-settings-target-version branch from 81fb9d0 to 2030a32 Compare November 17, 2026 16:08
@eunomie
eunomie merged commit 420808f into dagger:main Nov 17, 2026
64 checks passed
@eunomie
eunomie deleted the scope-settings-target-version branch November 17, 2026 16:33
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.

1 participant