test: pin mask constants by re-derivation, lone-high-bit case, relative src import#30
test: pin mask constants by re-derivation, lone-high-bit case, relative src import#30thedavidmeister wants to merge 1 commit into
Conversation
…e relative src import Each CTPOP mask constant is asserted against an independently loop-built value so a corrupted constant cannot hide behind ctpop and ctpopSlow sharing it; a deterministic 1<<255 case pins the top of the range; the test imports src via a relative path so the suite survives consumption as a soldeer dependency. Appends the adversarial-mutation-test scan record. Closes #24 Closes #25 Closes #26 Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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 |
Closes #24
Closes #25
Closes #26
Three test-suite hardening items in one file-clustered PR:
src/lib/LibCtPop.solbare, which breaks when the package is consumed as a soldeer dependency; it now imports relatively.CTPOP_M*/CTPOP_H01constant is pinned bytestMaskConstantsRederived, which rebuilds each mask with an independent loop (altMask) instead of trusting the hex literals; previously a corrupted shared constant had no direct value-level test.testCtPopLoneHighBitdeterministically pinsctpop(1 << 255) == 1instead of relying on fuzz to reach the top bit.Also appends the
audit/mutation-test-scans.jsonscan record for this pass.QA
testMaskConstantsRederived(exact-value assertion per constant, loop-derived — not code-mirroring) andtestCtPopLoneHighBit(exact count 1), both added in this PR; full suite 8/8 green on the unmutated baseline (nix develop github:rainlanguage/rainix#sol-shell -c forge test).CTPOP_M1low nibble…55→…54→testMaskConstantsRederivedFAILS with the exact corrupted value (deterministic kill); the fuzz/mutual-check tests also fail probabilistically because ctpop and ctpopSlow consume M1 through different formulas — the new pin makes the kill deterministic and value-level for all 9 constants, including M8–M128 which onlyctpopSlowreads.>> 248→>> 240→testCtPopLoneHighBitFAILS (1 != 256), plus 4 pre-existing tests.widthset bits alternating withwidthclear, byte-wise 0x01 for H01) and the lone-high-bit count of 1 are derived from the definition, independent of the constants under test.src/import in the repo's only test file (fixed); [unpinned-masks-shared-constant-blindspot] [LOW] Mask constants have no direct test pin; ctpop/ctpopSlow share M1/M2/M4 #25 asks for direct pins on the shared mask constants (all 9 pinned); [no-single-high-bit-test] [INFO] No deterministic lone-high-bit (1<<255) test #26 asks for the deterministic lone-high-bit case (added). Adversarial pass on the unit found no candidate bugs: thetype(uint256).maxspecial case is correct (the SWAR byte-sum overflows at count 256, which is exactly the excluded case).🤖 Generated with Claude Code