[codex] Redirect dependency commands into Docker#5
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends empaphy/docker-composer so dependency-affecting Composer commands (e.g., install, update) are executed inside the configured Docker Compose service, ensuring dependency resolution and platform checks match the container environment.
Changes:
- Add a
pre-command-runlistener to redirect key dependency commands into Docker Compose before host execution. - Add command-building support to replay raw Composer argv inside the container while stripping host-only
--working-dir/-dtokens. - Update docs and add unit + integration coverage for command redirection and token recovery across Symfony Console versions.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/DockerComposerPlugin.php |
Registers a command listener and redirects selected dependency commands into Docker Compose. |
src/DockerComposeCommandBuilder.php |
Builds docker compose exec/run commands for Composer commands, replays raw argv, strips host working-dir flags. |
tests/Unit/DockerComposerPluginTest.php |
Adds unit coverage for command redirection paths and fall-through scenarios. |
tests/Unit/DockerComposeCommandBuilderTest.php |
Adds coverage for raw token recovery + working-dir stripping behavior. |
tests/Integration/DockerComposerIntegrationTest.php |
Adds integration assertion that composer install redirects when plugin is installed. |
tests/Unit/Mocks/LegacyTokenInput.php |
Test helper to emulate legacy/raw token storage behavior. |
tests/Unit/Mocks/InvalidLegacyTokenInput.php |
Test helper to validate rejection of malformed legacy token payloads. |
README.md |
Documents expanded scope to include dependency commands. |
AGENTS.md |
Minor wording/formatting adjustments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
22d5cbc to
60bfebc
Compare
fb9ffcd to
2ccf5f4
Compare
Run dependency-affecting Composer commands in the configured Docker Compose service before host Composer begins solving or installing. This preserves container platform requirements for install, update, require, remove, and reinstall while keeping existing script redirection behavior.
Recover raw Composer command tokens from legacy Symfony Console input storage when getRawTokens is unavailable. This keeps dependency command redirection compatible with older Composer and Symfony versions used by CI while preserving argument replay semantics.
Avoid assuming Unix shell quoting in the Docker command failure assertion. Windows CI escapes command output differently, so the test now verifies the command terms without depending on quote style.
Add unit coverage for Composer command argument replay fallbacks, working-dir stripping, command fallthrough guards, and service-mapping command redirects. This protects the Docker dependency-command redirect behavior and raises the reported line coverage on the affected files.
Add targeted coverage for malformed legacy command tokens, command fallthrough without configuration, and lazy command runner creation. This brings the affected Docker command redirect files to 100% line coverage and removes an unreachable notice guard now proven by onCommand control flow.
2ccf5f4 to
645d355
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .idea/docker-composer.iml: Language not supported
- .idea/php.xml: Language not supported
- .idea/runConfigurations/Unit_Tests.xml: Language not supported
Move legacy input test helpers into dedicated mock files so the command builder test declares only its test case. Keeps behavior unchanged while addressing PR feedback about mixed file responsibilities.
Only register the dependency command listener when the Composer pre-command event API is available. Also clarifies missing-service warnings for Composer commands so output no longer describes them as scripts.
Add a Symfony-style raw token input double and unit coverage for Composer command replay through getRawTokens(). This addresses PR feedback and protects command token replacement plus host working-directory stripping for current Symfony Console inputs.
645d355 to
cd263a1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- .idea/docker-composer.iml: Language not supported
- .idea/php.xml: Language not supported
- .idea/runConfigurations/Unit_Tests.xml: Language not supported
Code Coverage Summary (ubuntu)
|
Code Coverage Summary (windows)
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 19 changed files in this pull request and generated no new comments.
Files not reviewed (3)
- .idea/docker-composer.iml: Language not supported
- .idea/php.xml: Language not supported
- .idea/runConfigurations/Unit_Tests.xml: Language not supported
Summary
Root Cause
Composer script events were redirected, but dependency commands such as
composer installstill ran on the host. That meant dependency resolution and platform requirement checks used the host PHP environment instead of the configured container.Impact
install,update,require,remove, andreinstallnow execute inside the target Docker Compose service when docker-composer is enabled. Existing script redirection, disable flags, inside-container bypass, exclusions, and service mapping behavior remain in place.Validation
composer style-fixcomposer stancomposer test