Repository navigation
fix: avoid implicit consumer autoload in ECS checks - #55
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Worker protocol and execution bin/ecs-worker, README.md, docs/architecture.md, docs/automation.md, .changelog/isolated-formatter-bootstrap.md |
The worker validates its arguments and paths, loads supplied autoloaders, and runs ECS’s native check command. Documentation describes the worker’s bootstrap behavior and the preserved consumer working directory and configuration context. |
Runner path resolution and command wiring src/ServiceProvider/StandardsServiceProvider.php, src/Standards/StandardsRunner.php |
The provider resolves and validates the ECS engine directory. The runner invokes the worker for check and fix modes and runs a check after fixing. |
Bootstrap behavior and integration coverage tests/Fixtures/*, tests/Integration/EcsBootstrapTest.php, tests/Standards/StandardsRunnerTest.php |
Fixtures and tests cover default and explicit consumer bootstrap, check and fix behavior, configuration errors, packaged worker execution, Composer binary proxies, and runner status handling. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant StandardsRunner
participant ECSWorker
participant ComposerAutoloaders
participant ECSContainerFactory
participant CheckCommand
StandardsRunner->>ECSWorker: worker paths, config, mode, source paths
ECSWorker->>ComposerAutoloaders: load supplied autoloaders
ECSWorker->>ECSContainerFactory: create container with config
ECSWorker->>CheckCommand: run with mode and selected files
CheckCommand->>ECSWorker: return command status
Possibly related issues
php-fast-forward/code-standards#1— The PR implements ECS execution behavior through the standalone package’s worker and public APIs.php-fast-forward/dev-tools#240— The PR advances the ECS implementation in the Code Standards domain without changing the orchestration boundary.php-fast-forward/dev-tools#197— The packaged worker separates ECS bootstrap from implicit consumer autoloading.php-fast-forward/code-standards#2— The PR tests worker inclusion in a Composer archive, while the issue’s broader fresh-install and compatibility scope may remain.php-fast-forward/code-standards#24— The runner retains a check after fix operations, as described by the issue.
Merge Risk: 
Minimal · up to c932b
-
No actionable issue is identified from the supplied changes; normal validation can proceed before merging.
Pre-merge checks: 
5
-
Check name Status Explanation Title check The title concisely and accurately identifies the main change: preventing implicit loading of the consumer autoloader during ECS checks. Linked Issues check Objective [ #54]: the default isolated ECS path must not import the consumer vendor/autoload.php. Evidence at head c932b2b: bin/ecs-worker does not run the ECS CLI bootstrap. It requires only this tool…Out of Scope Changes check Every changed area maps to the objective of [ #54] or supports it. bin/ecs-worker is the new internal worker and implements the isolated check/fix path. src/Standards/StandardsRunner.php and its test (…Docstring Coverage Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Description check The pull request description directly explains the ECS bootstrap, worker, autoload, configuration, cache, path, and validation changes reflected in the changeset. Full details: Linked Issues check
-
Explanation
Objective [
#54]: the default isolated ECS path must not import the consumer vendor/autoload.php. Evidence at head c932b2b: bin/ecs-worker does not run the ECS CLI bootstrap. It requires only this tool's Composer autoloader ($autoload) and the installed PHP_CodeSniffer autoloader under the resolved engine directory. It then calls EasyCodingStandardContainerFactory::createFromArgv and CheckCommand::run directly. src/Standards/StandardsRunner.php now builds the process command as [PHP_BINARY, worker, autoload, engine, config, --check|--fix, '--', ...files]. Dry-run and exit behavior are kept: the check run follows a fix run, the first nonzero status is returned, and the worker returns the command status. The engine path is resolved in StandardsServiceProvider's constructor, before user configuration runs. Configuration paths are passed as absolute values and the worker rejects non-absolute paths. Objective [#54]: native configuration semantics are retained. The worker runs with the consumer cwd and passes --config to the native factory. No blanket chdir or vendor patch is used. Objective [#54]: explicit consumer bootstrap is an opt-in boundary. tests/Fixtures/explicit-bootstrap-config.php.inc and the docs describe this boundary. Objective [#54]: tests. tests/Integration/EcsBootstrapTest.php covers tracked and ignored autoload sentinels, default check/fix, explicit configuration and context, cache invalidation, error exit codes, worker protocol rejection, archive inclusion, and the Composer binary-proxy path. The test names do not name an explicit no-source or lock-mutation assertion, and the test file body was not read. Lock-mutation coverage is therefore taken from the PR description and the context fixture, not confirmed in the test body. Core implementation requirements are supported by source evidence.
Full details: Out of Scope Changes check
-
Explanation
Every changed area maps to the objective of [
#54] or supports it. bin/ecs-worker is the new internal worker and implements the isolated check/fix path. src/Standards/StandardsRunner.php and its test (constructor and argument change) route formatting through the worker. src/ServiceProvider/StandardsServiceProvider.php captures the engine directory and worker and autoload paths; this change is required by the new runner constructor. tests/Fixtures/BootstrapFixer.php.inc and tests/Fixtures/explicit-bootstrap-config.php.inc are test fixtures for sentinel and explicit-configuration cases. tests/Integration/EcsBootstrapTest.php is the requested regression suite. README.md, docs/architecture.md, docs/automation.md and the .changelog entry document the new bootstrap contract and the preserved Composer proxy behavior. No unrelated consumer formatting, semantic refactor, or release change was found in the summarized changes. Whole-PR file coverage was taken from the supplied summary, not from a complete diff read.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 23 functions across 4 files. (7 skipped: 7 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the paths at night
The worker keeps the bootstraps right
A fixer turns each marker new
Then checks the files once more through
The carrots wait; the checks are done
Comment @coderabbitai help to get the list of available commands.
Changelog✅ Contribution check passed. Head: Base: Contribution: 1 new valid fragment(s). Policy: ordinary.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Closes #54.
ECS's CLI bootstrap loads the working directory's vendor/autoload.php even when the formatter uses a separate tool installation. Run the native public ECS factory/check command through a packaged internal worker instead, retaining the consumer cwd, native configuration/cache, selected absolute arguments and explicit custom-checker bootstrap. Capture installation paths before executable configuration can change Composer's installed-package metadata. The ordinary Composer binary-proxy bootstrap remains intentional when the tool shares the consumer installation; explicit PHP configuration remains trusted executable code.
Validation: 85 tests / 627 assertions, Composer strict/platform, syntax of 29 PHP entrypoints/files, PER, actionlint and fragments passed. Focused regressions cover tracked/ignored application autoload sentinels, check/fix/post-verification, spaces/tabs/newlines, explicit custom checkers, cwd/relative metadata, cache invalidation, exit codes, Composer proxy and packaged worker. The actual worker also passed an ECS 13.3.11 smoke check/fix/verification and config-error case; contributor lock uses 13.3.8. Independent review approved final 9b8d27e after preserving main 9cf4af3 and the concurrent remote merge. Each || in the multiline provider guard is now on its own line; the formatter accepts and preserves the requested layout. Current-HEAD hosted CI and external reviews remain pending. No consumer formatting, semantic refactoring or release is included.
Refs #58 for the separate enforcement-policy gap: the installed preset also accepts the previous mixed layout. This PR's local whitespace correction does not implement a new rule or claim PER already prohibits it.