Scripts: harden gen_bcpack_victory_tables CLI argument handling and output option #1440
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1440
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@heditrigui on GitHub · 2026-11-24 15:59 UTC · original
heditrigui:scripts/gen-bcpack-victory-tables-cli-hardening→main· +171 −7 · 2 files · 1 commits · openHarden
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.@nnonno91 on GitHub · 2026-11-24 16:08 UTC · original
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
@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
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!
@RavenCurseBurg on GitHub · 2026-11-25 16:12 UTC · original
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.
@ -149,0 +159,4 @@def main(argv=None):args = argv if argv is not None else sys.argv[1:]@gut0to on GitHub · 2026-11-24 17:06 UTC · original
The 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.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.