refactor(fitstats): move conditional Rasch M2 arithmetic to Rust - #807
Conversation
|
Warning Review limit reached
Next review available in: 68 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe pull request adds Rust integration tests for conditional-Rasch CMLE M2 and Python ownership-contract tests for its public APIs. The tests cover valid results, input constraints, Rust delegation, metadata preservation, and fail-closed behavior. ChangesConditional-Rasch CMLE M2 validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: 🟡 Moderate · up to The current tests do not yet prove numerical correctness for CMLE M2 or fail-closed behavior through the public estimator route, so the PR is not merge-ready until those bounded regression tests are added. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
|
@opencode-agent address Operate only if the live Draft head is still exactly Follow strict RED → GREEN on this existing branch:
Advance #627 only with exact-head evidence. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/mlsirm-core/tests/fitstats_cmle_m2.rs`:
- Around line 40-45: Add a deterministic, independently hand-calculated CMLE M2
fixture in the test covering the existing result from the fit-statistics path,
and assert exact or appropriately tolerance-bounded expected values for m2, df,
p_value, rmsea2, and srmsr rather than only finiteness and shift invariance.
Keep the fixture and expected calculations grounded in the primary literature
supporting the fit-diagnostic scope.
In `@tests/test_fitstats_cmle_m2_rust_ownership.py`:
- Around line 42-43: Extend the existing Rust-core-unavailable test around
m2_cmle_rasch to also call fitstats.m2 with the CMLE estimator and require the
same RuntimeError. Keep the test under the same _core_module() monkeypatch and
use the existing responses, factor_id, and params fixtures to verify the routed
CMLE path fails closed.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fd80d394-ab0a-471c-9d3c-608316b28241
📒 Files selected for processing (2)
crates/mlsirm-core/tests/fitstats_cmle_m2.rstests/test_fitstats_cmle_m2_rust_ownership.py
4bab11a to
eb34c99
Compare
|
@coderabbitai review |
|
52961a5 to
8e6abe3
Compare
Fail closed without the compiled core and delegate every public conditional-Rasch M2 result field to m2_cmle_rasch_stat. Ports the Haberman-style raw-score conditioning and Maydeu-Olivares–Joe projection into mlsirm-core so production ownership matches ordinary m2_stat. ## changelog - Public m2_cmle_rasch and m2(..., estimator="cmle") require Rust - Native m2_cmle_rasch_stat owns elementary-symmetric and projected M2
8e6abe3 to
8f850b6
Compare
|
@coderabbitai review |
|
Buyer-visible numerical ownership gap
Protected
mainroutes ordinary MMLE M2 through Rust/PyO3, but the public conditional-Rasch pathm2(..., estimator="cmle")and directm2_cmle_rasch()still execute result-affecting elementary-symmetric, derivative, covariance, projection, fit-index, and SRMSR arithmetic in Python/NumPy. That contradicts the production numerical ownership contract tracked in #627.Intentional RED
Exact fail-first head
b2a0bf9956fd223bc81b7e8382df043ad2adc1f1adds only public-boundary regressions. They require both public CMLE entry paths to:m2_cmle_rasch_statnative entrypoint; andM2Result, estimator label, and conditional-Rasch interpretation note.Current protected behavior does not consult the Rust core, so the expected RED is the ownership assertion rather than fixture/setup/import failure. The full-pattern fixture contains every five-item response pattern and every raw-score category.
Minimum GREEN
mlsirm-core;M2Resultconstruction only;No estimator-family redesign, hidden fallback, dependency, workflow, hosted-product, or release-version change belongs in this slice.
Advances #627.
Summary by CodeRabbit