fix(lammps): validate dplr and spin options#5842
Conversation
Reject truncated or keyword-valued DPLR and model-deviation options before reading them. Replace the type_associate assertion with a normal LAMMPS input error and use strict numeric conversion for spin parser values. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
for more information, see https://pre-commit.ci
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughLAMMPS DeePMD, DeepSpin, and DPLR option parsing now validates required values, rejects keyword tokens in value positions, uses numeric conversion utilities, and includes subprocess-based regression tests. ChangesLAMMPS parser hardening
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #5842 +/- ##
==========================================
- Coverage 78.58% 78.32% -0.26%
==========================================
Files 1050 1050
Lines 120637 120664 +27
Branches 4356 4369 +13
==========================================
- Hits 94801 94510 -291
- Misses 24278 24579 +301
- Partials 1558 1575 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Possible reviewers based on changed lines, exact file history, and exact-file review history:
No review request was made automatically. Coding agent: Codex |
Summary
fix dplrmodel and electric-field values before reading themtype_associatelists through a normal LAMMPS input error instead of an assertionrelative,relative_v,virtual_len, andspin_normvalues in both pair parsers and parse numeric values strictlyWhy existing tests missed the bugs
efieldcomponents, and pairedtype_associateentries, so they never reached the off-by-one reads or assertion path.relativeandrelative_v, so the parsers never read beyond the final argument.virtual_lenorspin_normwith missing values or a following keyword, leaving their unchecked loops uncovered.Validation
cmake --build source/build --target deepmd_lmp -j2pytest source/lmp/tests/test_lammps_option_parsers.py -q(18 passed)ruff format .ruff check .Fixes #5645
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit
Bug Fixes
Tests