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

Merged
narekshaghoyandev merged 1 commit from upstream-pr/876 into main 2026-11-24 21:04:19 +00:00
narekshaghoyandev commented 2026-11-24 14:53:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-24T14:53:40Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474533881 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/876). Originally posted by [narekshaghoyandev](https://github.com/narekshaghoyandev) on 2026-11-24T14:53:40Z. --- 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 commented 2026-11-24 14:55:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T14:55:09Z.

Review: APPROVED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041581747 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/876#pullrequestreview-6041581747). Originally posted by [KernelSmoker](https://github.com/KernelSmoker) on 2026-11-24T14:55:09Z. **Review:** APPROVED --- 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 commented 2026-11-24 14:56:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:56:40Z.

Review: 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041610021 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/876#pullrequestreview-6041610021). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:56:40Z. **Review:** 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T21:04:16Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7144435658 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/876#issuecomment-7144435658). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T21:04:16Z. --- 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 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
ProjectLeonida/mandy!876
No description provided.