fix: give init the working directory instead of the current one - #36
Merged
Conversation
Restores the typed class constant in EnvironmentDetector that had to be reverted under 8.2, and marks the redacting decorators' overrides with #[Override]. The attribute is not decoration here: a masking leak found earlier today was exactly a method that no longer matched its parent - ConsoleSectionOutput's decorated overwrite() path bypassed write() and writeln(), and nothing failed. With #[Override], a renamed or resignatured Symfony method is a fatal error at load time instead of output that quietly stops being redacted. Verified by renaming one override and watching the class refuse to load. Deliberately not included: typing every existing constant, which would be a style sweep with no analytical gain, and rewriting withFormatter() as a clone - 8.3 permits reinitialising readonly properties only inside __clone(), which cannot receive the new value, so the current constructor call stays correct.
The release workflow's smoke test runs `init --working-dir="$dir"` and then a task from that directory. It never worked: InitCommand resolved its target with getcwd(), so the scaffold landed in the caller's directory while $dir stayed empty, and the task run failed with "Command example is not defined". `git tag --contains` shows the smoke test was added after 0.1.0, so it has never executed - the 0.2.0 tag would have been its first run, and it would have failed after the tag was already public. Two changes, one cause: - InitCommand takes its target directory, and Kernel passes the working directory it already resolved. The getcwd() guard is not lost, it stays in Kernel::__construct where the resolution actually happens. - The PHAR is now built and smoke-tested on every pull request, so a tag can no longer be the first execution of that path. Both workflows call one script, which also covers what the old inline steps did not: argv survival (an argument containing a semicolon) and secret masking, neither of which a unit test can observe from inside the archive. The existing tests missed this because they chdir() into the temp directory, making the target and the cwd the same path. They now pass the target explicitly, and two regression tests run from a directory that must stay empty - one against InitCommand, one through Kernel, since only the second covers the wiring. Also runs `mkdocs build --strict` on pull requests, so a broken docs build stops being something main finds out about after the merge.
tests/E2E asserts against build/sputnik.phar and marks itself skipped when the archive is absent, which it always was in CI - eight tests that have never run. The PHAR job now restores the dev dependencies after the build and runs the suite, so those assertions are part of the gate rather than a local-only habit.
This was referenced Aug 19, 2026
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.
The 0.2.0 tag would have failed its own release workflow. I built the PHAR locally to check the release path before tagging, and the smoke test broke immediately.
What is broken
release.ymlsmoke-tests the PHAR like this:InitCommandresolved its target withgetcwd(), so the scaffold landed in the caller's directory - in CI that is the checkout root - while$dirreceived only.sputnik/(the container cache, which does honour the working directory). The second command then failed:git tag --containson the commit that added the smoke test returns nothing: it came after 0.1.0, so it has never run. The 0.2.0 tag would have been its first execution, failing after the tag was already public.The bug is not limited to CI -
--working-diris documented as "all paths are resolved relative to this directory" (docs/cli.md:27), and forinitthat was simply false. Runningsputnik --working-dir=/some/project initscaffolded into the wrong place.The fix
InitCommandreceives its target directory;Kernelpasses the working directory it has already resolved.The
getcwd()guard is not dropped - it stays inKernel::__construct, unchanged, where the resolution actually happens. It now exists once instead of twice.Why the tests did not catch it
Every
InitCommandTestcasechdir()s into its temp directory, which makes target and cwd the same path - the exact condition under which the bug is invisible. They now pass the target explicitly, plus two regression tests that run from a directory which must stay empty:InitCommanddirectly,Kernel::createApplication().Both are needed: I mutated
Kernelback tonew InitCommand((string) getcwd())and the direct test still passed - it bypasses the wiring. Only the Kernel test failed. That mutation is why the second test exists.The gate itself
Two holes, same shape: assertions that only ever ran somewhere else.
1. The PHAR is now built and smoke-tested on every pull request, so a tag can no longer be the first time that path executes. Both workflows call one script (
.github/scripts/smoke-phar.sh) instead of duplicating inline steps, and it covers what the old steps did not:;must arrive whole; a shell would have split it. This is the container host-leak defect from feat!: run commands as argv instead of through a shell #30 as a regression test on the real binary.variables.secretsvalue must appear as***on the echoed command line, in the program's output, and in a message the task writes itself, and the raw value must appear nowhere.executor: "ddev exec {command}"string form.Proof the assertions bite: I disabled the
RedactingConsoleOutputwrapper inbin/sputnik, rebuilt, and the script exited 1 with the raw secret visible in the log. Reverted, exit 0.2.
tests/E2Enow runs in CI. It asserts againstbuild/sputnik.pharand marks itself skipped when the archive is absent - which it always was, so eight tests have never executed anywhere but a developer's machine. The PHAR job restores the dev dependencies after the build (the archive must not contain them) and runs the suite: 45 tests, 107 assertions, green locally.mkdocs build --strictnow also runs on pull requests, so a broken docs build is no longer somethingmaindiscovers after the merge. Deployment stays push-only, and thepagesconcurrency group moved to the deploy job so a docs PR cannot cancel a live deploy.Verified
CI on the first commit was green on all eight jobs, including the new PHAR one.
🤖 Generated with Claude Code
https://claude.ai/code/session_018CTvnzcNYmFgm2HQcm821A