fix: floor the auto-derived min_loc at 1 - #72
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change floors automatically derived ChangesDerived
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change prevents invalid automatically derived bounds while preserving the existing rejection for incompatible values. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
With refinement enabled and min_loc unset, min_loc = max_loc // 4 gave 0 for max_loc < 4, bypassing the ge=1 constraint on the explicit field. Floor it at 1; max_loc=1 now fails the min_loc < max_loc check instead of silently running with min_loc=0.
6c60102 to
6bb9a38
Compare
Problem
Settings.auto_derive_min_locsetsmin_loc = max_loc // DEFAULT_MIN_LOC_RATIOwhen refinement is enabled andmin_locis unset. Formax_loc < 4that is0, which the explicit field constraint (min_loc: int | None = Field(ge=1)) would have rejected.Settings(max_loc=3, max_refinement_iterations=1).min_loc == 0then feeds intodetect_loc_bound_violations/score_planas a real bound.Fix
max(1, max_loc // DEFAULT_MIN_LOC_RATIO).max_loc=1with refinement now fails the existingmin_loc < max_loccheck with the normalMIN_LOC_GE_MAX_LOCmessage (the CLI already reportsValidationError/ValueErrorfromSettingscleanly) instead of running withmin_loc=0.Tests:
max_loc2 and 3 derivemin_loc == 1;max_loc=1is rejected;max_loc=400still derives 100. 448 tests pass, ruff clean.Summary by CodeRabbit
Bug Fixes
Tests