Repository navigation
Conversation
sdk-helpers v1.0.9 no longer compiles under current Dang: its
main.dang:147 writes a nullable type pattern in a rescue arm, which
is now rejected ("a type pattern is the non-null type its arm binds:
write `error: Error! =>`"). Every php-sdk generation fails on it.
v1.0.11, which go-sdk already uses, fixes it.
Signed-off-by: Alex Suraci <alex@dagger.io>
On an engine that sets DAGGER_FUNCTION_ERROR_PATH (dagger/dagger#15249), a failed call writes {"message", "values"} there and exits 2: the message in full, with its [traceparent:…] origins, and the values the extensions of the QueryError it is or wraps, so a caller gets a typed ExecError. The generated entrypoint raises the exec error unchanged when it carries the engine's functionError. Older engines, or a file that can't be written, get the full trace plus a ::dagger-function-error:: marker line on stderr, which the entrypoint reads; without one, as when the function exits by itself, the exec's own error, exit code and all, is raised. Before, the entrypoint raised the dispatcher's whole stderr as the message, and a call exited with the inner exec's code. In error-file mode the function's logs get only a short trace, through the module's own frames (not the SDK's, its generated clients' or vendor/'s), previous errors first, without origins; a file that doesn't parse reads as PHP reports it. An API error whose origin the engine shows prints nothing. The entrypoint also declares prebuild, the module with its Composer dependencies installed, so the engine builds it as the module's build and a failed install shows under it with Composer's output; call() syncs it before the rescue for the same reason. Signed-off-by: Alex Suraci <alex@dagger.io>
From review. On an engine without the function error file, which is every released one: - the marker fallback writes a failed exec's stdout and stderr, which the error is or wraps, to the dispatcher's own streams again, as before; - a dispatcher exec that failed without a marker, such as a function that exits, raises the exec's stderr as before, unless the engine marks the module process (moduleProcess), which then shows the exec's logs and exit code with its error; - so does a failed Composer install, which such an engine doesn't build as prebuild ahead of the call. A fatal error (exhausted memory, a class that can't be declared) ends the script with no Throwable to catch: a shutdown function now reports it in the file, or with the marker. PHP shows the error itself. Signed-off-by: Alex Suraci <alex@dagger.io>
vito
added a commit
to dagger/dagger
that referenced
this pull request
Nov 22, 2026
dagger/php-sdk#49's review fixes, for engines without the function error file and for PHP's fatal errors. No golden changes: all 17 sdks-php goldens pass. Signed-off-by: Alex Suraci <alex@dagger.io>
From review. The shutdown handler that reports a fatal error had no memory left after the commonest one, exhausted memory: autoloading FunctionError there failed a second time. FunctionError is now made, and the error path read, before the function runs, and the handler frees 256 KiB it reserved first. Taking the module root up front also keeps a function's chdir() from moving where vendor/ is looked for. Signed-off-by: Alex Suraci <alex@dagger.io>
From review. Exhausting memory with a growing array leaves the shutdown function enough memory without the reserve, so that test passed without it. Exhausting it by deep recursion does not: that case fails with a reserve of 0, so it now covers the reserve, beside the array case. Signed-off-by: Alex Suraci <alex@dagger.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on dagger/dagger#15249, which adds the engine's function error file (
DAGGER_FUNCTION_ERROR_PATH) and the golden tests this is checked against (dagql/idtui,sdks-php-*). The PHP counterpart of dagger/go-sdk#113, dagger/python-sdk#93, dagger/java-sdk#47 and dagger/typescript-sdk#144.This branch includes #48 (sdk-helpers v1.0.9 → v1.0.11), which is still open: nothing generates without it. Merge #48 first, or this along with it.
What users saw
Under a module entrypoint:
CallDispatcherandReflectionMethod;exit(3)failed with the messagephp function stderr(its last stderr line), and its exit code was lost;withExecfailed echoed the inner exec's stdout and stderr onto the function's row and exited with the inner code, rather than the caller getting a typed exec error.What changes
DAGGER_FUNCTION_ERROR_PATH, a failed call writes{"message", "values"}there and exits 2 (newDagger\Module\FunctionError). The message is complete, with its[traceparent:…]origins. The values are the extensions of theQueryErrorthe error is or wraps (throughgetPrevious()), so a caller gets a typed ExecError, exit code and output included. The generatedcall()raises the exec error unchanged when it carries the engine'sfunctionError.vendor/, in PHP's own form (RuntimeException: … in src/Foo.php:44,Stack trace:, previous errors first withNext). A module file that doesn't parse readsPHP Parse error: … on line N, as PHP prints it. An API error whose origin the engine already shows prints nothing.prebuild. The entrypoint declaresprebuild: the module with its Composer dependencies installed. The engine builds it ahead of the call, asbuild <module>, so a failedcomposer installshows there with Composer's own output.::dagger-function-error::marker line on stderr, whichcall()reads, plus the failed exec's output echoed as before. Without a marker (a function that exits, or a failed install),call()raises the exec's stderr unless the engine marks the module process.Not changed (deferred)
Container.from(address: "alpine", version: "", …)), so calls render with all of them.Testing
FunctionErrorTest,DangEntrypointRendererTest), PHPStan and PHPCS:dagger check e2e/sdk-unit-check e2e/sdk-analysis-check e2e/sdk-style-check.TestTelemetry/TestGolden/sdks-php-*goldens all pass against this branch.