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

Open
heditrigui wants to merge 1 commit from upstream-pr/2139 into main
heditrigui commented 2026-11-25 06:00:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by heditrigui on 2026-11-25T06:00:50Z.


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))
<!-- greyfinch-sync:ivall/xcl:issue:5486070644 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-11-25T06:00:50Z. --- ### 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))
DavidM1911 commented 2026-11-25 07:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:49:19Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7155193687 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7155193687). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T06:49:19Z. --- 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!
raylitebull commented 2026-11-25 11:09:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T11:03:21Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7160526647 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7160526647). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T11:03:21Z. --- 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).
RavenCurseBurg commented 2026-11-25 12:06:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T11:43:10Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7161409731 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7161409731). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T11:43:10Z. --- 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.
github-actions[bot] commented 2026-11-29 07:41:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:41:58Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252634784 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7252634784). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:41:58Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 07:28:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:28:00Z.


Triage (#1607) – head f121cb7

No open or merged PR changes the BCPack vector generator (tests/data/bcpack/generate.py). The refactor keeps the default output in ROOT, and the new tests compare regenerated .bin/.lanes files byte-for-byte with the committed fixtures, so the existing vectors are checked to stay the same. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304090192 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2139#issuecomment-7304090192). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:28:00Z. --- **Triage (#1607)** – head f121cb7 No open or merged PR changes the BCPack vector generator (`tests/data/bcpack/generate.py`). The refactor keeps the default output in `ROOT`, and the new tests compare regenerated `.bin`/`.lanes` files byte-for-byte with the committed fixtures, so the existing vectors are checked to stay the same. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2139:upstream-pr/2139'
git switch 'upstream-pr/2139'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2139'
git switch 'upstream-pr/2139'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2139'
git switch 'upstream-pr/2139'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2139'
git switch 'main'
git merge --squash 'upstream-pr/2139'
git switch 'main'
git merge --ff-only 'upstream-pr/2139'
git switch 'main'
git merge 'upstream-pr/2139'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2129
No description provided.