fix: keep partial relaxation groups - #375
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI 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. 📝 WalkthroughWalkthrough
ChangesPrepRelax task grouping
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change validates group sizes and ensures final partial relaxation groups are processed without changing deployment or workflow contracts. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #375 +/- ##
=======================================
Coverage 84.43% 84.44%
=======================================
Files 104 104
Lines 6110 6112 +2
=======================================
+ Hits 5159 5161 +2
Misses 951 951 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Use ceiling division for CIF relaxation tasks, reject invalid group sizes, and cover remainder and undersized inputs. Closes deepmodeling#350 Coding-Agent: Codex Codex-Version: codex-cli 0.149.1 Model: gpt-5.6-sol Reasoning-Effort: xhigh
cc643b5 to
ab6f183
Compare
Retracted. This review was produced without running the mandated /code-review fan-out (the loop skill's section 2); the substitute process used instead has since been shown to miss findings and, in one case, to state a verified-sounding falsehood. Re-reviewing properly.
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Correct fix. The min(group_size * (i + 1), ncifs) clamp in the loop below has been there since the file was created in #251, but floor division made it unreachable for every i <= ntasks - 1 — so the guard against a short final group was dead code from day one. Ceiling division restores the original intent rather than changing behaviour.
Worth recording the production impact, since it is larger than the issue suggests: relax_group_size defaults to 100, so any DiffCSP iteration generating a number of structures that is not a multiple of 100 silently discarded up to 99 of them, and an iteration generating fewer than 100 produced zero relax tasks. No error, no log line.
I verified the new tests are not decoration. Reverting both changed lines and re-running:
test_keeps_partial_final_group AssertionError: 2 != 3
test_creates_task_when_group_is_larger_than_input AssertionError: 0 != 1
test_rejects_non_positive_group_size ZeroDivisionError
All four pass at head. The reason this sat undetected is that tests/op/test_prep_relax.py has exactly one commit in its history and has always used ncifs=4, group_size=2 — an exact multiple, the one input class where floor and ceiling division agree.
Approving. One non-blocking note on the new test inline, and two smaller things below that are yours to take or leave.
Not blocking
-
ValueErrorvsFatalError. dflow's generated pod script maps onlyTransientErrorto exit 1 andFatalErrorto exit 2; any other exception propagates and CPython also exits 1. The Argo retry expression dflow emits isasInt(lastRetry.exitCode) == 1, so withretry_on_transient_errorset, this deterministic config error gets retried until the budget runs out. #366 made exactly this conversion for the same reason, andFatalErroris used this way at 17 sites in the package. -
Placement.
relax_group_sizeis declared indpgen2/entrypoint/args.pyas a plainArgument(..., int, optional=True, default=100)with no constraint, so this guard is genuinely needed and not redundant. But it fires inside theprep-relaxcontainer, afterdiffcsp-genhas already run.extra_check=lambda v: v > 0on thatArgumentwould reject the value duringnormalize_argsat submit time instead. Note the repo currently usesextra_checknowhere, so this would be a new pattern rather than following one.
Exercise both zero and negative group sizes so the non-positive runtime guard cannot regress to an equality-only check. Coding-Agent: Codex Codex-Version: codex-cli 0.151.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh
Summary
relax_group_sizevaluesTests
python -m unittest -v tests.op.test_prep_relaxgit diff --checkCloses #350
Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit