Skip to content

core: add WorkspaceSDK.scopeSetting - #15084

Merged
eunomie merged 6 commits into
dagger:mainfrom
eunomie:workspace-sdk-scope-setting
Nov 6, 2026
Merged

eunomie merged 6 commits into
dagger:mainfrom
eunomie:workspace-sdk-scope-setting

Conversation

@eunomie

@eunomie eunomie commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

An SDK called directly, as in dagger call python-sdk mod --path app generate, is built before it knows which scope it serves, so it cannot see the scope settings that dagger generate passes it. This adds a field so it can read them:

WorkspaceSDK.scopeSetting(path: String!, key: String!): JSONValue
  • Reads [sdks.<name>.scopes."<scope>".settings] from the workspace's dagger.toml, in the scope whose key resolves to path. path is relative to the workspace cwd, or absolute from the workspace root. key is matched without regard to case.
  • Returns the recorded value as native JSON, or null when no scope resolves to path or the scope records no such setting.
  • Fails when the config is invalid, path escapes the workspace root, the scope records two settings whose names differ only in case, the value cannot be represented as JSON, or the SDK is no longer installed in the workspace config.
  • Not cached: each call reads the config as it is now.
  • Served from API view v1.0.0-beta.26.

Fixes

  • dagger generate and case variants. Constructor defaults match settings without regard to case. A scope setting now replaces a provider module setting whose name differs from it only in case. Before, the SDK received one of the two at random. A scope that records two settings whose names differ only in case is now rejected with the same error by dagger generate and by scopeSetting, whichever key is requested.
  • Elixir client. The generated scope_setting/3 returns {:ok, nil} for a null value, but the client raised BadMapError when a selected object field was null. It now returns nil for any null object field. A response with several errors now returns {:error, response} with all of them. Before, it was read as data.

Release notes: .changes/unreleased/Added-20261103-172910.yaml, .changes/unreleased/Fixed-20261103-172911.yaml and sdk/elixir/.changes/unreleased/Fixed-20261105-145038.yaml.

Tests in this PR

  • Go unit test TestSDKScopeSettingMatchesGenerate in core/schema. It checks that dagger generate and scopeSetting agree on a case variant, an empty value and a missing key, and that both reject a scope with case-variant duplicates, whichever key is requested.
  • Integration test TestWorkspaceAPI/TestWorkspaceSDKScopeSetting. It reads a recorded value through the API, then shows that a WorkspaceSDK loaded by ID fails once its SDK is removed from dagger.toml.
  • Elixir test nullable object and several errors in sdk/elixir/test/dagger/client_test.exs. The null object case runs against an engine. The several-errors case runs against a local HTTP stub that returns two errors.

Status

  • Go unit test: TestSDKScopeSettingMatchesGenerate passed on this head.
  • Stock regeneration on this base: the Go, TypeScript, docs, PHP and Python generators succeeded with no changes.
  • Elixir and Rust generators: not confirmed locally. The local runner stopped the Elixir generator under its one-engine limit after two engine services overlapped. The Rust generator was not run, because it has the same structure. On this PR's previous head, CI's Elixir and Rust */stale checks passed. They rerun on this head.
  • Integration test: TestWorkspaceAPI/TestWorkspaceSDKScopeSetting passed on this head, against a development engine built from it (1 test).
  • Elixir test: nullable object and several errors (client_test.exs:209) passed on this head: 1 test, 0 failures.
  • CI on this head: pending.

@eunomie
eunomie force-pushed the workspace-sdk-scope-setting branch 2 times, most recently from 4e324ef to e8c0055 Compare November 6, 2026 10:26
eunomie added a commit to eunomie/python-sdk that referenced this pull request Nov 6, 2026
The SDK's copy of the engine's config rules had drifted: it missed
upper-case tables and scope keys above the workspace root. Needs
WorkspaceSDK.scopeSetting from dagger/dagger#15084, not yet released.

Signed-off-by: Yves Brissaud <[email protected]>
A null object field raised BadMapError instead of returning {:ok, nil}.
A response with several errors now returns them all, so that nil cannot
hide them.

Signed-off-by: Yves Brissaud <[email protected]>
@eunomie
eunomie force-pushed the workspace-sdk-scope-setting branch from e8c0055 to 73dc100 Compare November 6, 2026 16:25
@eunomie
eunomie marked this pull request as ready for review November 6, 2026 16:38
@eunomie
eunomie requested review from a team as code owners November 6, 2026 16:38
@eunomie
eunomie merged commit c869e11 into dagger:main Nov 6, 2026
95 checks passed
@eunomie
eunomie deleted the workspace-sdk-scope-setting branch November 6, 2026 17:39
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