Scripts: accept unprefixed command-writer branch addresses #1082

Merged
anakatt merged 1 commit from upstream-pr/1091 into main 2026-11-24 15:51:50 +00:00
anakatt commented 2026-11-24 11:27:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by anakatt on 2026-11-24T11:27:52Z.


I fixed the record-writer scanner ignoring matching AT&T listings when a jae target is written as a bare hexadecimal address instead of 0x.... It previously printed 0 record write sites for the synthetic unprefixed case.

What is in it

  • scripts/re/record_writers.py: accept branch targets with or without 0x.
  • scripts/test_record_writers.py: run the CLI on both spellings and check the decoded header, record length, bound and fallback slot. No game disassembly is included.

Tested

  • macOS Darwin 24.6.0, arm64; Python 3.15.2. No GPU used.

  • python3 -B -m unittest discover -s scripts -p test_record_writers.py -v: before the fix, the unprefixed case failed and the prefixed case passed; afterward 1 test passed, 0 failed, 0 skipped (two address-format subcases).

  • Windows 11 Pro ARM64 10.0.26100.1742 in UTM, Python 3.14.0 ARM64; no GPU used. Exact source archive de85f979cba9e8c15c220f21b6b228efb8047010: C:\xcl-tests\python\python.exe -B -m unittest discover -s scripts -p test_record_writers.py -v: 1 passed, 0 failed, 0 skipped (two subcases). The Windows run also verified the corrected subprocess decoding.

Not tested

  • Real game disassembly and the Rust/GPU suite. This changes only a Python analysis script and its regression test.

AI use

  • I used omp (openai-codex/gpt-6-astra) to find the parser mismatch, write the fix and synthetic regression, run the Python test, and prepare this description.
<!-- greyfinch-sync:ivall/xcl:issue:6580739930 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1091). Originally posted by [anakatt](https://github.com/anakatt) on 2026-11-24T11:27:52Z. --- I fixed the record-writer scanner ignoring matching AT&T listings when a `jae` target is written as a bare hexadecimal address instead of `0x...`. It previously printed `0 record write sites` for the synthetic unprefixed case. **What is in it** - `scripts/re/record_writers.py`: accept branch targets with or without `0x`. - `scripts/test_record_writers.py`: run the CLI on both spellings and check the decoded header, record length, bound and fallback slot. No game disassembly is included. **Tested** - macOS Darwin 24.6.0, arm64; Python 3.15.2. No GPU used. - `python3 -B -m unittest discover -s scripts -p test_record_writers.py -v`: before the fix, the unprefixed case failed and the prefixed case passed; afterward 1 test passed, 0 failed, 0 skipped (two address-format subcases). - Windows 11 Pro ARM64 10.0.26100.1742 in UTM, Python 3.14.0 ARM64; no GPU used. Exact source archive `de85f979cba9e8c15c220f21b6b228efb8047010`: `C:\xcl-tests\python\python.exe -B -m unittest discover -s scripts -p test_record_writers.py -v`: 1 passed, 0 failed, 0 skipped (two subcases). The Windows run also verified the corrected subprocess decoding. **Not tested** - Real game disassembly and the Rust/GPU suite. This changes only a Python analysis script and its regression test. **AI use** - I used omp (`openai-codex/gpt-6-astra`) to find the parser mismatch, write the fix and synthetic regression, run the Python test, and prepare this description.
futurepro62 commented 2026-11-24 15:05:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:15:38Z.


Tested exact head de85f97, script tests only, since this PR has no test report yet.

Tested

  • Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here).
  • python -m pytest scripts/test_record_writers.py at the head: 1 passed, 2 subtests passed.
  • The PR's test file(s) against current main's script (930e8b4): fails for the unprefixed target (180001030 <fallback>) of test_branch_targets_with_and_without_hex_prefix. So the new test catches the problem the PR fixes.
  • Same fix as #1094 (opened three minutes later): both change the jae regex to (?:0x)?([0-9a-f]+); #1094 adds \b. The two PRs conflict, so only one can land.

Not tested

  • PowerShell 7, the CI workflow itself, a game (no runtime code changed).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7134089362 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1091#issuecomment-7134089362). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:15:38Z. --- Tested exact head `de85f97`, script tests only, since this PR has no test report yet. **Tested** - Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here). - `python -m pytest scripts/test_record_writers.py` at the head: 1 passed, 2 subtests passed. - The PR's test file(s) against current main's script (`930e8b4`): fails for the unprefixed target (`180001030 <fallback>`) of `test_branch_targets_with_and_without_hex_prefix`. So the new test catches the problem the PR fixes. - Same fix as #1094 (opened three minutes later): both change the `jae` regex to `(?:0x)?([0-9a-f]+)`; #1094 adds `\b`. The two PRs conflict, so only one can land. **Not tested** - PowerShell 7, the CI workflow itself, a game (no runtime code changed). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
upstream-sync closed this pull request 2026-11-24 16:05:54 +00:00
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!1082
No description provided.