Skip to content

core, idtui: readable errors from entrypoint SDK modules - #15249

Merged
vito merged 76 commits into
mainfrom
viztest-external-sdks
Nov 24, 2026
Merged

vito merged 76 commits into
mainfrom
viztest-external-sdks

Conversation

@vito

@vito vito commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Make the errors and logs of modules built with the external, entrypoint-style SDKs (github.com/dagger/{go,python,typescript,java,php,ruby}-sdk) and of Dang modules readable in the TUI. A failed function now shows its own error as the call's error, the original failure is the origin, no module plumbing is on screen, and the logs of what failed are shown. A module that fails to load says which module, and which step of it.

It comes with golden tests for every SDK (TestTelemetry/TestGolden/sdks-<lang>-<case>), which measure all of this. The SDK side landed in one PR per SDK, listed below, all merged and released; the fixtures pin those releases.

Full before/after report of every changed golden: https://gistpreview.github.io/?cfe7c9bc20afecc5f999af46c3b05cea

Engine

  • The module-process marker. DAGGER_MODULE_CALL_DIGEST (core.ModuleCallDigestEnv) is now engine contract. An entrypoint that declares the callDigest argument of call sets it on the one exec that runs the function, and the engine takes only that exec for the module process: it alone gets the module, reports to the function call's span, and gets the function error file. Its other execs, such as the module's build, keep their own span and logs, and aren't keyed on the module. Without a callDigest, every exec is the process, as before.
  • The function error file. The engine gives the module process DAGGER_FUNCTION_ERROR_PATH, a file in the exec's meta mount, outside its filesystem and its cache key. A process whose function fails writes the function's error there and exits non-zero, and the call fails with that error as the function's own: its message and values, or an Error by ID, with the origin the error names, else the function call. That replaces the ::dagger-function-error:: stderr marker, the call module entrypoint: prefix, and the plumbing span failing alongside. Without a report, the call fails with the process's exec error, exit code included, from the function call.
  • Module loads. The engine's load module: <ref> span fails with the load's error (it ended OK before) and encapsulates its steps. The SDK steps beneath it name the module: module SDK: load runtime / build runtime → build <module>, load typedefs object → introspect <module>, run codegen → generate <module>, and load SDK: <sdk> → load SDK for <module>: <sdk>.
  • Dang. A Dang module's type-definition pass runs under typecheck <module>, which is where a source error is reported and originates, for every load that shares the pass, a broken dependency's own included. The report drops Dang's failed to parse file <path>: wrapper and names files by their path in the module, not the engine's /tmp copy. An entrypoint's prebuild member is built, and synced, under build <module> before call (cached after the first), and a nested client request made under a span of its own keeps it, so a module's build is one span over its calls.

TUI

  • A collapsed failed row that is its own root cause shows its logs, then its error.
  • Breadcrumbs name every landmark. The breadcrumb to an error's origin leaves out internal ancestors and names every shown ancestor that encapsulates its work: a module's load, its build. The steps between landmarks fold away. It reads span attributes only, no span names. So a failed load reads ┇ load module: ./viztest/broken-dep/broken › build broken ›. The rule lives in dagui (TraceTree.ErrorCauseBreadcrumb, Span.ErrorCauseBreadcrumb), so other frontends, such as Dagger Cloud's, share it.
  • loading type definitions is no longer a row of the workspace's or a module's load: the CLI's load workspace: . and load module: <ref> spans encapsulate it (and dagger listen's too). A load of the core API's alone (initializeCore: dagger call and dagger functions without a module, the shell's start) and the shell's .refresh, which have no span of their own, still start one.

SDK implementor contract

What an entrypoint SDK must and may do now. ★ marks what this PR adds; the rest existed, and is now load-bearing.

What Who
callDigest argument of the entrypoint's call (nullable) SDK declares MAY. Declaring it opts into the marker below. Pre-existing as a cache key (#14491).
DAGGER_MODULE_CALL_DIGEST (core.ModuleCallDigestEnv) SDK sets, on the exec running the function MUST, if callDigest is declared: set it to the callDigest received, non-empty, on that exec and no other. The last setting in the exec's env wins. A build exec that sets it is taken for the module process.
★ DAGGER_FUNCTION_ERROR_PATH (engineutil.FunctionErrorPathEnv) engine sets, on the marked exec only MAY write the function's error there on failure, as JSON (below), then exit non-zero. Not set for an unmarked exec, or on an engine without the contract.
prebuild entrypoint member SDK declares MAY. ★ Now also built, and synced, under a build <module> span before call (cached after the first), after callDigest is set, so its execs are build execs, not the module process.
::dagger-function-error:: stderr line SDK-side Not engine contract: a fallback the SDKs' generated Dang entrypoints read when DAGGER_FUNCTION_ERROR_PATH is unset, on older engines.

The function error file (core.ParseFunctionErrorReport) holds exactly one of these JSON objects:

  • {"message": "<the full error text>", "values": {"<name>": <any JSON>, …}}: the message whole, any [traceparent:…] origin it names kept in-band; the values as the error's GraphQL extensions, e.g. an API error's verbatim (_type, cmd, exitCode, stdout, stderr for an ExecError), plus the SDK's own.
  • {"id": "<Error ID>"}: a Dagger Error the process built.
  • anything else is an invalid report, an SDK bug: plain text, malformed JSON, a JSON value that isn't an object, an unknown field or one of the wrong type, an empty message, an id beside a message or values, an id that is no Error ID, or content after the object. The call then fails from the function call with invalid function error report: <why>; the module process failed with: <the exec's error>, carrying the exec's ExecError values (exitCode, stdout, stderr, cmd), so the process's own failure and exit code aren't lost.

Read rules (engineutil.ReadSnapshotSmallFile), only when the exec fails:

  • No usable report, and the call fails with the exec's own error: no file, one that isn't a regular file (a symlink there isn't followed; a fifo, socket or directory isn't read), one over 1 MiB (MaxFunctionErrorBytes), or an empty one.
  • Any other stat or read error, and a failure to mount the meta snapshot, is the engine's, and fails the call as such.
  • A file left behind by a call that succeeds is ignored.

The generated Dang entrypoint raises the exec's error unchanged (not rescued, or rescued and raised as it was), so the engine sees that it is the module process's. The engine's moduleProcess and functionError extensions never reach callers.

Logs, as the goldens pin them for every SDK:

  • Keep origins in-band in the error; strip [traceparent:…] from what the process logs.
  • On an unhandled error, log a short trace of the user's own frames only, in the language's native form, and the language tooling's own output for a build or load failure (compiler, esbuild, PHP Parse error, a Python traceback, Maven's quiet errors). No custom renderings.
  • An API error whose origin the engine shows (an exec's, a dependency's) logs nothing: its origin shows it.

SDK PRs

All merged and released; each pin is the tag dagql/idtui/viztest/sdks/dagger.toml names.

SDK PR Pinned State What it does
go go-sdk#113 v1.7.0 (fedaced) merged The dispatcher reports a function's error in the error file. Also builds the shared dep.
python python-sdk#93 v1.9.0 (e816d08) merged Reports errors in the file; short tracebacks of the user's frames; nothing for an API error whose origin the engine shows.
typescript typescript-sdk#144 v1.2.0 (73806b6) merged Reports errors in the file; the result goes in a file of its own, so console.log no longer corrupts it; short stack traces; loads the module's code itself, so a compile error is esbuild's. On top of #143.
typescript (fork) typescript-sdk#143 contained in v1.2.0 merged, from vito/typescript-sdk Generated Dang entrypoints name cache policies in GraphQL's spelling; without it a module with cache: "session" fails to load.
java java-sdk#47 v1.3.0 (1c1ae27) merged Reports errors in the file; short stack traces; declares prebuild, and Maven builds the jar quietly in an exec of its own, so a build failure shows the compiler's errors.
php php-sdk#49 v1.2.0 (bb1fd91) merged Reports errors in the file, fatal errors included; short stack traces; declares prebuild, the Composer install. On top of #48.
php (fork) php-sdk#48 contained in v1.2.0 merged, from vito/php-sdk Bumps sdk-helpers to v1.0.11: v1.0.9 no longer compiles under current Dang.
ruby ruby-sdk#11 v1.3.0 (b09b640) merged Reports errors in the file; short native traces of the module's own frames, a syntax error with syntax_suggest's section; declares prebuild, the bundle install.
dang none dang-sdk @ 14ba9d3 = main Runs on the engine's built-in Dang runtime.

Before → after

The default, collapsed view a user sees, generated from the goldens. "Before" is main for a golden main has, and otherwise the output the PR first recorded as a baseline, before hand-editing targets; the report linked above has every changed golden, expanded ones included, by the same rule.

go

sdks/go/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestGo: ViztestGo! X.Xs ERROR
   ✔ uploading /tmp/gobuild-dependencies-XXXXXXXXXX X.Xs ████████████ X.X B
-┇ call module entrypoint › .binary(
-  ┆ ws: Directory.asWorkspace
-  ) › Gobuild.binary(
-  ┆ base: withEnvVariable GOARCH=ARCH
-  ┆ image: "golang:1.27-alpine@sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-  ┆ from: null
-  ┆ source: GobuildScoped.source
-  ┆ headers: GobuildScoped.headers
-  ┆ mountPath: "/src"
-  ┆ workdir: "viztest/sdks/broken-go"
-  ┆ pkg: "./cmd/viztest-go-dispatch"
-  ┆ output: "viztest-go-dispatch"
-  ┆ flags: []
-  ┆ downloads: null
-  ┆ sharedImports: []
-  ) ›
+┇ build viztest-go ›
 ✘ withExec sh /gobuild/build.sh dagger/viztest-go (disableDaggerInDagger: true, noInit: true) X.Xs ERROR
-./main.go:77:9: undefined: undefinedValue
+./main.go:93:9: undefined: undefinedValue
 ! exit code: 2

sdks/go/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestGo: ViztestGo! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-✘ call module entrypoint X.Xs ERROR
-! call module entrypoint: go function failed natively
+go function stdout
+go function stderr
+! go function failed natively

python

sdks/python/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestPython: ViztestPython! X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec python -m dagger.mod call --output /dagger/result.json (
-  ┆ stdin: "{\"receiverType\":\"ViztestPython\",\"receiverValue\":\"null\",\"fnName\":\"\",\"fnArgs\":\"{}\"}"
-  ┆ experimentalPrivilegedNesting: true
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 2
+Traceback (most recent call last):
+  File "/src/sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/viztest/sdks/broken-python/src/viztest_python/__init__.py", line XXX, in <module>
+    this is not python
+    ^^^^
+NameError: name 'this' is not defined. Did you forget to import 'this'?
+! name 'this' is not defined

sdks/python/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestPython: ViztestPython! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec python -m dagger.mod call --output /dagger/result.json (
-  ┆ stdin: "{\"receiverType\":\"ViztestPython\",\"receiverValue\":\"{}\",\"fnName\":\"fail_native\",\"fnArgs\":\"{}\"}"
-  ┆ experimentalPrivilegedNesting: true
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 2
+python function stdout
+python function stderr
+Traceback (most recent call last):
+  File "/src/sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/viztest/sdks/python/src/viztest_python/__init__.py", line XXX, in fail_native
+    raise ValueError("python function failed natively")
+ValueError: python function failed natively
+! python function failed natively

sdks/python/fail-exec-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestPython: ViztestPython! X.Xs CACHED
 ✘ .failExec: String! X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec python -m dagger.mod call --output /dagger/result.json (
-  ┆ stdin: "{\"receiverType\":\"ViztestPython\",\"receiverValue\":\"{}\",\"fnName\":\"fail_exec\",\"fnArgs\":\"{}\"}"
-  ┆ experimentalPrivilegedNesting: true
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 2
+✘ withExec sh -c 'echo exec stdout; sleep 0.1; echo exec stderr >&2; exit 1' X.Xs ERROR
+exec stdout
+exec stderr
+! exit code: 1

sdks/python/call-failing-dep-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestPython: ViztestPython! X.Xs CACHED
 ✘ .callFailingDep: String! X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec python -m dagger.mod call --output /dagger/result.json (
-  ┆ stdin: "{\"receiverType\":\"ViztestPython\",\"receiverValue\":\"{}\",\"fnName\":\"call_failing_dep\",\"fnArgs\":\"{}\"}"
-  ┆ experimentalPrivilegedNesting: true
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 2
+┇ .failExec ›
+✘ withExec sh -c 'echo dep exec stdout; sleep 0.1; echo dep exec stderr >&2; exit 1' X.Xs ERROR
+dep exec stdout
+dep exec stderr
+! exit code: 1

typescript

sdks/typescript/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestTypescript: ViztestTypescript! X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec tsx --no-deprecation --tsconfig tsconfig.json entrypoint/__dagger.dispatch.ts engine-call (
-  ┆ stdin: "{\"receiverType\":\"ViztestTypescript\",\"receiverValue\":\"null\",\"fnName\":\"\",\"fnArgs\":\"{}\"}"
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 1
+/workspace/viztest/sdks/broken-typescript/src/index.ts:84:5: ERROR: Expected ";" but found "is"
+! Transform failed with 1 error

sdks/typescript/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestTypescript: ViztestTypescript! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec tsx --no-deprecation --tsconfig tsconfig.json entrypoint/__dagger.dispatch.ts engine-call (
-  ┆ stdin: "{\"receiverType\":\"ViztestTypescript\",\"receiverValue\":\"{}\",\"fnName\":\"failNative\",\"fnArgs\":\"{}\"}"
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
-! exit code: 2
+typescript function stdout
+typescript function stderr
+Error: typescript function failed natively
+    at ViztestTypescript.failNative (/workspace/viztest/sdks/typescript/src/index.ts:34:11)
+! typescript function failed natively

java

sdks/java/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestJava: ViztestJava! X.Xs ERROR
-┇ call module entrypoint ›
-✘ withExec sh -c 'set -e\ntouch /tmp/stale\nif [ -f sdk/repo/io/dagger/dagger-java-sdk/0.21.4/dagger-java-sdk-0.21.4.jar ]; then\n  exec mvn package -DskipTests --threads 1C --no-transfer-progress\nfi\nmkdir -p /tmp/committed\nmv src/generated/java /tmp/committed/java\nmvn package -DskipTests -Ddagger.proc=full --threads 1C --no-transfer-progress\ndiff -r /tmp/committed/java target/generated-sources/annotations >/dev/null || echo src/generated/java >> /tmp/stale\ncmp -s src/generated/dang/entrypoint/main.dang target/classes/dagger/entrypoint/main.dang || echo src/generated/dang/entrypoint/main.dang >> /tmp/stale' (
-  ┆ moduleContext: Module._implementationScoped: Module!
-  ) X.Xs ERROR
+┇ build viztest-java ›
+✘ withExec mvn package -Ddagger.proc=full -DskipTests --quiet --threads 1C --no-transfer-progress X.Xs ERROR
+[ERROR] COMPILATION ERROR :
+[ERROR] /src/viztest/sdks/broken-java/src/main/java/io/dagger/modules/viztestjava/ViztestJava.java:[97,1] class, interface, enum, or record expected
+[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (compile-module) on project viztest-java: Compilation failure
+[ERROR] /src/viztest/sdks/broken-java/src/main/java/io/dagger/modules/viztestjava/ViztestJava.java:[97,1] class, interface, enum, or record expected
+[ERROR]
+[ERROR] -> [Help 1]
+[ERROR]
+[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
+[ERROR] Re-run Maven using the -X switch to enable full debug logging.
+[ERROR]
+[ERROR] For more information about the errors and possible solutions, please read the following articles:
+[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
 ! exit code: 1

sdks/java/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestJava: ViztestJava! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-✘ call module entrypoint X.Xs ERROR
-! call module entrypoint: java function failed natively
+java function stdout
+java function stderr
+java.lang.Exception: java function failed natively
+        at io.dagger.modules.viztestjava.ViztestJava.failNative(ViztestJava.java:31)
+! java function failed natively

php

sdks/php/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestPhp: ViztestPhp! X.Xs ERROR
-✘ call module entrypoint X.Xs ERROR
-! call module entrypoint: dagger-module: ParseError: syntax error, unexpected identifier "is"
-  #0 /src/viztest/sdks/broken-php/vendor/composer/ClassLoader.php(427): {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}('/src/viztest/sd...')
-  #1 [internal function]: Composer\Autoload\ClassLoader->loadClass('DaggerModule\\Vi...')
-  #2 /src/viztest/sdks/broken-php/sdk/src/Module/CallDispatcher.php(38): class_exists('DaggerModule\\Vi...')
-  #3 /src/viztest/sdks/broken-php/sdk/bin/dagger-module(61): Dagger\Module\CallDispatcher->call('ViztestPhp', 'null', '', '{}')
-  #4 {main}
+PHP Parse error:  syntax error, unexpected identifier "is" in /src/viztest/sdks/broken-php/src/ViztestPhp.php on line 120
+! syntax error, unexpected identifier "is"

sdks/php/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestPhp: ViztestPhp! X.Xs CACHED
 ✘ .failNative: Void! X.Xs ERROR
-✘ call module entrypoint X.Xs ERROR
-! call module entrypoint: php function stderr
-  dagger-module: RuntimeException: php function failed natively
-  #0 [internal function]: DaggerModule\ViztestPhp->failNative()
-  #1 /src/viztest/sdks/php/sdk/src/Module/CallDispatcher.php(84): ReflectionMethod->invokeArgs(Object(DaggerModule\ViztestPhp), Array)
-  #2 /src/viztest/sdks/php/sdk/src/Module/CallDispatcher.php(46): Dagger\Module\CallDispatcher->invoke(Object(ReflectionClass), '{}', 'failNative', Array)
-  #3 /src/viztest/sdks/php/sdk/bin/dagger-module(61): Dagger\Module\CallDispatcher->call('ViztestPhp', '{}', 'failNative', '{}')
-  #4 {main}
+php function stdout
+php function stderr
+RuntimeException: php function failed natively in /src/viztest/sdks/php/src/ViztestPhp.php:44
+! php function failed natively

ruby

sdks/ruby/broken-default (before: the PR's baseline, bc1cf30)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 ✘ viztestRuby: ViztestRuby! X.Xs ERROR
-✘ withExec ruby -rbundler/setup sdk/exe/dagger-mod call --output /dagger/result.json (stdin: "{\"receiverType\":\"ViztestRuby\",\"receiverValue\":\"null\",\"fnName\":\"\",\"fnArgs\":\"{}\",\"callDigest\":\"xxh3:XXXXXXXXXXXXXXXX\",\"moduleSource\":\"EhMIlLX.X BEg0KCURpcmVjdG9yeRgB\"}") X.Xs ERROR
-/usr/local/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': --> /src/lib/viztest_ruby.rb
+--> /src/lib/viztest_ruby.rb
 
 Unmatched `)', missing `(' ?
 Unmatched keyword, missing `end' ?
 
 >  1  require "dagger"
 >  2  require "dagger/clients/roots"
 > 86  this is not ruby)
 
 /src/lib/viztest_ruby.rb:86: syntax errors found (SyntaxError)
   84 | end
   85 |
 > 86 | this is not ruby)
      |                 ^ unexpected ')', ignoring it
      |                 ^ unexpected ')', expecting end-of-input
-
-        from /usr/local/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
-        from /src/sdk/lib/dagger/mod/cli.rb:75:in 'Dagger::Mod::CLI.load_module'
-        from /src/sdk/lib/dagger/mod/cli.rb:55:in 'Dagger::Mod::CLI.call'
-        from /src/sdk/lib/dagger/mod/cli.rb:20:in 'Dagger::Mod::CLI.run'
-        from sdk/exe/dagger-mod:10:in '<main>'
-! exit code: 1
+! /src/lib/viztest_ruby.rb:86: syntax errors found

sdks/ruby/fail-native-default (before: the PR's baseline, bc1cf30)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestRuby: ViztestRuby! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-✘ withExec ruby -rbundler/setup sdk/exe/dagger-mod call --output /dagger/result.json (stdin: "{\"receiverType\":\"ViztestRuby\",\"receiverValue\":\"{}\",\"fnName\":\"fail_native\",\"fnArgs\":\"{}\",\"callDigest\":\"xxh3:XXXXXXXXXXXXXXXX\",\"moduleSource\":\"EhIIkxkSDQoJRGlyZWN0b3J5GAE=\"}") X.Xs ERROR
 ruby function stdout
 ruby function stderr
-dagger-mod: Dagger::Mod::FunctionError: /src/lib/viztest_ruby.rb:21:in 'ViztestRuby#fail_native': ruby function failed natively (RuntimeError)
-        from /src/sdk/lib/dagger/mod/dispatch.rb:56:in 'Kernel#public_send'
-        from /src/sdk/lib/dagger/mod/dispatch.rb:56:in 'block in Dagger::Mod::Dispatch#invoke'
-        from /src/sdk/lib/dagger/mod/dispatch.rb:74:in 'Dagger::Mod::Dispatch#user_code'
-        from /src/sdk/lib/dagger/mod/dispatch.rb:56:in 'Dagger::Mod::Dispatch#invoke'
-        from /src/sdk/lib/dagger/mod/dispatch.rb:21:in 'Dagger::Mod::Dispatch#call'
-        from /src/sdk/lib/dagger/mod/cli.rb:56:in 'Dagger::Mod::CLI.call'
-        from /src/sdk/lib/dagger/mod/cli.rb:20:in 'Dagger::Mod::CLI.run'
-        from sdk/exe/dagger-mod:10:in '<main>'
-! exit code: 2
+/src/lib/viztest_ruby.rb:21:in 'ViztestRuby#fail_native': ruby function failed natively (RuntimeError)
+! ruby function failed natively

sdks/ruby/fail-exec-default (before: the PR's baseline, bc1cf30)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestRuby: ViztestRuby! X.Xs CACHED
 ✘ .failExec: String! X.Xs ERROR
-✘ withExec ruby -rbundler/setup sdk/exe/dagger-mod call --output /dagger/result.json (stdin: "{\"receiverType\":\"ViztestRuby\",\"receiverValue\":\"{}\",\"fnName\":\"fail_exec\",\"fnArgs\":\"{}\",\"callDigest\":\"xxh3:XXXXXXXXXXXXXXXX\",\"moduleSource\":\"EhIIkxkSDQoJRGlyZWN0b3J5GAE=\"}") X.Xs ERROR
-dagger-mod: Dagger::ExecError: exit code: 1 [traceparent:00000000000000000000000000000000-0000000000000000]
+✘ withExec sh -c 'echo exec stdout; sleep 0.1; echo exec stderr >&2; exit 1' X.Xs ERROR
+exec stdout
 exec stderr
-! exit code: 2
+! exit code: 1

sdks/ruby/call-failing-dep-default (before: the PR's baseline, bc1cf30)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestRuby: ViztestRuby! X.Xs CACHED
 ✘ .callFailingDep: String! X.Xs ERROR
-✘ withExec ruby -rbundler/setup sdk/exe/dagger-mod call --output /dagger/result.json (stdin: "{\"receiverType\":\"ViztestRuby\",\"receiverValue\":\"{}\",\"fnName\":\"call_failing_dep\",\"fnArgs\":\"{}\",\"callDigest\":\"xxh3:XXXXXXXXXXXXXXXX\",\"moduleSource\":\"EhIIkxkSDQoJRGlyZWN0b3J5GAE=\"}") X.Xs ERROR
-dagger-mod: Dagger::ExecError: exit code: 1 [traceparent:00000000000000000000000000000000-0000000000000000]
+┇ .failExec ›
+✘ withExec sh -c 'echo dep exec stdout; sleep 0.1; echo dep exec stderr >&2; exit 1' X.Xs ERROR
+dep exec stdout
 dep exec stderr
-! exit code: 2
+! exit code: 1

dang

sdks/dang/broken-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✘ load workspace: . X.Xs ERROR
-┇ loading type definitions › load extra module: ./viztest/sdks/broken-dang › ModuleSource.asModule ›
-✘ ModuleSource._moduleTypesDefinition(
-  ┆ introspectionJson: __schemaJSONFile(hiddenTypes: ["Host", "Engine", "EngineCache", "EngineCacheEntry", "EngineCacheEntrySet"], hiddenFields: ["Query.currentWorkspace", "Query.engineVolume", "Query.sshfsVolume", "Query.setSessionTitle", "Address.volume"]): File!
-  ┆ moduleName: "viztest-dang"
-  ): Module! X.Xs ERROR
-failed to parse file /tmp/dagger-dang/viztest-dang-XXXXXXXX/viztest/sdks/broken-dang/main.dang: Error: syntax error: unexpected 'this is not'
-  --> /tmp/dagger-dang/viztest-dang-XXXXXXXX/viztest/sdks/broken-dang/main.dang:53:1
+┇ load module: ./viztest/sdks/broken-dang ›
+✘ typecheck viztest-dang X.Xs ERROR
+Error: syntax error: unexpected 'this is not'
+  --> viztest/sdks/broken-dang/main.dang:70:1
      |
-  51 | }
-  52 |
-  53 | this is not dang
+  68 | }
+  69 |
+  70 | this is not dang
        ^^^^^^^^^^^
-  54 |
+  71 |
      |
 ! syntax error: unexpected 'this is not'

sdks/dang/fail-native-default (before: the PR's baseline, 640d056)

 ✔ connect X.Xs
 ✔ load workspace: . X.Xs
 ✔ parsing command line arguments X.Xs
 
 $ viztestDang: ViztestDang! X.Xs CACHED
 ✘ .failNative: Void X.Xs ERROR
-! dang function failed natively
-
-✘ ViztestDang.failNative: Void X.Xs ERROR
 dang function stdout
 ! dang function failed natively

Module loads

broken-default (before: main)

 ✔ connect X.Xs
 ✘ load workspace: . X.Xs ERROR
   ✔ uploading /tmp/gobuild-dependencies-XXXXXXXXXX X.Xs ████████████ X.X B
-┇ loading type definitions › load extra module: ./viztest/broken-dep/broken › ModuleSource.asModule › module SDK: load runtime ›
+┇ load module: ./viztest/broken-dep/broken › build broken ›
 ✘ withExec sh /gobuild/build.sh dagger/broken (disableDaggerInDagger: true, noInit: true) X.Xs ERROR
 ./main.go:6:6: undefined: ctx
 ! exit code: 2

broken-dep-use-broken-default (before: main)

 ✔ connect X.Xs
 ✘ load workspace: . X.Xs ERROR
   ✔ uploading /tmp/gobuild-dependencies-XXXXXXXXXX X.Xs ████████████ X.X B
-┇ loading type definitions › load extra module: ./viztest/broken-dep › ModuleSource.asModule › load dep modules › ModuleSource.asModule › module SDK: load runtime ›
+┇ load module: ./viztest/broken-dep › build broken ›
 ✘ withExec sh /gobuild/build.sh dagger/broken (disableDaggerInDagger: true, noInit: true) X.Xs ERROR
 ./main.go:6:6: undefined: ctx
 ! exit code: 2

broken-dep-sdk-use-invalid-default (new)

✔ connect X.Xs
✘ load workspace: . X.Xs ERROR
┇ load module: ./viztest/broken-dep-sdk ›
✘ load SDK for invalid: unknown X.Xs ERROR
Could not load SDK "unknown".

Errors:
- unknown built-in sdk
- local path "/app/dagql/idtui/viztest/broken-dep-sdk/invalid/unknown" does not exist

The available SDKs are:
- go
- dang
- python
- typescript
- php
- elixir
- java
- any git module ref, e.g. github.com/dagger/dagger/sdk/elixir@main
- any local module path, e.g. ./my-sdk
! invalid SDK: "unknown"

Already as wanted at the PR's baseline, so not shown: sdks/go/fail-exec-default, sdks/go/call-failing-dep-default, sdks/typescript/fail-exec-default, sdks/typescript/call-failing-dep-default, sdks/java/fail-exec-default, sdks/java/call-failing-dep-default, sdks/php/fail-exec-default, sdks/php/call-failing-dep-default, sdks/dang/fail-exec-default, sdks/dang/call-failing-dep-default.

The goldens

  • Fixtures: dagql/idtui/viztest/sdks/<lang>/, one per SDK, with the same functions, so the goldens line up across SDKs; viztest/sdks/dep is a shared go-sdk dependency. They are generated from viztest/sdks/dagger.toml, a workspace of its own, so regenerating them never touches the repo's dagger.toml. Most of the diff is generated SDK code, marked linguist-generated.
  • Cases: log-success, fail-native, fail-exit-code (not for dang, which has no process), fail-exec, fail-exec-wrapped, fail-api (a core API call that fails), call-failing-dep, call-failing-dep-logged, and broken (a copy of the fixture with a syntax error appended).
  • Two views: each failing case has an expanded golden (-v) and a -default one, collapsed and quiet; broken only -default. New: broken-dep-sdk-use-invalid-default.
  • History: the first commits record the output of the time as a baseline, warts and all; idtui: target output for external SDK goldens (and …for the fail-api goldens) hand-edits them to the wanted output; each SDK's pass then makes its goldens pass. Expanded goldens elsewhere lose the loading type definitions row.
  • Normalization (SDK examples only): the native platform ("linux/ARCH", GOARCH=ARCH), Dang temp-path digests, HTTP dates and the ⋯ waited suffix. Expanded goldens elide the children of a nested call module entrypoint span, which the Dang entrypoint evaluates concurrently, so their order varies. log-success is checked loosely: the result renders as a log line that races the function's own logs.

Deferred

  • Error wrapping. A caught and re-raised exec error loses its wrapping message in the default view, whose origin is the inner withExec (fail-exec-wrapped*). Expanded, Python, TypeScript, PHP, Java and Ruby show the cause chain in their trace; Go and Dang show no wrapping message at all.
  • PHP default arguments. The PHP client sends every default argument, so its calls render with all of them (withExec, Container.from), until php-sdk's codegen omits them.
  • PHP cache policy. The PHP SDK has no function cache policy, so log-success is cached and its logs aren't seen again.
  • Bare exit codes. An exec error's message is still a bare exit code: N; the exec's logs, on its row, tell the rest.

vito added 6 commits November 21, 2026 21:07
Add fixture modules built with the external, entrypoint-style SDKs (go,
python, typescript, php, java, and dang), each with the same functions: one
that logs and succeeds, one that logs and fails natively, one that exits with
a code, a failing withExec left unhandled and caught-and-wrapped, and a call
into a go-sdk dependency whose withExec fails. A copy of each fixture with a
syntax error appended, made by the test, covers an SDK's own build or load
failing before any function runs.

The goldens pin today's output, warts and all, to plan fixes against; the
fixture comments in golden_sdks_test.go name what is wrong per SDK. Each
failing case also has a collapsed, quiet variant, as a user sees it.

The fixtures are generated from viztest/sdks/dagger.toml, a workspace of
their own so that regenerating them never touches the repository's config.
Two SDKs are pinned to forks with fixes the fixtures need to run at all:
php-sdk's sdk-helpers no longer compiles under current Dang
(dagger/php-sdk#48), and typescript-sdk's Dang entrypoint misspells cache
policies (dagger/typescript-sdk#143).

Expanded reports elide what a module entrypoint evaluates: the Dang
entrypoint runs it concurrently, so its order varies run to run. The suite's
cleanup now removes the dagger.lock the fixtures' image pulls write.

Signed-off-by: Alex Suraci <[email protected]>
Generated with engine-dev's testTelemetry, update: true, for
TestTelemetry/TestGolden/sdks-.

Signed-off-by: Alex Suraci <[email protected]>
Scrub HTTP dates, which a TypeScript client's logged GraphQL error carries,
so its golden holds on another day. Keep every indented line of an
entrypoint's error when eliding its internals, not just the first level,
and remove broken fixture copies an interrupted run leaves behind.

The Dang fixture now rescues exactly the GraphQL error an exec raises; it
caught it before too, and its golden still shows no wrapping message,
because the report renders only the origin.

Signed-off-by: Alex Suraci <[email protected]>
Its HTTP date is scrubbed now.

Signed-off-by: Alex Suraci <[email protected]>
Each SDK fixture gets a function that logs a line of its own, then calls
the dependency whose withExec fails, so the goldens pin where a bubbling
function's own logs land. Its goldens record today's output; fixture line
shifts move a few stack-trace line numbers in the existing ones.

Signed-off-by: Alex Suraci <[email protected]>
Hand-edit the sdks/<lang> goldens to the output we want, so this diff reads
current -> desired. They fail until it is implemented; the fail-exec-wrapped
goldens keep today's output, since wrapping is deprioritized.

The target, per the review guidance:
- no module plumbing on screen: no "call module entrypoint" rows or message
  prefixes, no dispatcher withExec rows, no ::dagger-function-error:: lines,
  no traceparents;
- a bubbled error's origin is the original failure, and intermediate rows
  show no error of their own, only what the function itself printed;
- fail-native and fail-exit-code: the function's logs, then its language
  error or "exit code: 3", on the function's row;
- broken: the compiler's or interpreter's own error output.

Test changes that the target implies: TypeScript's log-success now succeeds,
so it uses the loose log-success checks like the other SDKs, and its
goldens go. Flaky stays only on TypeScript's fail-exec-wrapped, the one
racing output left; PHP's fail-exec no longer races.

Guesses to confirm:
- The SDKs' own stack traces for an unhandled error are dropped from the
  function's logs; the error message alone is the "!" line, as the built-in
  runtimes render it (fail-log-native). That includes Python's
  "ERROR [dagger.mod]" lines.
- Collapsed, an origin that is the function row itself shows its logs
  unindented below it, then "!", the way other collapsed origins do; this
  also drops Dang's duplicate fail-native rendering.
- Collapsed, a bubbling function's own logs are not shown
  (call-failing-dep-logged-default), as for the built-in Dang runtime
  today; only the expanded view shows them.
- PHP's withExec and Container.from render without the default arguments
  the PHP client sends, to match the other SDKs.
- broken-default: the breadcrumb to a build step is "┇ build ›"
  (placeholder). Go keeps dagger/go's build.sh withExec row, as the
  built-in Go runtime's broken-default does; Java's maven build is labelled
  "build viztest-java [label TBD]" (placeholder) and shows only the javac
  error line, as if maven ran quietly. Python, TypeScript and PHP fail on
  the function's own row with the language's error output, trimmed to the
  user's frame: a Python traceback of the module's line, esbuild's error
  line, and PHP's standard "PHP Parse error" line (wording guessed). Dang's
  parse error lands on the "load extra module" row, with a
  workspace-relative path instead of the engine's /tmp copy.
- PHP's log-success stays cached with no logs: the PHP SDK has no cache
  policy, which isn't a TUI matter.

Signed-off-by: Alex Suraci <[email protected]>
vito added 10 commits November 21, 2026 23:38
Every exec an entrypoint call evaluated was taken for its module process:
build steps with API access (the default nesting) got the module, and all of
them reported their telemetry and logs to the function call. A failed Java
build so showed maven's output on the function row (trace 150bc33a).

DAGGER_MODULE_CALL_DIGEST, which every generated entrypoint sets to its
callDigest on the exec that runs the function and on no other, is now the
engine's contract for that exec (core.ModuleCallDigestEnv): only it serves
the module and reports to the function call. The other execs keep their own
span and logs, and, not keyed on the module, are shared across modules.

An entrypoint that declares no callDigest can't mark its process, so every
exec it starts is still taken for it. Entrypoint members such as prebuild
key their execs as the entrypoint's calls key their build execs, so a
prebuilt file stays the one the calls build.

Signed-off-by: Alex Suraci <[email protected]>
The epcaller entrypoint of the serveModule tests declares callDigest but
passed it to its process on stdin, so with the module process now marked
by DAGGER_MODULE_CALL_DIGEST, its process lost the module. Set the variable,
as generated entrypoints do.

Signed-off-by: Alex Suraci <[email protected]>
An entrypoint's module process has no current function call to return its
error to, so a failed function failed the call with the process's exec error
("exit code: 2"), or with whatever error its SDK printed for the entrypoint
to parse back out of stderr in Dang.

The engine now gives the module process (core.ModuleCallDigestEnv) a file
for the error, named in DAGGER_FUNCTION_ERROR_PATH: a directory of the exec's
meta mount, bound into the container, so the engine reads the file from the
failed exec's meta snapshot as it reads its stdout and exit code. The path is
injected at run time and never enters the exec's recipe or cache key, the
mount leaves nothing in the process's filesystem, and the file is only read
when the exec fails, so a failed call is still never cached and a success
ignores what the process wrote. The engine reads the first 64 KiB of a
regular file there, and nothing else, such as a named pipe.

The exec error marks the module process's failure for the entrypoint's call
(the moduleProcess and functionError extensions), which fails with it as the
function's own:
- with the error the process wrote: one whose message names an origin, such
  as an API error the function returned, keeps it; any other comes from the
  function call;
- or, when the process wrote none, as when it died, with its exec error,
  exit code and all, but from the function call, not from the exec.

Either way the "call module entrypoint" span is no longer failed by its
function's error, and the call's error no longer reads "call module
entrypoint: ...".

An SDK that finds the variable unset runs on an engine without the file, and
reports its error as before.

Signed-off-by: Alex Suraci <[email protected]>
When a top-level call failed with an error of its own, the collapsed final
report printed its row with a bare error, then repeated the whole call below
the tree, title and error again, only to show its logs:

    ✘ .failNative: Void ERROR
    ! failed natively

    ✘ Viztest.failNative: Void ERROR
    function stdout
    ! failed natively

The row now shows the logs above its error, as the root-cause block did, and
the block has nothing left to add. The built-in Dang runtime's fail-native
renders so too.

Signed-off-by: Alex Suraci <[email protected]>
Pin the Python fixture's SDK to a fork of dagger/python-sdk#93, rebased on
main, whose dispatcher writes the function's error to the engine's
DAGGER_FUNCTION_ERROR_PATH, and regenerate it. Every sdks-python golden now
renders as its hand-edited target, with these differences:

- Stack traces are deferred, like wrapping: the function's logs keep the
  traceback Python prints, "ERROR [dagger.mod]" header included, in
  fail-native, fail-exec, call-failing-dep and broken-default. The error
  origins and the error echoed after the traceback are gone.
- call-failing-dep keeps the go-sdk dependency's rows as they render today:
  its ::dagger-function-error:: echo and its failed "call module entrypoint"
  row are the Go SDK's to fix.
- fail-exec-wrapped is still today's output, which these fixes change: no
  entrypoint row or error origins, and collapsed, the inner withExec with
  its logs instead of the dispatcher's "exit code: 2". The wrapping message
  is still lost.

The fixture notes drop the failures the engine no longer has.

Signed-off-by: Alex Suraci <[email protected]>
The function error file carried only a plain-text message, so an error a
module process reported lost its values: a calling module saw a plain error
where a runtime's process returned an ExecError, exit code and output
included.

The file now holds {"message": ..., "values": {...}}: the error's message in
full, any origin it names ([traceparent:...]) included, and its values, such
as an API error's extensions; or {"id": ...}, an Error the process built;
any other text is the message, as before. The call returns the reported
Error as a runtime's process returns one with returnError, and gives it its
origin the same way (functionCallErrorWithOrigin, shared by both): a
traceparent value, else the origin its message names, else the runtime's
failure's, else the function call. Naming the message's origin ahead of the
runtime's is new for returnError too, which put the runtime's in the values
of an error whose message named another.

The file's raw content never reaches the caller: the exec error carries the
parsed report to the entrypoint's call only. The engine reads a file of up
to 1 MiB; a larger one is no report, and the call fails with the process's
exec error, as when it wrote none.

Signed-off-by: Alex Suraci <[email protected]>
Repin the python-sdk fork to af35286, which writes the error file as JSON
with the message and the exception's values. The goldens are unchanged.

Signed-off-by: Alex Suraci <[email protected]>
A plain-text error that happens to be a JSON object, such as an HTTP API's
{"id": "not_found", "message": "..."} body, was read as a structured report:
its other fields were dropped, or the call failed decoding a bogus Error ID.
Now only an object that is exactly {"message", "values"} or a lone {"id"}
holding an Error ID is structured; anything else is the message. A report
the call still can't return (an ID that doesn't load) leaves the call the
exec's error instead of a decode failure, without the raw report.

Signed-off-by: Alex Suraci <[email protected]>
The fork now trims an error report to fit the engine's 1 MiB limit, takes
an API error's values only from the exception it was raised from, and keeps
a FunctionError's extra values. The goldens are unchanged.

Signed-off-by: Alex Suraci <[email protected]>
Also say in moduleProcessFunctionError that an Error ID which doesn't load
fails the call as returnError's does, rather than falling back.

Signed-off-by: Alex Suraci <[email protected]>
vito added 4 commits November 22, 2026 03:27
dagger/python-sdk's entrypoint-function-error branch now holds the same
commits, so pin it by the same SHA.

Signed-off-by: Alex Suraci <[email protected]>
Only the README changed, so the fixture and goldens are unchanged.

Signed-off-by: Alex Suraci <[email protected]>
Not every failure is an exec's. fail-api prints a line, then reads a file
that doesn't exist with a plain core API (directory().file(...).contents()),
the error unhandled. Add it to all six SDK fixtures, regenerate them, and
record today's output, expanded and -default, as the baseline the target
edit diffs against.

Signed-off-by: Alex Suraci <[email protected]>
Hand-edit the go, java, php and typescript fail-api goldens to the output we
want, following the earlier SDK targets: the failed API call is the origin,
with its own message; the function's row keeps only what the function
printed; no "call module entrypoint" row, ::dagger-function-error:: line,
stack trace, dispatcher reply or traceparent.

Judgment calls:
- The origin is Directory.file(path: "doesnt-exist.txt"), not .contents:
  the stat fails resolving file(), so no .contents row ever renders. Its row
  is the "!" message alone, with no logs, since an API call has none; that
  is how the dang reference and every SDK's collapsed golden render it today.
- The go, java and php -default goldens already render the target, so they
  stay as recorded; only typescript's changes, from its dispatcher's
  "exit code: 2" with the whole client error dump to the origin row.
- python and dang are unchanged. Dang is the reference. Python renders the
  target except for its traceback ("ERROR [dagger.mod]" through
  "dagger.QueryError: ...") on the function's row, which stays as in its
  other goldens: stack traces are deferred, and its goldens record what it
  renders.

Signed-off-by: Alex Suraci <[email protected]>
vito added 7 commits November 22, 2026 05:05
Pin go-sdk to dagger/go-sdk#113 (5ed109c), whose dispatcher writes a
function's error to the engine's DAGGER_FUNCTION_ERROR_PATH and whose
entrypoint raises the exec error that carries it as it is, and regenerate
the go fixture and the shared dep, a go-sdk module.

Every sdks-go golden now renders as its target, fail-api included, except
broken-default: its "┇ build ›" breadcrumb is still a placeholder, and the
real one lists the entrypoint's dagger/go calls. Its compiler error moved to
./main.go:93:9 when fail-api grew the fixture.

The dep's rows are now clean in every SDK's call-failing-dep goldens, as the
targets have them, so the Python ones drop the rows relaxed for it: the
::dagger-function-error:: echo and the failed "call module entrypoint". The
dep's failure also reaches Python as an ExecError, values and all, so its
traceback ends in dagger.ExecError rather than dagger.QueryError.

Go's fail-exec-wrapped, which records today's output since wrapping isn't
targeted, loses the same entrypoint row, marker and traceparent, and with
the echo the wrapping message: it is now nowhere, even expanded, as for
dang. The fixture notes say so.

Signed-off-by: Alex Suraci <[email protected]>
Calling the viztest go-sdk dep's failing function gets an ExecError with the
inner exec's exit code, output and command, and no entrypoint plumbing: the
go-sdk counterpart of the function error file's value tests.

Signed-off-by: Alex Suraci <[email protected]>
Repin python-sdk#93 to e711bad: when the engine gives a call's process the
function error file, an API error that escapes a function is no longer
logged with its traceback. The failing call already renders as the origin,
with its logs, and the caller still gets the typed ExecError and its values
from the file.

The call-failing-dep, call-failing-dep-logged, fail-api and fail-exec goldens
lose the "API error while executing function" traceback. A function's own
exceptions (fail-native, fail-exec-wrapped) still log theirs.

Signed-off-by: Alex Suraci <[email protected]>
The Python fixture's comment still read as if every unhandled error left a
traceback in the function's logs; only the function's own exceptions do now.

Signed-off-by: Alex Suraci <[email protected]>
Repin python-sdk#93 to a67b7a2: with the function error file, a function's
own exception, and an error importing its code, are shown as Python shows
an uncaught one, through the user's frames only, without the
"Unhandled exception" and "Error while importing" log lines. The vendored
dispatcher files are copied from it.

fail-native, fail-native-default, fail-exec-wrapped and broken-default lose
the SDK, generated client and importlib frames. fail-exec-wrapped keeps the
chain: the inner ExecError with the user's line that got it, then "The
above exception was the direct cause".

Signed-off-by: Alex Suraci <[email protected]>
The Python fixture's comment still called the function's traceback not
targeted yet; the short traceback through the user's frames is now the
target these goldens pin.

Signed-off-by: Alex Suraci <[email protected]>
python-sdk#93 now keeps the frames of the user's own libraries, which the
runtime installs from the module's workspace, not editable, in a short
traceback, and leaves the API errors whose origin the engine shows out of
a task group's error. The vendored dispatcher files are copied from it; the
goldens are unchanged.

Signed-off-by: Alex Suraci <[email protected]>
vito added 9 commits November 22, 2026 18:05
fsutil.Stat clears a socket's type bit, so a socket at the function error
path passed as a regular file, and its open failed the call. LstatFile now
returns os.Lstat's info, whose mode has every type bit, so a socket is no
report, as any other file that isn't regular.

Signed-off-by: Alex Suraci <[email protected]>
"loading type definitions" never stood for its work, even with no "load
module" row beneath it to name the failure, as when the CLI loads a served
module's type definitions under its own load. It now stops standing for
its work only once the breadcrumb has passed a load row, and the load's
plumbing is left out only beneath that row.

Signed-off-by: Alex Suraci <[email protected]>
The spans of a module SDK's work on a module read "module SDK: load
runtime", "module SDK: build runtime", "module SDK: load typedefs object"
and "module SDK: run codegen": what the SDK does, not to which module. They
now read "build <module>", "introspect <module>" and "generate <module>",
as an entrypoint's build already reads "build <module>", so a breadcrumb
through one names the module.

Signed-off-by: Alex Suraci <[email protected]>
The engine's "load module: <ref>" span showed its steps beneath it, and the
CLI's "loading type definitions" encapsulated every module's load instead,
so it was the row a load's failure was told under, and the TUI had to know
its name to look past it.

The load span now encapsulates its own steps. The CLI's "load workspace: ."
and "load module: <ref>" encapsulate theirs, and "loading type definitions"
is internal: still encapsulating, so the type definition queries of a
caller with no span of its own, such as initializeCore, don't show.

Signed-off-by: Alex Suraci <[email protected]>
The breadcrumb to an error's origin knew the CLI's "loading type
definitions", the engine's "load module: " spans and a load's plumbing by
name. Now the spans carry what it needs (the load encapsulates its steps,
the CLI's type definition load is internal), and it reads only the
encapsulation: every shown ancestor that encapsulates its work is named, a
landmark for the work beneath it, and the steps between landmarks, and
between the innermost one and the origin, fold away. The ancestors above
the outermost landmark are named as before.

Goldens:
- a module's failed load reads "load module: <ref> › build <module> ›";
  a broken dependency's, its dependent's load and its own build;
- a Dang module's, "load module: <ref> ›" above its typecheck;
- the expanded goldens lose the "loading type definitions" row, and a
  failed load shows its build beneath it, without the engine's internal
  calls between them;
- broken-dep-sdk-use-invalid-default is new, the default view of a module
  whose dependency's SDK doesn't load.

Signed-off-by: Alex Suraci <[email protected]>
"loading type definitions" was internal, so beneath a caller that doesn't
encapsulate its work, such as the shell's start and `.refresh`, a failure's
breadcrumb named the queries' calls instead. loadTypeDefs now starts no
span: "load workspace: ." and "load module: <ref>" stand for it, and the
two callers with no span of their own start an encapsulating "loading type
definitions" one. `dagger listen`'s "load module: <ref>" encapsulates its
steps too, as initializeModule's does.

Also: say in passesOnFailure's doc which of the engine's steps a load's
encapsulation now passes through, and drop the "loading type definitions"
row from module-type-return-fail, a fuzzy golden no update rewrites.

Signed-off-by: Alex Suraci <[email protected]>
TestInternalFailureGivesPlaceToItsCause traced a module load that didn't
encapsulate its steps, under the CLI's "loading type definitions": a shape
no trace has since the load encapsulates them. With the real one, the
engine's internal load of a dependency gives its place to the dependency's
failed build, which the test now asserts, rather than that it shows.

Signed-off-by: Alex Suraci <[email protected]>
A dependency whose SDK failed to load showed only as "load SDK: unknown"
beneath its dependent's load, so nothing said which dependency it was. The
span now reads "load SDK for <module>: <sdk>", as a module SDK's steps name
the module ("build <module>"), and "load SDK: <sdk>" without one.

broken-dep-sdk/use-invalid and its -default show "load SDK for invalid:
unknown".

Signed-off-by: Alex Suraci <[email protected]>
With the module load's fixture now encapsulating, nothing tested that a
failed internal span beneath a shown step that doesn't encapsulate keeps
its row, though a failure is beneath it: removing that rule from
inFailedEncapsulation passed every test.

Signed-off-by: Alex Suraci <[email protected]>
@vito vito changed the title idtui: golden tests for external SDK errors core, idtui: readable errors from entrypoint SDK modules Nov 22, 2026
@vito
vito marked this pull request as ready for review November 22, 2026 20:26
vito added 3 commits November 22, 2026 21:42
The breadcrumb of an error origin beneath the row it bubbled up to moves
from idtui into dagui, so that Dagger Cloud's web UI names the same
ancestors the TUI does: TraceTree.ErrorCauseBreadcrumb walks a tree's
parents, Span.ErrorCauseBreadcrumb its parent spans, by the same rules.

Passthrough ancestors are left out too, as no frontend shows them as a row
of their own; the TUI's trees never held one outside debug mode.

For an origin the view doesn't place, idtui now walks its parent spans. The
synthetic tree it built instead linked its parents in reverse, the row
first, so that breadcrumb was always empty.

Signed-off-by: Alex Suraci <[email protected]>
Add viztest/sdks/ruby, a module of the external Ruby SDK (dagger/ruby-sdk at
754e000, its current main) with the functions every SDK fixture has, generated
from viztest/sdks/dagger.toml, and record its goldens as today's output.

Its entrypoint declares callDigest but marks no exec with
DAGGER_MODULE_CALL_DIGEST, so no exec is the module process: every failure
renders on the dispatcher's withExec, with its stdin and full stack trace, and
log-success's logs never reach the function's row (logsOnExec). The
broken-default baseline names the request's moduleSource ID, which varies
between runs; the target drops that row.

Signed-off-by: Alex Suraci <[email protected]>
Hand-edit the Ruby SDK's goldens to the output we want, the shapes the other
SDKs' approved goldens have: no dispatcher withExec on screen, the function's
logs on its row, a short trace in Ruby's own form through the module's own
frames only, nothing for an API error whose origin the engine shows, the
original failure as the origin, and Ruby's SyntaxError for a module that
doesn't parse, its first line as the error. log-success checks the function's
logs on its row again.

Signed-off-by: Alex Suraci <[email protected]>
vito added 3 commits November 22, 2026 23:33
Pin ruby-sdk to dagger/ruby-sdk#11 (6ba32f1) and regenerate the fixture: its
entrypoint marks the dispatcher's exec as the module process and declares
prebuild, and the dispatcher reports a function's error in the engine's file,
with a short trace of the module's own frames in Ruby's own form. Every
sdks-ruby golden now matches its target, unchanged.

Signed-off-by: Alex Suraci <[email protected]>
Pin ruby-sdk to c363132, whose dispatcher logs a SyntaxError exactly as ruby
prints it, syntax_suggest's section included, per the native-output rule. Only
sdks/ruby/broken-default changes: that section now precedes Ruby's error.

Signed-off-by: Alex Suraci <[email protected]>
The function error file holds exactly {"message", "values"} or {"id"}. Plain
text, malformed JSON, and anything else that isn't one of those objects, is
an SDK's bug, no longer the error's message: the call fails with an error
that names the invalid report and why, and the module process's own
failure, from the function call, with its ExecError's values, so its exit
code and output aren't lost. An empty or missing file still reports
nothing.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/java-sdk that referenced this pull request Nov 23, 2026
The engine no longer takes a report with an empty message for plain text:
it reads only a JSON report with a message or an Error ID, and rejects any
other as invalid (dagger/dagger#15249). Comments only.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/ruby-sdk that referenced this pull request Nov 23, 2026
The engine no longer takes a report with an empty message for plain text:
it reads only a JSON report with a message or an Error ID, and rejects any
other as invalid (dagger/dagger#15249). Comments only.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit to dagger/php-sdk that referenced this pull request Nov 23, 2026
The engine no longer takes a report with an empty message for plain text:
it reads only a JSON report with a message or an Error ID, and rejects any
other as invalid (dagger/dagger#15249). Comments only.

Signed-off-by: Alex Suraci <[email protected]>
Pin java-sdk to 96d3510, php-sdk to 5771a9b and ruby-sdk to 49d17cb, whose
comments now say the engine reads only a JSON function error report and
rejects one with an empty message. The vendored ModuleDispatcher.java (and
its checksum), FunctionError.php and error_report.rb follow them; comments
only, so the sdks-java, sdks-php and sdks-ruby goldens are unchanged.

Signed-off-by: Alex Suraci <[email protected]>
Use %w for the JSON syntax error so errorlint passes and callers can
unwrap it.

Signed-off-by: Alex Suraci <[email protected]>
eunomie pushed a commit to eunomie/go-sdk that referenced this pull request Nov 24, 2026
An engine that names a file for the function's error
(DAGGER_FUNCTION_ERROR_PATH, dagger/dagger#15249) now gets it there from
every dispatcher, whatever the module targets: {"message", "values"}, the
message in full with the origin it names, and the extensions of the GraphQL
error it wraps as they are, so a caller gets a typed ExecError with its exit
code and output. The dispatcher then prints nothing of its own; the report
is shortened only past the engine's 1 MiB limit. Without the variable, or a
file it can write, it falls back to the stderr markers older engines read.

The generated entrypoint raises a module process's exec error as it is, so
the engine's handling of it is never preempted by the marker parsing or the
Dagger Error rebuilt from the values marker.

Signed-off-by: Alex Suraci <[email protected]>
eunomie pushed a commit to eunomie/typescript-sdk that referenced this pull request Nov 24, 2026
A dispatcher under a module entrypoint replied on stdout, which the
function's own console.log shares: a function that logged and returned
failed with "JSON.decode: invalid JSON", and one that logged and threw lost
its message to "exit code: 2". A module that didn't compile failed the
process before the dispatcher ran, as "exit code: 1".

- The result goes to /dagger/result.json, named on the command line, which
  call() reads back once the exec succeeded.
- A failed call's error goes to the function error file the engine names in
  DAGGER_FUNCTION_ERROR_PATH (dagger/dagger#15249): the full message, origins
  kept, and the extensions of the API error it is or wraps, followed by exit
  code 2. call() raises the exec error unchanged when it carries the
  engine's functionError. An engine without the file gets a
  `::dagger-function-error::` marker on stderr, as go-sdk prints it.
- In error-file mode the call's logs get a short stack trace of the module's
  own frames only, causes included and traceparents stripped, and nothing
  for an API error whose origin the engine shows. A TransformError, the
  module failing to compile, is esbuild's own error lines, with its summary
  as the call's message.
- The module's code is imported for its types only and loaded with import()
  by loadModule, so a load or compile error is reported like any other.

There is no prebuild: tsx compiles at run time, so there is no build step to
show under `build <module>`.

Signed-off-by: Alex Suraci <[email protected]>
Pin the external SDKs to their releases, which merged the error-file PRs:
go-sdk v1.7.0, python-sdk v1.9.0, typescript-sdk v1.2.0, php-sdk v1.2.0,
java-sdk v1.3.0 and ruby-sdk v1.3.0.

Regenerated with them: go-sdk no longer generates a module's bindings to
itself (viztest-go.gen.go, sdk-dep.gen.go) and its entrypoints say they need
beta.26; python-sdk's build takes uv 0.13.9; typescript-sdk's entrypoint
keys its install by content and runs its setup execs without nesting. The
java, php and ruby tags match their old pins. The sdks-* goldens are
unchanged.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the viztest-external-sdks branch from d73fd8d to 4ab628f Compare November 24, 2026 16:35
@vito
vito merged commit 6798d82 into main Nov 24, 2026
76 checks passed
@vito
vito deleted the viztest-external-sdks branch November 24, 2026 17:50
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