test: pin mask constants by re-derivation, lone-high-bit case, relative src import#30
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe test suite imports the exported popcount masks, adds deterministic coverage for ChangesCtpop test coverage
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
The file is unrelated to the three issues this PR closes (#24 bare src/ import, #25 mask-constant pins, #26 lone-high-bit case) and sits in the wrong place: `audit/` is the Protofire PDF location by org convention — roh-scan scopes its external-audit coverage to `audit/protofire/` — while the audit skill's own run stamps live under `.audit/`. A mutation-test record is neither, and no other repo in the org carries this filename, so committing it here would establish a new path by accident. Harmless but out of scope: verified it does not affect roh-scan (which globs `audit/protofire/` only) and that REUSE legal passes either way. The durable record of this work is the tests themselves and the closed issues. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Reviewed 578de9f: APPROVE Closes #24, #25, #26. Verified by execution against the repo, not by reading the diff:
Side note: under the
All checks green on this SHA (rainix legal/static/test, CodeRabbit); mergeStateStatus CLEAN. Note: automated review, not human approval — merging on the maintainer's explicit instruction. |
|
Correction — my removal of I justified it with "no other repo in the org carries this filename". That is false. The file is an established convention, also present in The mistake: a code search for the exact filename token returned empty silently, and I treated that as evidence of absence instead of checking a known repo. Searching Restored in #32. The rest of this PR's review stands — the removal was the only part based on a bad premise. |
Restore audit/mutation-test-scans.json (my removal in #30 was wrong)
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
Summary by CodeRabbit