Scripts: harden bcpack vector generator CLI handling and add unit test suite #2139

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

@⁠heditrigui on GitHub · 2026-11-25 06:00 UTC · original
heditrigui:scripts/bcpack-vector-gen-cli-hardening → main · +168 −10 · 2 files · 1 commits · open

Summary

Hardens CLI argument handling in tests/data/bcpack/generate.py and adds an automated unit test suite:

  • CLI argument handling: adds main(argv=None) supporting -h/--help docstring, --out-dir / -o (defaulting to tests/data/bcpack/), and --mode / -m (selective generation for modes 1, 3, 4, 5, 6, 7).
  • Modular generator API: updates generate() with out_dir parameter and adds generate_all(), allowing generation into isolated directories without mutating repository fixtures.
  • Test suite: adds scripts/test_bcpack_generate.py with 11 unit tests covering CLI flags, invalid mode exits, custom output directory generation, byte parity with committed fixtures, rANS encoding, delta prediction, and BC1 packaging.

Tested

  • python -m pytest scripts/ (36 passed in 1.05s).
  • Validated with scripts/pr_check.py --local.

Not tested

  • Retail game smoke execution (scripts/ and test vector tooling are non-runtime code).

AI use

  • Antigravity (Gemini 3.8 Flash (High))
**@⁠heditrigui** on GitHub · 2026-11-25 06:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/2139) `heditrigui:scripts/bcpack-vector-gen-cli-hardening` → `main` · +168 −10 · 2 files · 1 commits · open ### Summary Hardens CLI argument handling in `tests/data/bcpack/generate.py` and adds an automated unit test suite: - CLI argument handling: adds `main(argv=None)` supporting `-h`/`--help` docstring, `--out-dir` / `-o` (defaulting to `tests/data/bcpack/`), and `--mode` / `-m` (selective generation for modes 1, 3, 4, 5, 6, 7). - Modular generator API: updates `generate()` with `out_dir` parameter and adds `generate_all()`, allowing generation into isolated directories without mutating repository fixtures. - Test suite: adds `scripts/test_bcpack_generate.py` with 11 unit tests covering CLI flags, invalid mode exits, custom output directory generation, byte parity with committed fixtures, rANS encoding, delta prediction, and BC1 packaging. **Tested** - `python -m pytest scripts/` (36 passed in 1.05s). - Validated with `scripts/pr_check.py --local`. **Not tested** - Retail game smoke execution (`scripts/` and test vector tooling are non-runtime code). **AI use** - Antigravity (Gemini 3.8 Flash (High))
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:16 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 06:49 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 06:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7155193687) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 11:03 UTC · original

Code review on f121cb7 (tests/data/bcpack/generate.py, scripts/test_bcpack_generate.py):

  • Refactoring generate / generate_all / main cleanly adds --out-dir and --mode CLI filtering without changing output payloads (verified byte-identical against committed .bin / .lanes fixtures in the 11 new tests), and both CI checks are green.

Remaining before merge: Independent Windows/Python verification of scripts/test_bcpack_generate.py on f121cb7 (the prior --lib run did not execute the Python test suite).

**@⁠raylitebull** on GitHub · 2026-11-25 11:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7160526647) Code review on `f121cb7` (`tests/data/bcpack/generate.py`, `scripts/test_bcpack_generate.py`): - Refactoring `generate` / `generate_all` / `main` cleanly adds `--out-dir` and `--mode` CLI filtering without changing output payloads (verified byte-identical against committed `.bin` / `.lanes` fixtures in the 11 new tests), and both CI checks are green. **Remaining before merge:** Independent Windows/Python verification of `scripts/test_bcpack_generate.py` on `f121cb7` (the prior `--lib` run did not execute the Python test suite).
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 11:43 UTC · original · edited 2026-11-25 11:50 UTC

Tested f121cb7692513f6304867c6fceadc03ed9d1fa95 on Windows 11 24H2 (26100.9711), i7-13700, Python 3.14.3.

Tested

  • python -B -m unittest discover -s scripts -p test_bcpack_generate.py passed all 11 tests (0 failures, 0 skips).
  • Ran the parent generator (6e1e2be) and the PR generator in separate temporary directories. Their full runs produced the same 31 filenames and 46,460 bytes of identical payloads. All 26 tracked .bin and .lanes files matched their Git blobs. The five generated .bc1 files matched the parent generator byte for byte as well.
  • Ran the PR CLI independently with --out-dir <fresh-dir> --mode N for each supported mode. Modes 1, 3, 4, 5, 6 and 7 produced 16, 2, 2, 2, 2 and 7 files respectively. Each directory matched exactly the corresponding subset of the full run in both names and bytes.

Not tested

Runtime decompression, Rust/GPU workspace tests or retail assets.

AI use

OpenAI Codex (GPT-6) ran the upstream tests, wrote the independent byte comparisons and prepared this report.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 11:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7161409731) · edited 2026-11-25 11:50 UTC Tested `f121cb7692513f6304867c6fceadc03ed9d1fa95` on Windows 11 24H2 (26100.9711), i7-13700, Python 3.14.3. **Tested** - `python -B -m unittest discover -s scripts -p test_bcpack_generate.py` passed all 11 tests (0 failures, 0 skips). - Ran the parent generator (`6e1e2be`) and the PR generator in separate temporary directories. Their full runs produced the same 31 filenames and 46,460 bytes of identical payloads. All 26 tracked `.bin` and `.lanes` files matched their Git blobs. The five generated `.bc1` files matched the parent generator byte for byte as well. - Ran the PR CLI independently with `--out-dir <fresh-dir> --mode N` for each supported mode. Modes 1, 3, 4, 5, 6 and 7 produced 16, 2, 2, 2, 2 and 7 files respectively. Each directory matched exactly the corresponding subset of the full run in both names and bytes. **Not tested** Runtime decompression, Rust/GPU workspace tests or retail assets. **AI use** OpenAI Codex (GPT-6) ran the upstream tests, wrote the independent byte comparisons and prepared this report.
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/2139/head:github-bot/gh-2139'
git switch 'github-bot/gh-2139'

Merge

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