feat(dev-tooling): add console_run output_file and arbitrary envs - #171
Merged
Martin Bens (SpiGAndromeda) merged 1 commit intoSep 3, 2026
Merged
Conversation
The php-tooling console_run tool gains an optional output_file parameter. The command's stdout streams host-side into a mktemp sibling that is renamed onto the target only after a zero exit, and the response carries the resolved path, the byte count and the exit status plus the noise-filtered stderr instead of the payload. This keeps unbounded console dumps such as debug:container and debug:router out of model context. A failed command returns its stdout in the response as diagnostics and leaves an existing target untouched. A target that exists as a symlink or a non-regular file is refused, as is a value over 4096 bytes.
The env parameter sheds its dev/prod/test enum for the pattern ^[A-Za-z0-9_]{1,32}$, since Symfony environments are arbitrary names and bin/console reads --env from argv before booting the kernel. The length bound sits inside the pattern because the vendored validator enforces pattern but not maxLength. Runtime behavior of env is unchanged.
The capture path builds on wrap_command directly instead of exec_command, which merges stdout and stderr with 2>&1. The noise filter applies to the separated stderr only. Calls without output_file still run through exec_command unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent Skills ExportBuilt 7 skill packages: |
Martin Bens (SpiGAndromeda)
deleted the
feat/dev-tooling-console-output-file
branch
September 4, 2026 09:37
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.
console_runon thephp-toolingserver gains file-captured output and loses its environment allowlist, so an env-scoped console dump —debug:containerwith--env=test, say — can land on disk instead of in the response. Unbounded command output stays out of the conversation entirely.dev-toolinggoes 3.18.0 to 3.19.0.output_fileWhen the new optional parameter is present, the command's stdout streams host-side into a
mktempsibling that is renamed onto the target only after a zero exit, and the response carries a summary instead of the payload: the resolved path, the byte count, the exit status, and the noise-filtered stderr. A failed command leaves an existing target untouched and returns its stdout in the response, since a failed command's output is diagnostic rather than payload. A target that exists as a symlink or a non-regular file is refused, as is a value over 4096 bytes. A relative path resolves against the project root, a leading-is normalized with./, and parent directories are created.The capture path builds on
wrap_commanddirectly rather thanexec_command, which merges stdout and stderr with2>&1— the template-synced layer is untouched, and calls withoutoutput_filestill run throughexec_commandunchanged. The eval runs in a subshell so anexitreached inside the wrapped command ends the capture rather than the server; reproduced without the subshell as a killed server and an orphaned temp file.envThe schema constraint widens from the
dev/prod/testenum to^[A-Za-z0-9_]{1,32}$, because Symfony environments are arbitrary names. Shopware'sbin/consolereads--envfrom argv before booting the kernel, so the value selects the environment in every wrapped environment type without anyAPP_ENVhandling. The length bound lives inside the pattern because the vendored validator enforcespatternbut notmaxLength. The runtime path is unchanged, including the.console.envconfig default.Limits
The console suite grows to 54 BATS tests (606 across the repository), including four that call the vendored validator directly to pin the pattern's accept and reject directions. The harness stubs execution, so only the
nativeenvironment ran the capture path end to end; the container wrappers are asserted on their constructed command lines, and the claim that they deliver container stdout to the host is taken from their existing behavior rather than re-measured. A TOCTOU window between the symlink check and the rename remains open.