Uh oh!
There was an error while loading. Please reload this page.
Fix #752: Allow access to sibling properties in nested context - #791
Fix #752: Allow access to sibling properties in nested context#791WarLikeLaux wants to merge 12 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #791 +/- ##
============================================
+ Coverage 94.40% 96.30% +1.90% - Complexity 953 1157 +204
============================================
Files 108 124 +16 Lines 3018 3549 +531 ============================================
+ Hits 2849 3418 +569 + Misses 169 131 -38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes nested validation context scoping so when callbacks in nested rules can access sibling properties (e.g., isEnabled when validating content) via ValidationContext::getDataSet().
Changes:
- Update
NestedHandlerto pass the full relevant scope data intocontext->validate()for nested property validation. - Add regression tests covering sibling access in
whencallbacks (including insideEach+Nestedcombinations) and a missing-intermediate-key dotted path case. - Add a changelog entry documenting the bugfix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Rule/NestedHandler.php | Adjusts nested validation to validate against the parent scope dataset so sibling properties are available in context. |
tests/Rule/Nested/NestedTest.php | Adds tests proving sibling access works in when callbacks across nested structures. |
CHANGELOG.md | Documents the bugfix in the upcoming release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
WarLikeLaux
commented
May 30, 2026
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThe PR enables sibling property access in nested validation contexts. ChangesSibling property access in nested validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
WarLikeLaux
commented
May 30, 2026
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WarLikeLaux
commented
May 30, 2026
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/Rule/NestedHandler.php`:
- Around line 98-109: The code can pass a scalar as the scope to
context->validate when an intermediate path segment exists but is not an array
(e.g. ['push'=>'on'] with path push.content); after the for-loop that walks
$valuePathList in NestedHandler.php, ensure $scopeData is an array and if not
set $scopeData = [] so context->validate always receives an array (empty-scope
fallback) instead of a scalar; locate the variables $scopeData, $valuePathList
and the call to $context->validate and add the normalization check just before
the validate call.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a34e8aa5-ff03-43bc-8834-3d217bc1b576
📒 Files selected for processing (3)
CHANGELOG.mdsrc/Rule/NestedHandler.phptests/Rule/Nested/NestedTest.php
Uh oh!
There was an error while loading. Please reload this page.
What does this PR do?
Pass full scope data (with sibling properties) to
context->validate()inNestedHandler, sowhencallbacks can access siblings via$context->getDataSet()->getPropertyValue().Coverage
Tests: 89 → 93. Line coverage: 66/66 (100%) → 73/73 (100%). MSI: 96% (55/57) → 95% (65/68).
Summary by CodeRabbit
Bug Fixes