test: seeded adversarial-limb fuzz as a CI gate#125
Merged
Conversation
Three silent wrong-answer classes shipped in 2026 (MFA inverse twiddle #103, BZ odd-size fallback #116, FastDivision MG top-equal qhat in #120) and none was catchable by uniformly random operands — each required a structured limb pattern with ~zero probability under the existing random sweeps. Adds 5 deterministic fuzz tests to the unit suite (~60 ms total) using the 0 / 1 / 2^64-1 / 2^63-biased limb distribution that surfaced the MG bug: 2000 division cases cross-checked digit-for-digit against the KnuthDivision reference plus the q*b+r==a identity, larger BZ/Newton/ QSized shapes (including odd sizes for the BZ padding path) via the identity, 1000 multiplication cases vs classic schoolbook plus NTT-band spot checks, Square vs Multiply(a,a), and ToString/parse round-trips. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit follow-up: the regression-protection gap behind all three 2026 silent wrong-answer bugs (MFA inverse twiddle #103, BZ odd-size #116, FastDivision MG top-equal in #120) was the same — uniformly random operands can't hit structured limb patterns, so the random sweeps stayed green while production paths returned wrong numbers.
Adds
tests/unit/test_adversarial_fuzz.cpp(picked up by the existing glob, runs in theunit_testsctest target, ~60 ms):KnuthDivisionreference digit-for-digit +q*b + r == aandr < b; plus BZ/Newton/QSized-band shapes (incl. odd 1025×513 for the BZ padding path) via the identity.Multiply(a,a)across Karatsuba and CRT bands.Deterministic seeds — reproducible CI, no flakes. The division distribution is exactly the one that surfaced the FastDivision MG bug.
Test plan
unit_tests: 285 passed, 0 failed (~0.2 s total)🤖 Generated with Claude Code