Add regression test for descending simulator interval overflow
Author: fernandolinsCreated Sep 29, 2026Updated Sep 29, 2026
Context
#4275 fixed an overflow in the simulator’s descending interval ordering.
Add a targeted Rust regression test to prevent this defect from being reintroduced.
Scope
- Exercise descending interval priority with an interval value that reaches the
i32::MINedge case. - Verify that descending ordering does not panic or overflow.
- Place the test in an appropriate existing
#[cfg(test)]module. - Preserve production behavior and avoid adding testing dependencies.
Assertion classification: Historical regression.
Expected behavior: descending interval ordering must not panic or overflow, including the i32::MIN edge case, as established by the fix in #4275.
Acceptance criteria
- The test passes on the current implementation.
- The test fails when the historical non-saturating negation, or an equivalent mutation, is temporarily restored.
- The test is deterministic across supported CI platforms.
- The test name or failure message clearly identifies the protected behavior.
- The PR links the historical fix and documents the relevant before/after behavior.
Review
Request review from the Anki/FSRS reviewer pool: Isaac, Giacomo, Aidan, Expertium, Jakub, or another qualified contributor.
Source: ankitects/anki