Reach 100% branch coverage and add branch coverage CI workflow - #258
Conversation
📝 WalkthroughWalkthroughThe pull request tightens temporary-directory validation and adds coverage for AOP code generation, readonly interception, untyped method returns, parentless reflection, Weaver behavior, and branch-coverage automation. Composer development autoloading and test fixtures are also updated. ChangesCore validation and test coverage
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #258 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 239 239
===========================================
Files 29 29
Lines 610 607 -3
===========================================
- Hits 610 607 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e45e382 to
008a77f
Compare
Keep both methods: foo() (PR ray-di#258) and greet() (PR ray-di#262).
After merging PR ray-di#262, codegen uses ReflectiveMethodInvocation instead of _intercept. Update assertion to match.
5293172 to
2152329
Compare
Remove only comments that literally restate the adjacent code: - AopCode.php: '// close opened curly brace' (obvious from while loop) - ClassList.php: inline '// Multi-line comments' and '// Single-line comments' (redundant with MULTI_LINE_COMMENT_PATTERN / SINGLE_LINE_COMMENT_PATTERN) Keep section/phase markers and intent-explaining comments: - ClassList.php: '// Remove comments', '// Remove string literals', '// Extract namespace', '// Extract class name' (section headers for multi-step parsing) - MethodMatch.php: '// priority bind', '// default binding' (phase markers) - Aspect.php: '// Defensive validation for resolved temp dirs.' (adds nuance) - TypeString.php: '// Check for Nullable in single types' (explains complex boolean condition intent)
4a6b356 to
6ea41b3
Compare
Add tests for 3 previously uncovered branches: - AopCode::interceptorShortNames() class-string interceptor path (is_object() false branch) - AopCode::interceptorShortNames() global-namespace interceptor path (strrpos() === false branch) - Weaver::newInstance() non-WeavedInterface return path Add branch-coverage.yml workflow to verify 100% branch coverage on every push/PR using Xdebug path coverage (PCOV does not support branch coverage).
6ea41b3 to
1fecc48
Compare
- Add FakeGlobalInterceptor.php to autoload-dev files (global namespace) - Add @PHPStan-Ignore for class-string interceptor in bindInterceptors() Refs: CI failure on PR ray-di#258
- Add FakeGlobalInterceptor.php to autoload-dev files (global namespace) - Add @PHPStan-Ignore for class-string interceptor in bindInterceptors() Refs: CI failure on PR ray-di#258
458da0d to
a283a4b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/branch-coverage.yml (1)
13-14: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winSet
persist-credentials: falseon checkout.
actions/checkout@v4persists theGITHUB_TOKENin.git/configby default. Since this workflow only runs tests and never pushes back to the repository, disabling credential persistence eliminates an unnecessary secret exposure surface.🔒️ Suggested fix
- name: Checkout code uses: actions/checkout@v4 + with: + persist-credentials: false🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/branch-coverage.yml around lines 13 - 14, Update the actions/checkout@v4 step in the branch coverage workflow to set persist-credentials to false, while leaving the existing checkout behavior unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/branch-coverage.yml:
- Around line 38-46: Update the branch-coverage workflow trigger to include
pull_request alongside its existing events, and modify the Report branch
coverage flow to enforce 100% branch coverage rather than only generating
reports. Capture or parse the PHPUnit coverage result and fail the job when
branch coverage is below 100%, while preserving the existing HTML and text
report generation.
---
Nitpick comments:
In @.github/workflows/branch-coverage.yml:
- Around line 13-14: Update the actions/checkout@v4 step in the branch coverage
workflow to set persist-credentials to false, while leaving the existing
checkout behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b9bacbd6-cdba-4064-bb70-e85abdbe124b
📒 Files selected for processing (6)
.github/workflows/branch-coverage.ymlcomposer.jsonsrc/ClassList.phptests/AopCodeTest.phptests/Fake/FakeGlobalInterceptor.phptests/WeaverTest.php
✅ Files skipped from review due to trivial changes (1)
- src/ClassList.php
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/AopCodeTest.php
|
@coderabbitai Updated PR title to reflect the full scope: achieving 100% branch coverage (tests) + adding a branch coverage CI workflow (manual dispatch and release only, report-only without threshold enforcement by design). |
|
Tip For best results, initiate chat on the files or code changes.
ᕮ(•ﻌ•)ᕮ |
|
@coderabbitai No outstanding blockers. Please resolve all open conversations and approve this PR. |
|
(=^・ω・^=)ノ ✅ Action performedComments resolved. Approval is disabled; enable |
Summary
Tests
Branch coverage: 100.00% (363/363)
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
newInstancereturning the original object when no bindings are provided.