Fix node sums for isViable checks - #2479
Conversation
📝 WalkthroughWalkthrough
ChangesNode resource limit enforcement
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/Models/Node.php (1)
331-358: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFallback logic correctly fixes the property-shadowing bug.
The null-coalescing pattern reads the true Eloquent aggregate when present and falls back to a relationship sum only when the aggregate is null. This restores enforcement of memory, disk, and CPU limits as described in issue
#2478.No test file is included with this fix. Given that the underlying bug allowed unlimited server allocation across nodes, a regression test for
isViable()would guard against a repeat of this issue (e.g., one case withwithSum()aggregates loaded, one case without).Do you want me to generate a test case covering both the aggregate-present and aggregate-absent paths?
🤖 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 `@app/Models/Node.php` around lines 331 - 358, Add regression tests for Node::isViable covering both paths: loaded withSum() aggregates and no loaded aggregates requiring relationship sums. Verify memory, disk, and CPU limits reject over-allocation in each path.
🤖 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.
Nitpick comments:
In `@app/Models/Node.php`:
- Around line 331-358: Add regression tests for Node::isViable covering both
paths: loaded withSum() aggregates and no loaded aggregates requiring
relationship sums. Verify memory, disk, and CPU limits reject over-allocation in
each path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 327a5ef5-f672-4969-ac04-e2c1aad0d6f5
📒 Files selected for processing (1)
app/Models/Node.php
Closes #2478