tests: cover bcpack_recover_constants parsing, recovery, and SHA-256 refusal #3739
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3739
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3737"
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?
@Ammmae0x on GitHub · 2026-12-01 13:26 UTC · original
Ammmae0x:tests/bcpack-recover-constants→main· +1133 −0 · 5 files · 2 commits · merged 2026-12-01 17:06 UTCRefs #1149
Portable unit, boundary, CLI/refusal and mutation tests for
tools/bcpack_recover_constants.pywith zero edits to existing files (5 new files only, fromorigin/main5a1644ad).Note on scope: the task text named
parse_bytes/parse_ints,extract_array/extract_int_arrayand a 4096 frequency-sum recovery, but none of those exist in this script (extract_arraylives intests/bcpack_tables_check.py; the 4096 tables live intools/_bcpack_rans/bcpack_tables.py). The suite covers the script as it actually stands instead: constants,interleave/split,colour/unpack6, the wire-descriptor parser with its pinned SHA-256 gate,initializer/write_tables, the oraclequery()path, the real CLI, and a fullmain()pipeline run.Loading the script directly would run its top level (argparse with four required arguments, two ctypes CDLL loads,
wire_descriptors()against the pinned, unbundledBC6HBC7.cpp), so the check parses the real source withast, executes only its imports, constants and function definitions, and injects fakes for the rest. The SHA-256 refusal is tested with the real hashlib against a synthetic reference; synthetic descriptor fragments cover every parser path; the positive parser cases stub only the digest past the gate the refusal case pins. No fake hash or DLL bytes are written intosrc/ortools/. The full oracle pipeline still needs the installed oracle and the real reference and stays manual (seedocs/experiments/bcpack-standalone.md).What landed (commit
0a0aa818):tests/bcpack_recover_constants_check.py: 15 cases (413 assertions), plus 7 single-fault mutations applied to real copies of the script and loaded the same way (SHA gate inverted, interleave lanes swapped, LINE order changed, unpack6 bias dropped, mode 13/14 sort dropped, BC6 wire field rescaled, query guard-byte assertion dropped), all killed.--mutate <id>exits non-zero when killed, matching the CTestWILL_FAIL TRUEconvention.tests/cmake/bcpack_recover_constants.cmake: CTestbcpack_recover_constantsplus 7bcpack_recover_constants_<mut>_mutWILL_FAIL TRUEcontrols, guarded byif(EXISTS "${INTAKE_PYTHON}").tests/bcpack_recover_constants_meta_check.py: audits the contract and runs every case individually and all together, plus the exact 1:1 set of 7 CMake mutations against real mutated copies (zero model-only mutants).tests/checks/python-linux/bcpack_recover_constants.txt: wires the meta check into Linux CI.docs/experiments/bcpack-recover-constants.md: cases, mutations, and reproduction commands.Fix (commit
b96b3749, addressing the Windows verification failure on0a0aa818):FileNotFoundErrororOSErrorin stderr: Windows Python'sctypes.CDLLraisesFileNotFoundError: Could not find module ...(anOSErrorsubclass) rather than printingOSError:. Exit code 1 is still required.run_mutationsand--mutatemode now catchAssertionErroronly (all 7 controls fail viaAssertionError); a broadexcept Exceptionrisked counting an accidentalNameError/TypeErroras killed. Therun_mutationsdocstring now says so.Linux verification (this host,
/tmp/pe-envPython 3.12):python -B tests/bcpack_recover_constants_check.py—bcpack_recover_constants: 413 cases, 7/7 mutations killed PASSpython -B tests/bcpack_recover_constants_meta_check.py—PASS: bcpack_recover_constants: 15 cases, 7/7 mutations killed (subprocess --mutate)--mutate <id>exits 1 (killed); each single case exits 0.ctest -R '^bcpack_recover_constants'— 8/8 tests passed (1 check + 7WILL_FAILcontrols).python -B tests/form_coverage_check.py,tests/docs_links_check.py(208 files, 802 links),tests/bidi_controls_check.py(2826 files) — all pass;git diff --checkclean;git statusshows only the 5 new files; zero personal paths.b96b3749: check 413 cases, 7/7 killed PASS; meta 15 cases, 7/7 killed PASS; each--mutate <id>exits 1 individually; form/docs (209 files, 806 links)/bidi (2829 files) pass;git diff --checkclean; only the 5 branch files vsorigin/main; zero personal paths.No mingw on this host, so no Windows compile check; WIN-VERIFY run is the arbiter.
AI-assisted.
Windows Verification (
b96b3749)git merge-tree --write-tree upstream/main HEAD->047859fd(exit 0),git diff --checkcleanpy_compile,bcpack_recover_constants_check.py,bcpack_recover_constants_meta_check.py,form_coverage_check.py,docs_links_check.py(209 files, 806 links),bidi_controls_check.py(2829 files) passedbcpack_recover_constants:413 cases, 7/7 mutations killed PASS(15meta cases,7/7--mutatekilled);dev8/8 passed (2.67s);release8/8 passed (2.59s). AI-assisted.