tests: adversarial stress and mutational fuzzing suite for BCPack rANS decompressor #872

Open
github-bot wants to merge 1 commit from github-bot/gh-872 into main AGit
Owner

@⁠Tortoche on GitHub · 2026-11-24 14:52 UTC · original
Tortoche:feat/bcpack-bc7-rans → main · +448 −0 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-BCPACK-STRESS (#14)

What and why

Adds tests/test_bcpack_stress.py providing adversarial and mutational stress testing for the BCPack rANS texture decompression pipeline:

  • Prefix byte truncation testing: Validates 100% prefix byte truncations across single-fragment and multi-fragment streams for all active codecs (BC1, BC3, BC4, BC5, BC6H, BC7), ensuring clean BcpackError raising without unhandled internal tracebacks or silent corruption.
  • Corrupt header and state transition fuzzing: Validates malformed frequency headers, out-of-order symbol tables, non-canonical state transitions, and virtual zero boundary limits.
  • Block payload bit mutation: Verifies corrupt payloads fail cleanly and safely during block reconstruction.
  • Zero retail game data: All synthetic streams and test fixtures are generated procedurally using the Python standard library.

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.
  • Line endings compliant (newline="\n").

AI-assisted: yes.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • Standard library only (runs cleanly with python -I).
**@⁠Tortoche** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/872) `Tortoche:feat/bcpack-bc7-rans` → `main` · +448 −0 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-BCPACK-STRESS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Adds `tests/test_bcpack_stress.py` providing adversarial and mutational stress testing for the BCPack rANS texture decompression pipeline: - **Prefix byte truncation testing**: Validates 100% prefix byte truncations across single-fragment and multi-fragment streams for all active codecs (BC1, BC3, BC4, BC5, BC6H, BC7), ensuring clean `BcpackError` raising without unhandled internal tracebacks or silent corruption. - **Corrupt header and state transition fuzzing**: Validates malformed frequency headers, out-of-order symbol tables, non-canonical state transitions, and virtual zero boundary limits. - **Block payload bit mutation**: Verifies corrupt payloads fail cleanly and safely during block reconstruction. - **Zero retail game data**: All synthetic streams and test fixtures are generated procedurally using the Python standard library. ### 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. - Line endings compliant (`newline="\n"`). AI-assisted: yes. ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [x] Standard library only (runs cleanly with `python -I`).
- Validate 100% prefix byte truncations across single-fragment and multi-fragment streams for all active codecs (BC1, BC3, BC4, BC5, BC6H, BC7)
- Stress-test corrupt frequency headers, non-canonical state transitions, and virtual zero boundary limits
- Verify block payload corruption and rebuilder validation ensuring malformed bitstreams cleanly raise BcpackError without leaking unhandled exceptions
- 20/20 test suites passing cleanly with stdlib-only verification and zero game data
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:35 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:57 UTC · original · approved these changes

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.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/872#pullrequestreview-6041624801) · **approved these changes** 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/872/head:github-bot/gh-872'
git switch 'github-bot/gh-872'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-872'
git switch 'github-bot/gh-872'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-872'
git switch 'github-bot/gh-872'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-872'
git switch 'main'
git merge --squash 'github-bot/gh-872'
git switch 'main'
git merge --ff-only 'github-bot/gh-872'
git switch 'main'
git merge 'github-bot/gh-872'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.