Scripts: harden check_layout CLI argument handling and binary lookup #1187
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1196"
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:05:07Z.
Harden
scripts/re/check_layout.pyCLI invocation and binary lookup:-hor--help(exit code 0), and exit with code 2 on missing arguments, avoiding an unhandledIndexError.xclexecutable viaXCL_EXEenvironment variable, falling back totarget/release/xcl.exeandtarget/debug/xcl.exe.xclbinary is missing instead of throwing unhandled tracebacks.scripts/test_check_layout.pycovering CLI help flags, exit codes on missing arguments/directories/binaries, synthetic RTS0 layout parsing, and mock disassembly matching.Tested
python -B -m unittest discover -s scripts -p "test_*.py" -v: 16 passed, 0 failed.scripts/re/check_layout.py --help(exits 0 with usage docstring).scripts/re/check_layout.pywith no args (exits 2 with usage docstring).scripts/re/check_layout.py non_existent_dir(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 fallback resolution, implemented unit tests in
scripts/test_check_layout.py, ran the test suite, and verified PR conventions.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:22:00Z.
Independent verification on current
main384f7f7(branch already contains it — clean).Machine: Windows 11, Ryzen 9 7900X; Python 3.
python scripts/test_check_layout.py: 7 tests OK — covers the hardenedcheck_layoutCLI argument handling and binary lookup.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:15:59Z.
Tested exact head
5d84245, script tests only, since this PR has no test report yet.Tested
python -m pytest scripts/test_check_layout.pyat the head: 7 passed, 2 subtests passed.930e8b4): does not get to run: collection fails withFileNotFoundError, since main'scheck_layout.pyruns its scan at import time (which is what this PR changes).xcl disasmexits non-zero); this PR does not check that exit code, and the two conflict (git merge-treereports a conflict).Not tested
AI use
Imported from ivall/xcl. Originally posted by heditrigui on 2026-11-24T14:55:55Z.
Thanks for the independent test verification @futurepro62! Good catch on #1088. If maintainers prefer to land #1088 first, we can rebase this PR on top of it to incorporate both the disasm returncode check from #1088 and the CLI argument handling, binary lookup resolution, and unit tests from #1196.
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-26T01:38:41Z.
Tested
5d84245635be718805ab6dd012de8cd17c8571bfand the integration on top of this PR. The candidate carries the disassembly error handling from #1088 (d17e8d946753) and retains this PR’s executable selection.With two synthetic RTS0 files and a command-line stand-in selected via
XCL_EXE, I ran four failure cases: diagnostics on both streams, stderr only, stdout only, or neither. The current head called the stand-in twice and exited 0 in all four. The candidate stopped on the first shader and returned its exit code 23 in all four. It printed the filename, preferred stderr, used stdout when needed, and printed no successful load summary.Four successful runs on each revision counted both loads. They covered an override path containing spaces, a release-only build, debug and release present together, and an override with both present. I checked which executable actually ran.
python -B -m unittest discover -s scripts -p "test_check_layout.py"on the candidate: 8 passed, 0 failed or skipped. Windows build 26100, i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) prepared the integration and fixtures and ran the tests. No real disassembler, game, GPU or full Rust suite was exercised.Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:48:50Z.
Two contributors checked independently and found that #2151 solves the same problem in a different way: #1607, group D146. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:03:56Z.
Triage (#1607) – head
5d84245#2151 hardens the same script (scripts/re/check_layout.py) differently: it adds an
--xclflag, DXBC / RTS0 bounds validation and disassembler error handling, while this PR finds xcl throughXCL_EXEand the debug/release target dirs and adds-hand exit codes. Both rewrite the same lines, so only one can merge as is.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.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T09:22:14Z.
Two contributors checked independently and found that #1729 #2151 solves the same problem in a different way: #1607, group D237. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
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.