Skip to content

test(cat): require Rust-owned item information and next-item selection - #721

Closed
seonghobae wants to merge 1 commit into
mainfrom
test/cat-selection-rust-ownership-red-629
Closed

seonghobae wants to merge 1 commit into
mainfrom
test/cat-selection-rust-ownership-red-629

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

First fail-first ownership slice for #629

Protected main at branch creation and final pre-PR refetch: 640de7dd39d944749b92b1a88bafa8e1787a0847.

CAT ability MLE/EAP/SE is now Rust-owned on protected main via #709, so the sequencing blocker recorded in #629 is cleared. Fresh protected-main python/fast_mlsirm/test_design.py still computes public item information through Python model probabilities plus a²P(1-P), then copies/masks those values and performs the consequential next-item argmax in Python.

This Draft adds only the smallest intentional ownership REDs:

  • public item_information() must obtain the numerical information vector from a package-owned Rust/PyO3 entrypoint; and
  • public select_cat_item() must obtain the administered-item exclusion/ranking decision from a package-owned Rust/PyO3 entrypoint rather than performing the final argmax in Python.

The tests replace the proposed compiled-core entrypoints with unmistakable sentinel results and require one call plus exact sentinel transport. Current protected main is expected to fail by making zero calls. Setup/import/fixture failure is not valid RED.

Minimum GREEN after exact RED proof

  1. Reuse existing mlsirm_core::scoring::bank_information_device / CAT scoring primitives where they exactly match the current estimand; do not duplicate probability/information formulas.
  2. Expose the smallest thin PyO3 boundary for the current simple-structure information vector and deterministic next-item selection. Python owns bounded input validation, immutable marshalling and result transport only.
  3. Preserve MIRT/latent-space/bifactor identities, discrimination handling, theta-vs-person behavior, population-mean xi convention when no person is supplied, administered-item exclusion, deterministic tie behavior and no-candidate error semantics.
  4. Missing/incompatible compiled capability must fail closed rather than selecting Python information/argmax arithmetic.
  5. Add direct Rust↔public field/index parity across ordinary, multidimensional simple-structure, latent-space, tied-information, excluded/no-candidate and malformed cases; add realistic CAT item-selection/recovery evidence, not correlation-only proof.
  6. Keep CPU f64 as the reference and benchmark before adding any new GPU selection path. Existing GPU scoring parity may be reused only with exact estimand proof.
  7. Add rustdoc/docstrings, APA 7 equation/source traceability and authoritative changelog after GREEN, then all same-head Python/Rust/PyO3/package/GPU/fuzz/Security/SAST/current-head review gates.

Fixed-form greedy assembly remains the second #629 slice after this first ownership boundary stabilizes. Do not widen this PR into ata.py hostile-control work (#718/#683), a new exact ATA optimizer, dependencies/workflows/version/release, hosted state, or canonical #604 docs. Keep Draft through RED→GREEN. Advances #629.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 631079a3-b475-49d9-9a5f-b4c8507f7398

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Exact bounded implementation handoff for Draft #721 / issue #629. Before any write, refetch source head 0ecbca38456b8ba955e12539cd9a9b19efd7a0d7 and protected main 20b029a237e7819b5a4f7d74a1b2bbfb1b6755f7; abort this branch if either moved or another source writer appeared. Preserve the fail-first history and reconcile accepted main non-destructively before final acceptance.

Exact CI run 31478256787 reached the intended production ownership boundary on both Python 3.12 and 3.14. Rust/PyO3, package/reinstall/release acceptance, explicit GPU smoke, fuzz, Security Scan and SAST are green. Python fails exactly the two intended tests in tests/test_cat_selection_rust_ownership.py, each because the proposed Rust entrypoint receives zero calls. Setup/import/fixture behavior is green.

Implement minimum GREEN only:

  1. Reuse existing Rust scoring/bank-information primitives where the estimand exactly matches. Add a package-owned Rust/PyO3 cat_item_information boundary for the current public simple-structure item-information vector rather than duplicating probability/information arithmetic.
  2. Add a package-owned Rust/PyO3 cat_select_item boundary that owns administered-item exclusion plus deterministic max-information selection/tie behavior. Python may validate/marshal and return the selected index only; do not retain a hidden Python argmax fallback.
  3. Preserve current MIRT, latent-space and bifactor predictor semantics, discrimination interpretation, theta/person handling, population-mean xi convention, administered exclusion, no-candidate error and caller immutability. Missing/incompatible compiled capability must fail closed.
  4. Add direct Rust↔public parity/property tests over ordinary, multidimensional simple-structure, latent-space/bifactor as supported, tied information, excluded/all-excluded and malformed inputs. Preserve realistic CAT selection/recovery evidence; correlation alone is not acceptance.
  5. Keep this CPU-f64 unless existing exact-estimand GPU scoring can be reused without a new semantics branch; do not widen into ATA hostile-control work, exact ATA optimization, fixed-form assembly, dependencies/workflows/version/release or canonical docs: establish canonical product and architecture baseline #604 docs.
  6. After GREEN add concise rustdoc/docstrings and APA 7 equation/source traceability appropriate to item information/CAT selection, plus authoritative changelog material. Run focused CAT tests, Rust workspace/PyO3, changelog check and git diff --check, then leave Draft for fresh full exact-head CI/security/review.

This slice changes ownership, not the scientific estimand.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Reacquire the bounded source-writer lease for Draft #721 / issue #629 only if a final refetch still shows source head 0ecbca38456b8ba955e12539cd9a9b19efd7a0d7 and protected main 9b7335466c1d61349228d33e7b1e58d279f984c4; abort without writing if either ref moved or another current source writer appeared. The predecessor handoff 5251836798 was bound to protected main 20b029a237e7819b5a4f7d74a1b2bbfb1b6755f7, instructed itself to abort on movement, has no reaction/receipt and produced no source movement. Treat it as stale predecessor evidence.

Fresh compare is diverged: this branch has exactly one unique fail-first test path and is 17 protected-main commits behind, merge base 640de7dd39d944749b92b1a88bafa8e1787a0847. Reconcile current main non-destructively first; preserve #724's newly integrated validation policy and all accepted-main CAT/RT/inference behavior.

The valid RED from CI 31478256787 proved the intended production boundary: public item_information() and select_cat_item() make zero calls to the proposed Rust owners while all non-Python gates are green. Implement only the minimum GREEN:

  1. Reuse existing Rust scoring/bank-information primitives when the estimand exactly matches; add the smallest cat_item_information PyO3 boundary instead of duplicating probability/information arithmetic.
  2. Add cat_select_item Rust/PyO3 ownership for administered-item exclusion, deterministic tie behavior and consequential maximum-information selection. Python validates/marshals and transports the selected index only; no hidden Python argmax fallback.
  3. Preserve MIRT/latent-space/bifactor identities, discrimination handling, theta/person semantics, population-mean xi convention when no person is supplied, administered exclusions, tie behavior and no-candidate errors. Missing/incompatible core fails closed.
  4. Add direct Rust↔public parity/property evidence over ordinary, multidimensional simple-structure, supported latent-space/bifactor, ties, excluded/all-excluded and malformed inputs, plus realistic CAT selection/recovery evidence using bias/MAE/RMSE/information behavior where identified; correlation alone is insufficient.
  5. Keep CPU f64 as reference; reuse an existing exact-estimand GPU scoring path only if parity is already proven, otherwise profile before any GPU addition.
  6. After GREEN add rustdoc/docstrings, APA 7 item-information/CAT-selection traceability and authoritative changelog, then run focused CAT tests, full Python 3.12/3.14, Rust/PyO3/package/reinstall/GPU-existing/fuzz/Security/SAST, changelog check and git diff --check on one unchanged head.

Fixed-form greedy assembly remains the later #629 slice. Do not widen into ATA hostile-control #718, exact ATA optimization, dependencies/workflows/version/release, hosted state or canonical #604 docs. Keep Draft; final current-head review/Ready/merge returns to the maintainer loop.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Fresh replacement implementation lease for issue #629 / Draft #721 after protected-main movement invalidated the prior exact-base handoff. Immediately before writing refetch source head, live protected main, comments/reviews and the exact test_design.py/Rust scoring target blobs; proceed only while source remains 0ecbca38456b8ba955e12539cd9a9b19efd7a0d7, live main remains compatible with 198f236241955b5f707d140d4883ea481a2beca1, and no other writer targets this branch/paths. Fresh compare is diverged ahead 1 / behind 22 with exactly one unique fail-first CAT-ownership test file. Reconcile protected main non-destructively first and preserve CI 31478256787 RED evidence as predecessor proof.

Implement only the first #629 ownership slice already defined by #721: reuse existing Rust scoring/bank-information primitives where the estimand matches; add thin package-owned Rust/PyO3 cat_item_information and cat_select_item boundaries so item-information arithmetic plus administered-item exclusion/final deterministic next-item selection are Rust-owned. Python may validate/marshal and return results only; no hidden Python probability/information or argmax fallback when the compiled capability is missing/incompatible.

Preserve MIRT/latent-space/bifactor predictor semantics, discrimination interpretation, theta/person handling, population-mean xi convention, administered exclusion, tie behavior, no-candidate semantics and caller immutability. Add direct Rust↔public parity/property evidence for ordinary/multidimensional/latent-space/tied/excluded/malformed cases plus realistic CAT selection/recovery evidence using more than correlation. Keep CPU-f64 unless an existing exact-estimand GPU scoring path can be reused with parity proof. Add primary-source APA 7 equation/source doctoring, rustdoc/docstrings and authoritative changelog only after GREEN, then run Python 3.12/3.14, Rust/PyO3/package/GPU/fuzz/Security/SAST, coverage/docstring and current-head review gates on one unchanged head.

Do not widen into fixed-form ATA assembly/hostile-control work, exact ATA optimization, dependencies/workflows/version/release, hosted state or canonical #604 docs. Stop writing on any source/base/lease movement.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Fresh current-main replacement/reconciliation implementation lease for Draft #721 / issue #629. Immediately before writing refetch exact source head 0ecbca38456b8ba955e12539cd9a9b19efd7a0d7, live protected main 7b57f77747b9a9bd911660c76b1be0ca0dc2d145, comments/reviews/threads and exact python/fast_mlsirm/test_design.py / Rust scoring / PyO3 target blobs; abort without writing if either ref moves or another writer targets this branch/paths. Every earlier handoff is stale because it was bound to predecessor protected heads.

Fresh compare is diverged, ahead 1 / behind 28 from merge base 640de7dd39d944749b92b1a88bafa8e1787a0847; the only unique branch path is the validated fail-first tests/test_cat_selection_rust_ownership.py. Preserve exact RED CI 31478256787: both Python 3.12/3.14 reached the production boundary and fail exactly the two ownership tests because the proposed Rust entrypoints receive zero calls, while Rust/PyO3, package/reinstall/release acceptance, explicit GPU, fuzz, Security Scan and SAST are GREEN.

Reconcile protected main non-destructively first. If a 28-commit-old one-test branch makes direct integration unnecessarily conflict-prone, create exactly one clean-lineage replacement from current main carrying the same fail-first tests/RED lineage, make it the sole current #629 implementation line and close #721 with precise supersession lineage; never keep both writers active.

Implement only this first #629 ownership slice:

  1. Reuse existing Rust scoring/bank-information primitives where the estimand exactly matches and expose the thinnest package-owned Rust/PyO3 cat_item_information boundary; do not duplicate probability/information arithmetic.
  2. Move administered-item exclusion plus final deterministic next-item ranking/tie decision into Rust/PyO3 cat_select_item (or an equivalently reviewed entrypoint adjusted test-first). Python validates/marshals/returns results only. Missing/incompatible core capability fails closed; no Python probability/information or argmax fallback.
  3. Preserve MIRT/latent-space/bifactor predictor semantics, discrimination interpretation, theta/person behavior, population-mean xi convention, administered exclusion, deterministic tie behavior, no-candidate semantics and caller immutability unless a separate scientific defect is established test-first.
  4. Add direct Rust↔public parity/property evidence for ordinary, multidimensional simple-structure, latent-space, tied-information, excluded/no-candidate and malformed cases, plus realistic CAT selection/true-theta recovery evidence using bias/MAE/RMSE/information or defensible selection metrics rather than correlation alone.
  5. CPU f64 is reference. Reuse an existing exact-estimand GPU scoring path only with direct parity proof; otherwise benchmark before GPU.
  6. Add complete rustdoc/docstrings, primary CAT/item-information APA 7 equation/source doctoring and authoritative changelog only after GREEN. Then run focused ownership/recovery, exact changed-production 100% statement/branch coverage and full Python 3.12/3.14, Rust/PyO3, package/reinstall, GPU/fuzz, Security/SAST and current-head review gates on one unchanged head.
  7. Fixed-form greedy assembly remains the later architecture: move CAT item information and test-assembly selection into Rust #629 slice. Do not widen into ATA optimization/hostile-control work, dependencies/workflows/version/release, hosted state or canonical docs: establish canonical product and architecture baseline #604/docs: close canonical documentation fitness gaps without parallel authority #621 docs.

Stop writing immediately if source/base/lease state moves.

Copy link
Copy Markdown
Contributor Author

Superseded by clean-lineage Draft #735 after protected main advanced ~197 commits beyond this branch. #735 absorbs the item-information ownership RED and implementation directly from current protected main, reusing the exact existing Rust bank_information kernel rather than carrying this stale branch forward. The final global administered-item masking / deterministic argmax ownership from this PR is not being dropped or claimed fixed: it remains open under issue #629 and needs a fresh current-main Rust policy kernel because existing Rust cat_next_item uses a different EAP/max-posterior-SD-dimension policy and is not an exact substitute. No CI/review evidence from #721 transfers to #735 or that future selection slice.

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.

1 participant