Scripts: harden gen_bcpack_victory_tables CLI argument handling and output option #1430
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1440"
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 ivall/xcl. Originally posted by heditrigui on 2026-11-24T15:59:17Z.
Harden
scripts/gen_bcpack_victory_tables.pyargument parsing and output configuration:-hand--helpflags, printing the script's docstring usage and exiting with code 0.IndexError.sys.stderrwhen<bcpack-tables.bin>is missing or has an unexpected size (exit code 1) instead of crashing with unhandled tracebacks.[out.rs]to write output to a custom destination, defaulting tocrates/xcl/src/hle/bcpack/tables.rs.scripts/test_gen_bcpack_victory_tables.pycovering CLI help, missing argument handling, invalid file reporting, custom output path writing, and synthetic table binary parsing.Tested
python -B -m unittest discover -s scripts -p "test_*.py" -v: 23 passed, 0 failed.scripts/gen_bcpack_victory_tables.py --help(exits 0 with usage docstring).scripts/gen_bcpack_victory_tables.pywith no args (exits 2 with usage docstring).scripts/gen_bcpack_victory_tables.py nonexistent.bin(exits 1 with clear diagnostic).scripts/pr_check.py --local.Not tested
scripts/and does not touch runtime code or dependencies.AI use
Antigravity (Gemini 3.8 Flash (High)) designed the CLI argument handling and optional output destination, implemented unit tests in
scripts/test_gen_bcpack_victory_tables.py, ran the test suite, and verified PR conventions.Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-24T16:08:11Z.
Windows CLI test report for
ab7a400Tested
python -B -m unittest discover -s scripts -p "test_*.py" -vpassed 23 tests on clean headab7a400c70bb334fac520c8bcc50573c19d4ddb4.python -I. For two 77,982-byte synthetic inputs (zero-filled and seeded), the explicit output from the parent commit037aecd57e8a2ae55154d5e0dfb7119e75430f5b, the PR’s explicit output, and the PR’s default output were byte-for-byte identical. The explicit PR path included spaces and a new subdirectory. I tested the default destination in a temporary copy.IndexError; the PR printed usage and exited2. Both-hand--helpprinted usage and exited0on the PR.1without a traceback for a missing file and for 0-, 77,981-, and 77,983-byte inputs. Those cases left an existing default output byte-for-byte intact and created no file at a new explicit destination.Not tested
AI use
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T17:06:21Z.
Review: COMMENTED
AI-assisted review; I checked the CLI argument flow against the documented usage.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T17:06:21Z.
Code review location:
scripts/gen_bcpack_victory_tables.py; line 162The documented usage accepts an input file and at most one optional output path, but
mainnever rejects arguments afterargs[1]. A command with an extra positional argument silently ignores it and exits successfully, which can hide a typo. Please reject unexpected arguments and add a CLI test. AI-assisted review; I checked the documented usage against the argument handling.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:52:34Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T16:12:43Z.
I reproduced the extra-argument issue reported above on
ab7a400c70bb334fac520c8bcc50573c19d4ddb4. With a 77,982-byte synthetic table,python -I scripts/gen_bcpack_victory_tables.py input.bin output.rs extrareturned 0 and replaced an existing 15-byte output with 258,080 bytes.Fix and CLI regression test. The generator now rejects the extra positional argument before opening the destination, writes the diagnostic to stderr and exits 2. The test starts with a sentinel output and checks its exact bytes. It failed before the fix (exit 0) and passed after. All 24 Python script tests passed with
python -B -m unittest discover -s scripts -p "test_*.py";git diff --checkalso passed.Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. Synthetic table data only; no game, Rust or GPU run. OpenAI Codex (GPT-6) wrote the patch and ran the checks.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:17:38Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:45:35Z.
Triage (#1607) – head
ab7a400No open PR changes gen_bcpack_victory_tables.py; the lines shared with #1336 are the same CLI pattern (help text, default output, error exit codes) applied to a different script, gen_d3d12_layout.py.
No problems found in the diff: TABLES_BIN_SIZE (77982) matches what generate() consumes, and the default output path is the existing crates/xcl/src/hle/bcpack/tables.rs. main has since changed the BC7 loop in this script (
7881dbc, entry 0 keeps 32 indices); the size is unchanged, but the synthetic test blob should be rechecked against it after a rebase.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.