OLD-7279: script_qtable: sort _BinFolderSource hex offsets numerically, skip .bin subdirs, and sort type_query histograms numerically #876

Merged
leonida/mandy
narekshaghoyandev merged 1 commit from ubiq-script-qtable-bin-folder-order into main 2026-11-24 21:04:19 +00:00

Pull request successfully merged and closed

narekshaghoyandev commented 2026-11-24 14:53:40 +00:00

Reopening my original upstream PR #7279 (previously verified on Windows 11 Py3.12/3.15 and Linux by @AsgerCode, @memorypressure, and @airp1ane), cleanly rebased onto main:

  1. Sort _BinFolderSource hex offsets numerically & skip .bin subdirectories: Avoids lexicographic reversal of mixed-width/mixed-case hex .bin names when joining split 64 KiB streams, and skips subdirectories whose names end with .bin instead of crashing on open (IsADirectoryError / PermissionError).
  2. Sort type_query histograms numerically: Orders numeric histogram keys (size, count, etc.) numerically instead of lexicographically ("112" before "32").

Verification

  • python3 -I tests/test_script_qtable.py -v: 10/10 pass (both new tests fail/error against main).
  • python3 -I scripts/check_no_game_data.py tools/script_qtable.py tests/test_script_qtable.py: clean.
  • python3 -m compileall -q tools/script_qtable.py tests/test_script_qtable.py: clean.

Claimed in the coordination issue as: OLD-7279 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135100661)
AI-assisted: yes (Gemini)

Reopening my original upstream PR #7279 (previously verified on Windows 11 Py3.12/3.15 and Linux by `@AsgerCode`, `@memorypressure`, and `@airp1ane`), cleanly rebased onto `main`: 1. **Sort `_BinFolderSource` hex offsets numerically & skip `.bin` subdirectories**: Avoids lexicographic reversal of mixed-width/mixed-case hex `.bin` names when joining split 64 KiB streams, and skips subdirectories whose names end with `.bin` instead of crashing on open (`IsADirectoryError` / `PermissionError`). 2. **Sort `type_query` histograms numerically**: Orders numeric histogram keys (`size`, `count`, etc.) numerically instead of lexicographically (`"112"` before `"32"`). ### Verification - `python3 -I tests/test_script_qtable.py -v`: 10/10 pass (both new tests fail/error against `main`). - `python3 -I scripts/check_no_game_data.py tools/script_qtable.py tests/test_script_qtable.py`: clean. - `python3 -m compileall -q tools/script_qtable.py tests/test_script_qtable.py`: clean. Claimed in the coordination issue as: OLD-7279 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135100661) AI-assisted: yes (Gemini)
KernelSmoker approved these changes 2026-11-24 14:55:09 +00:00
KernelSmoker left a comment

Reviewed exact head 1ebe352f11d96bdd86a3dbd68baeeb8dcd70b002 against base 8f05e09e224656740e8a53f5047e1338d7a52588. The folder source now orders hex-named chunks by numeric offset, ignores .bin directories, and guards report-path checks against directory entries; histogram counts retain numeric sort order before JSON keys are rendered as strings. python3 -I tests/test_script_qtable.py -v passes 10/10; Python compilation and git diff --check pass. Synthetic inputs only, CPU-only. Hosted checks were pending at review time.

Reviewed exact head `1ebe352f11d96bdd86a3dbd68baeeb8dcd70b002` against base `8f05e09e224656740e8a53f5047e1338d7a52588`. The folder source now orders hex-named chunks by numeric offset, ignores `.bin` directories, and guards report-path checks against directory entries; histogram counts retain numeric sort order before JSON keys are rendered as strings. `python3 -I tests/test_script_qtable.py -v` passes 10/10; Python compilation and `git diff --check` pass. Synthetic inputs only, CPU-only. Hosted checks were pending at review time.
abnalstlll-byte approved these changes 2026-11-24 14:56:40 +00:00
abnalstlll-byte left a comment

Audited and verified. In ools/script_qtable.py, sorts _BinFolderSource hexadecimal chunk offsets numerically to prevent out-of-order chunk assembly across 64 KiB boundaries, skips directories matching *.bin, and ensures ype_query histogram keys are sorted numerically. Unit tests in ests/test_script_qtable.py pass cleanly. Approved.

Audited and verified. In ools/script_qtable.py, sorts _BinFolderSource hexadecimal chunk offsets numerically to prevent out-of-order chunk assembly across 64 KiB boundaries, skips directories matching *.bin, and ensures ype_query histogram keys are sorted numerically. Unit tests in ests/test_script_qtable.py pass cleanly. Approved.
QemmHD commented 2026-11-24 21:04:16 +00:00

Merging.

Why merged: OLD-7279: script_qtable sorts .bin chunk names by their numeric hex offset (not as strings), skips .bin directories, and sorts the type_query histograms numerically. KernelSmoker approved this exact head.

Why it's good: Pure Python with added isfile guards. Own tests: 10 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

Merging. **Why merged:** OLD-7279: script_qtable sorts .bin chunk names by their numeric hex offset (not as strings), skips .bin directories, and sorts the type_query histograms numerically. KernelSmoker approved this exact head. **Why it's good:** Pure Python with added isfile guards. Own tests: 10 passed. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.