Scripts: harden gen_gdk_table CLI argument handling and output option #1257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1267"
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-24T13:59:52Z.
Harden
scripts/gen_gdk_table.pyargument parsing and output configuration:-hand--helpflags, printing the script's docstring usage and exiting with code 0.IndexError.sys.stderrwhen the file is missing or contains no matching GDK API table rows (exit code 1) instead of crashing with unhandled tracebacks.[out_rs]to write output to a custom destination instead of strictly hardcodingcrates/xcl/src/hle/xgameruntime/gdk_table.rs.scripts/test_gen_gdk_table.pycovering CLI help, missing argument handling, invalid file reporting, custom output path writing, and table sorting/hex formatting.Tested
python -B -m unittest discover -s scripts -p "test_*.py" -v: 17 passed, 0 failed.scripts/gen_gdk_table.py --help(exits 0 with usage docstring).scripts/gen_gdk_table.pywith no args (exits 2 with usage docstring).scripts/gen_gdk_table.py nonexistent.txt(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_gdk_table.py, ran the test suite, and verified PR conventions.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:05:31Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T14:35:44Z.
Tested
4859ec4bb5cb819eb477ee46e332235380e4ca00withpython -B scripts/gen_gdk_table.py <input> <output>from a different working directory. With the three-row synthetic table, a Unicode directory and a spaced output name worked. Two runs produced byte-identical LF output with the slots in numeric order. The default repository table remained unchanged. The fixture used UTF-8 subprocess I/O.The eight original generator tests passed. Three additional CLI cases exited 1 with a Python traceback: invalid UTF-8 input, an existing directory used as the output filename, and a regular file used as the output’s parent. A text input with no rows already gave a concise error.
Fix and regression tests. The three new failure cases reproduced on the PR head. After the change all three gave path-specific stderr diagnostics and exit 1, and invalid input preserved the previous output bytes.
python -B -m unittest discover -s scripts -p "test_*.py"passed all 19 tests.Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. No proprietary GDK input, Rust build, retail title or GPU workload. OpenAI Codex (GPT-6) ran the checks, prepared the patch and wrote this report.
Follow-up on the latest review
I reproduced review 6068893182 on the PR head. With a valid one-row synthetic input and an existing output file, adding one extra argument returned 0 and overwrote the file.
The candidate checks arity before opening either path. The same command now exits 2 and preserves every byte. Both supported invocations (explicit and default output) still generated identical Rust tables in an isolated directory. The full Python script discovery run passed all 18 tests, including the new regression.
Candidate commit 2cf7b91f is based directly on
4859ec4bb5cb. Reproduce withpython -B -m unittest discover -s scripts -p test_*.py. OpenAI Codex (GPT-6) prepared the fix and ran these Windows CPU fixtures. No game, GPU benchmark or workspace build.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:15:16Z.
Review: COMMENTED
Could
mainreject surplus positional arguments before opening the output? The new usage lists one required input and one optional output, butgen_gdk_table.py table.txt existing.rs unexpectedtakesargs[1], ignoresargs[2], and overwritesexisting.rsas if the invocation were valid. A CLI fixture with a sentinel output could check for a usage error and unchanged bytes. Source review only at head4859ec4b; I did not run the script. AI-assisted with Codex (GPT-6.2 Sol).Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:43:36Z.
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:17:15Z.
Triage (#1607) – head
4859ec4No other open PR changes scripts/gen_gdk_table.py; the other "harden ... CLI" PRs touch different generators. The default output is byte-for-byte the same as before (same header, row order and trailing newline).
Minor:
DEFAULT_OUTis imported in the test but not used.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.