Skip to content

test(ata): reject hostile constraint-map coercion before scoring - #718

Closed
seonghobae wants to merge 1 commit into
mainfrom
test/ata-constraint-map-validation-red-683
Closed

seonghobae wants to merge 1 commit into
mainfrom
test/ata-constraint-map-validation-red-683

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Fail-first trust-boundary slice for #683

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

PR #682 is now protected-main behavior and safely validates the top-level content label array before item-information work. The remaining ATA semantic controls still use str(...) / int(...) coercion for content-constraint maps, exposure maps, and scalar controls after psychometric item-information computation. Those conversions can execute caller-defined callbacks and silently accept booleans/fractional values outside the documented finite semantic domains.

This Draft adds only intentional public-boundary RED tests proving:

  • hostile min_per_content / max_per_content keys and counts are rejected without invoking __str__, __repr__, __int__, or __index__;
  • hostile exposure_counts identities are rejected without arbitrary integer conversion;
  • Boolean/fractional seed and exposure_max controls fail as non-integers; and
  • every invalid semantic control above fails before item_information_matrix() executes.

The tests use callback counters and a counted numeric boundary so setup/import/fixture failure cannot be mistaken for valid RED.

Minimum GREEN after exact RED proof

  1. Reuse one package-owned exact-string/exact-integer validation convention where existing helpers are scientifically/API compatible; do not create a drifting validator family.
  2. Validate min_per_content / max_per_content keys against the same accepted string scalar domain as content, and values as bounded non-Boolean exact integers before numeric scoring.
  3. Validate exposure_counts keys/counts and scalar seed / exposure_max without arbitrary coercion callbacks. Preserve accepted built-in and NumPy scalar forms only where the public contract already intends them.
  4. Order semantic preflight before item_information_matrix() whenever the value can be validated from bank metadata/control inputs alone.
  5. Preserve ATA information, greedy target matching, constraint feasibility, exclusion/exposure semantics, tie-breaking, determinism and result values for accepted inputs exactly.
  6. Add boundary/range/error-redaction and accepted-control parity tests, complete beginner-readable docstrings, current Python 3.14 primary technical doctoring and authoritative changelog after GREEN, then all same-head Python/Rust/PyO3/package/GPU/fuzz/Security/SAST/current-head review gates.

Do not widen this slice into CAT/test-assembly Rust numerical ownership (#629), top-1 ranking work, a new ATA optimizer, dependencies/workflows, version/release, hosted state, or canonical #604 documentation. Keep Draft through RED→GREEN. Advances #683.

@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: 95033b36-613c-4ba5-958b-b61642c565c8

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

Fresh exact-current reconciliation + GREEN handoff for issue #683 / Draft #718. Immediately before any write refetch source head, live protected main, comments/reviews and the ATA target blob; proceed only if source remains da556b06917acd81e27195db6aaf5ff0927a4651, protected main is still compatible with 557a065350abcfb963d5d0a010e2ab79b7e9ff47, exact current python/fast_mlsirm/ata.py is still the same semantic boundary as blob 13dd374366a60a07f0a789c72f5fa46a62aeb56a, and no other writer targets this branch/file. Abort on any movement.

The branch is now 13 protected-main commits behind but has exactly one unique fail-first test path. Reconcile protected main non-destructively first; preserve the valid RED history from CI run 31477659356 / synthetic merge 5e82fe1efd003ce629a795c0944f54449726c92f as predecessor evidence. That run reached both Python 3.12/3.14 full Rust-primary suites; Python 3.12 completed 7 failed, 3225 passed, 2 skipped, all seven new tests failing only because invalid semantic controls reached item_information_matrix() before rejection. The initial SAST failure was Docker Hub registry timeout only and was rerun; do not treat it as source RED.

Implement the minimum GREEN after reconciliation:

  1. Preflight all ATA semantic controls that are independently decidable before item_information_matrix(): min_per_content/max_per_content, exposure_counts, exposure_max, seed, and any adjacent exact-integer/string controls found in the same public boundary.
  2. Reject content-map keys unless they are exact accepted string scalar types; reject counts/indices/scalars unless they are exact non-Boolean integer scalar types. Do not invoke caller __str__, __repr__, __int__, or __index__ callbacks. Preserve NumPy string/integer scalar compatibility only where the accepted API already intends it.
  3. Add bounded range/domain checks (non-negative counts/exposure, deterministic seed domain, map item-index domain where applicable) with stable non-reflective errors. Do not silently coerce fractions/booleans.
  4. Preserve all accepted ATA information values, greedy target-shortfall objective, content/exclusion/exposure feasibility, tie-breaking/seed determinism and result structure exactly.
  5. Extend tests for accepted built-in/NumPy scalar controls, boundary-1/boundary cases, hostile map values, failure-before-scoring ordering and error redaction. Add current Python 3.14 technical doctoring/changelog only after focused GREEN.
  6. Run focused ATA tests, full Python 3.12/3.14, Rust/PyO3/package/GPU/fuzz/Security/SAST and current-head review on one unchanged head.

Do not widen into CAT/test-design Rust ownership (#721/#629), _top1_to_csr, a new ATA optimizer, dependencies/workflows/version/release, hosted state or canonical #604 docs. Keep Draft until exact-current gates/review are complete.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Reacquire the bounded source-writer lease for Draft #718 / issue #683 only if a final refetch still shows source head da556b06917acd81e27195db6aaf5ff0927a4651 and protected main 9b7335466c1d61349228d33e7b1e58d279f984c4; abort without writing if either ref moved or another current source writer appeared. The predecessor handoff 5251525953 was explicitly bound to protected main 557a065350abcfb963d5d0a010e2ab79b7e9ff47, instructed itself to abort on movement, has no reaction/receipt, and produced no source movement. Treat it as stale predecessor evidence, not a competing active lease.

Fresh compare is diverged: this branch has exactly one unique fail-first test path and is 17 protected-main commits behind, merge base 640de7dd39d944749b92b1a88bafa8e1787a0847. First reconcile current main non-destructively; preserve accepted-main behavior, especially newly integrated validation/governance changes, and preserve the fail-first history rather than rewriting it.

The valid RED already reached the intended public boundary: malformed/hostile min_per_content / max_per_content, exposure_counts, seed, and exposure_max controls can execute arbitrary coercion callbacks or reach item_information_matrix() before semantic rejection. Implement only the bounded GREEN:

  1. Preflight every independently decidable ATA semantic control before item_information_matrix().
  2. Accept only the exact built-in/NumPy string and integer scalar domains intentionally supported; reject bool/fractional/hostile objects without invoking __str__, __repr__, __int__, or __index__.
  3. Validate non-negative/range/index domains before scoring with stable non-reflective errors; no caller-controlled payloads in durable errors.
  4. Preserve accepted item-information values, target-shortfall/greedy semantics, content/exclusion/exposure feasibility, deterministic seed/ties and result structure exactly.
  5. Extend focused tests for accepted built-in/NumPy scalars, hostile keys/values, range edges, failure-before-scoring ordering and redaction. This is input/governance work; do not migrate CAT/test-design arithmetic here.
  6. Add concise Python 3.14/API-security doctoring and authoritative changelog only after GREEN, then run focused ATA 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.

Do not widen into #721/#629 CAT numerical ownership, _top1_to_csr, a new ATA optimizer, dependencies/workflows/version/release, hosted state or canonical #604 documentation. Keep Draft; final current-head review/Ready/merge decisions return to the maintainer loop.

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #726. Exact verification before closure: #718 changes only tests/test_ata_constraint_map_validation.py; #726 contains the byte-for-byte same fail-first test patch plus the bounded GREEN implementation in python/fast_mlsirm/ata.py, APA doctoring, changelog fragment, and rendered changelog. No checks/reviews from #718 transfer to #726; #726 must satisfy its own unchanged-head/live-base gates.

@seonghobae seonghobae closed this Aug 11, 2026
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