Skip to content

fix: run tests for autoload.files packages - #391

Merged
coisa merged 2 commits into
mainfrom
fix/audit-source-detection
Oct 24, 2026
Merged

coisa merged 2 commits into
mainfrom
fix/audit-source-detection

Conversation

@coisa

@coisa coisa commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Related Issue

Closes #377

Changes

  • Include Composer autoload.files in testable PHP source detection without adding fake API directories or changing Wiki discovery.
  • Add resolver regressions for function-only, missing and non-PHP files.
  • Exercise the real resolver with temporary source files through tests/coverage orchestration: PHPUnit is queued, its failure propagates, and reports enqueue coverage.

Verification

  • PHP 8.4.26 lint: all four changed PHP files passed.
  • Focused real-resolver fixture RED → GREEN: hasTests=true, hasPhpSource=false, canRunTests=false before; all true after.
  • git diff --check passed; independent test-guardian review completed.
  • Full composer dev-tools/PHPUnit not run locally: package dependencies unavailable, prior dependency-download denial respected. Hosted CI must validate the added PHPUnit cases. The local recording-queue tests do not claim a full child-PHPUnit consumer execution.

Documentation / Generated Output

No generated files or command syntax changed; existing source detection documentation remains applicable.

Changelog

Added .changelog/autoload-files-testability.md (fixed/patch).

Reviewer Notes

Based on main e81c460, preserving #389/#390. No merge/release or PR #376 changes.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0381fee2-6c20-46ff-9b53-5b8745f8ed1b
📥 Commits

Reviewing files that changed from the base of the PR and between f1cf466 and 903156f.

📒 Files selected for processing: 5
  • .changelog/autoload-files-testability.md
  • src/Project/ProjectCapabilitiesResolver.php
  • tests/Console/Command/ReportsCommandTest.php
  • tests/Console/Command/TestsCommandTest.php
  • tests/Project/ProjectCapabilitiesResolverTest.php

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bc205e86-49a7-4a21-9500-2d278e858eb5
📥 Commits

Reviewing files that changed from the base of the PR and between e81c460 and f1cf466.

📒 Files selected for processing: 5
  • .changelog/autoload-files-testability.md
  • src/Project/ProjectCapabilitiesResolver.php
  • tests/Console/Command/ReportsCommandTest.php
  • tests/Console/Command/TestsCommandTest.php
  • tests/Project/ProjectCapabilitiesResolverTest.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features

    • Projects containing PHP files registered through Composer autoloading are now recognized as having PHP source.
    • Test execution, coverage collection, and report generation now work for packages without class-based API directories.
  • Bug Fixes

    • Missing or non-PHP autoload entries no longer incorrectly enable test execution.
    • Test failures in files-only packages are correctly reported.

The project capability resolver now detects PHP source declared in Composer autoload.files. Resolver and command tests cover test execution, failure propagation, and coverage reporting for files-only packages.

Changes: Composer Files Autoload Testability

Layer / File(s) Summary
Detect files-autoloaded PHP source
src/Project/ProjectCapabilitiesResolver.php, tests/Project/ProjectCapabilitiesResolverTest.php, .changelog/autoload-files-testability.md
The resolver checks Composer files entries when detecting PHP source. Tests cover valid PHP entries, missing or non-PHP entries, and the separation from API documentation discovery.
Verify test and coverage command behavior
tests/Console/Command/TestsCommandTest.php, tests/Console/Command/ReportsCommandTest.php
Command tests cover PHPUnit failure propagation and report generation for files-only packages.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • #380: The change affects the capability result that determines whether PHPUnit and coverage orchestration run for files-only projects.

Suggested reviewers: php-fast-forward

Merge Risk: 🔵 Low · up to f1cf4

Function-only Composer packages are now treated as testable, so their tests run and failures propagate. When coverage is requested, the command does not add a coverage filter for autoload.files paths, so the report may omit those files unless the project's PHPUnit configuration already defines a source. This is a bounded follow-up and does not need to block the merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly describes the main change: enabling tests for packages that use Composer autoload.files.
Description check Passed The description covers the issue, changes, verification, documentation, changelog, and reviewer notes. It omits the required Motivation / Context heading and does not use the template checkboxes, but …
Linked Issues check Passed Issue #377 is addressed. ProjectCapabilitiesResolver::resolveHasPhpSourceFiles() checks Composer files entries while API_AUTOLOAD_TYPES remains limited to psr-4, psr-0, and classmap. The r…
Out of Scope Changes check Passed The changes stay within issue #377. The resolver change supports testability without changing API or Wiki discovery. The added tests exercise resolver, test command, and report orchestration behavior …
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (1 skipped: 1 …
Full details: Description check

Explanation

The description covers the issue, changes, verification, documentation, changelog, and reviewer notes. It omits the required Motivation / Context heading and does not use the template checkboxes, but it provides the relevant motivation and verification details. The description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #377 is addressed. ProjectCapabilitiesResolver::resolveHasPhpSourceFiles() checks Composer files entries while API_AUTOLOAD_TYPES remains limited to psr-4, psr-0, and classmap. The resolver tests cover valid, missing, and non-PHP file entries. The files-only resolver test verifies test execution capability and no API directories. TestsCommandTest covers PHPUnit failure propagation. ReportsCommandTest covers coverage execution and report queueing. Existing guide-only and PSR/classmap behavior remains covered.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #377. The resolver change supports testability without changing API or Wiki discovery. The added tests exercise resolver, test command, and report orchestration behavior required by the issue. The changelog entry documents the fix. No unrelated merge, release, extraction, or architecture changes are shown.

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. Analyzed 9 functions across 4 files. (1 skipped: 1 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.

❤️ Share

A rabbit checks the source list twice,
Where Composer files hold functions nice.
Tests now run and failures show,
Reports follow where test results go.
The carrot hops beside the flow.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T01:14:52.389776Z — New commits
🔒 Security Review ✅ Completed 2026-10-22T01:16:25.117692Z 903156f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Changelog

✅ Contribution check passed.

Head: 903156fb6e5c29eb72404e35a6610f0d2f5970a3

Base: 2d98b607bf832a82035ddcae3d689aef72842111

Contribution: 1 new valid fragment(s). Policy: ordinary.

  • autoload-files-testability.md — fixed, patch

    Detect PHP sources declared in Composer `autoload.files` so function-only packages run tests and coverage reporting instead of silently skipping them, without changing API documentation discovery.

@github-actions

Copy link
Copy Markdown
Contributor

coisa commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coisa
coisa merged commit 84e1540 into main Oct 24, 2026
45 checks passed
@coisa
coisa deleted the fix/audit-source-detection branch October 24, 2026 03:13
@github-project-automation github-project-automation Bot moved this from Backlog to Released in PHP Fast Forward Project Oct 24, 2026
github-actions Bot added a commit that referenced this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

Run tests for packages whose PHP source uses autoload.files

1 participant