Skip to content

fix(fix_var): add assert_fixable call in fix_var function to avoid no… - #80

Merged
GermanHeim merged 1 commit into
oximo-rs:mainfrom
NikitaPomies:fix/coherent_variable_fixing
Aug 31, 2026
Merged

GermanHeim merged 1 commit into
oximo-rs:mainfrom
NikitaPomies:fix/coherent_variable_fixing

Conversation

@NikitaPomies

Copy link
Copy Markdown
Contributor

Description

Add an assert function (assert_fixable) to tell if a variable is fixable. Prevent the user from :

  • fixing an integer var to a fractional value
  • fixing a continous var outside its bounds
  • fixing a semi-{int, cont} var to a value below threshold != 0

Called in Model.fix_var andVar.fix

Add tests crates/oximo-core/tests/model.rs

Checklist

  • I have added tests that cover my changes
  • I have run cargo fmt and cargo clippy to ensure code quality

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e05e275-6fb2-4f26-a830-f7777e1df83f

📥 Commits

Reviewing files that changed from the base of the PR and between 8319f0f and 6db2ac8.

📒 Files selected for processing (3)
  • crates/oximo-core/src/model.rs
  • crates/oximo-core/src/var.rs
  • crates/oximo-core/tests/model.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Fixing APIs now reject invalid values before applying fixed bounds. Validation covers finiteness, integer domains, declared bounds, and semicontinuity gaps. Tests cover rejected and accepted values across integer, binary, semicontinuous, and semi-integer variables.

Changes

Fix-value validation

Layer / File(s) Summary
Validation and builder enforcement
crates/oximo-core/src/var.rs
Adds assert_fixable and calls it from VarBuilder::fix before setting equal bounds.
Model API integration and tests
crates/oximo-core/src/model.rs, crates/oximo-core/tests/model.rs
Model::fix_var validates values and documents the new panic conditions. Tests cover invalid values and valid integral or zero fixes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 6db2a

The change rejects invalid variable-fixing values before state is modified; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: germanheim

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding an assert_fixable call to prevent invalid fixes. It is concise and related to the changeset, although it focuses on fix_var rather than both fi…
Description check ✅ Passed The description explains the purpose, lists the invalid values that are rejected, identifies the affected code paths, and mentions the added tests. It omits the Changes Made and Related Issues hea…
Docstring Coverage ✅ Passed Docstring coverage is 93.75% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly identifies the main change: adding an assert_fixable call to prevent invalid fixes. It is concise and related to the changeset, although it focuses on fix_var rather than both fixing paths.

Full details: Description check

Explanation

The description explains the purpose, lists the invalid values that are rejected, identifies the affected code paths, and mentions the added tests. It omits the Changes Made and Related Issues headings and leaves several checklist items unaddressed, but it provides the main required information.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GermanHeim
GermanHeim merged commit 878a4f8 into oximo-rs:main Aug 31, 2026
10 checks passed
@GermanHeim

Copy link
Copy Markdown
Member

Great, you are now counted as a contributor! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants