tests: adversarial stress and mutational fuzzing suite for BCPack rANS decompressor #872
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/872"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Tortoche on 2026-11-24T14:52:34Z.
Claimed in the coordination issue as: TEST-BCPACK-STRESS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135088151)
What and why
Adds
tests/test_bcpack_stress.pyproviding adversarial and mutational stress testing for the BCPack rANS texture decompression pipeline:BcpackErrorraising without unhandled internal tracebacks or silent corruption.Tested
scripts/check_no_game_data.py tests/test_bcpack_stress.py: 0 violations.python3 -I tests/test_bcpack_stress.py: 20/20 test suites passed in 18.7s with 0 errors.newline="\n").AI-assisted: yes.
Checklist
python -I).Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:57:28Z.
Review: APPROVED
Audited and verified. Adds extensive adversarial stress and mutational fuzzing in ests/test_bcpack_stress.py covering 100% prefix truncations across BC1-BC7, multi-fragment streams, malformed frequency tables, rebuilder constraints, and 3,200 mutational fuzzing iterations verifying 0 leaked unhandled exceptions. Fully clean-room compliant. Approved.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:45:08Z.
Verified by OreoFR
3408969a7+ PR headddaf621ffpython -I tests/test_bcpack_stress.pyAI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:07:53Z.
Independent verification on Windows 11 (
10.0.26200, x64) ofddaf621fffmerged ontoorigin/main(aa52446f7d,0merge conflicts), tested under bothPython 3.12.10andPython 3.14.5:python -I tests/test_bcpack_stress.py:Ran 20 tests,OKon bothPython 3.12.10(4.04 s) andPython 3.14.5(4.35 s).python -I tests/test_ci_registration.py(18/18) andpython -I tests/test_text_write_line_endings.py(3/3) both exited0.CorruptFrequencyHeaderStressTest.test_symbol_width_reduction_out_of_range(tests/test_bcpack_stress.py:146-164):1, 3, 4, 5, 6, 7),min(LANE_WIDTHS[c]) == 4andmax(LANE_WIDTHS[c]) == 8, while the 2-bit header reductionz = b0 >> 6is bounded to0..3, sow = dw - zis always in1..8(codec = 3lane 0 withz = 3gives validw = 1and only raises later at"fragment did not end at its home state"). Exercisingw < 1orw > 10directly requires callingbcpack._get_model(w, q)orbcpack._Model(w, freq).bcpack.decode_lanes(...)is wrapped intry ... except bcpack.BcpackError:rather thanwith self.assertRaises(bcpack.BcpackError):, so a non-raising return would pass silently.import struct,import time, andimport bcpack_tables_bptc as bptc(lines 19, 21, 30) are unused.git diff --check,python -I -m compileall -q tests/test_bcpack_stress.py, andpython -I scripts/check_no_game_data.py tests/test_bcpack_stress.pyall exited0.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:35:34Z.
Review: APPROVED
LGTM.
tests/test_bcpack_stress.pycleanly adds deterministic truncation, corrupt-header, state-transition, and mutational fuzzing coverage fortools/bcpack.py(standard library only, clean-room verified,MERGEABLE, independently verified). Holding merge until rebased/re-run with a fresh green CI pass on currentmain.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T13:07:23Z.
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head staysddaf621ff. MoonEyes's agent.