audio_config: scan individual configuration files in bounded chunks #2448

Merged
kirigayakazima merged 1 commit from upstream-pr/2448 into main 2026-11-28 15:14:02 +00:00
kirigayakazima commented 2026-11-27 10:34:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-27T10:34:11Z.


Claimed in the coordination issue as: AUDIO-CONFIG-STREAM-SINGLE-BLOBS

What and why

The ordinary scan loaded each complete config blob and examined it byte by byte. Reuse the existing incremental marker scanner for each file, resetting offsets at file boundaries. Records spanning read boundaries are recovered. In separate processes, scanning an 8 MiB zero-filled synthetic file gave zero records in both cases and reduced the traced allocation peak from 8,520,807 to 2,230,022 bytes.

Tested

Windows, Python 3.14.7. The regression reproduced on the parent and passed with the change.

  • python -I tests/test_audio_config.py
  • Changed-path no-game-data scan and git diff --check passed.

The integrated checkout passed 6,374 semantic tests across 500 files. An extra 500 randomized synthetic cases matched the in-memory scanner. CI's macOS job failed in the calibrated-texture replacement test, as it did on the unchanged main baseline.

GPUs tested: N/A (CPU-only synthetic tests).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5525147492 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2448). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-27T10:34:11Z. --- Claimed in the coordination issue as: [AUDIO-CONFIG-STREAM-SINGLE-BLOBS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215934316) ### What and why The ordinary scan loaded each complete config blob and examined it byte by byte. Reuse the existing incremental marker scanner for each file, resetting offsets at file boundaries. Records spanning read boundaries are recovered. In separate processes, scanning an 8 MiB zero-filled synthetic file gave zero records in both cases and reduced the traced allocation peak from 8,520,807 to 2,230,022 bytes. ### Tested Windows, Python 3.14.7. The regression reproduced on the parent and passed with the change. - `python -I tests/test_audio_config.py` - Changed-path no-game-data scan and `git diff --check` passed. The integrated checkout passed 6,374 semantic tests across 500 files. An extra 500 randomized synthetic cases matched the in-memory scanner. CI's macOS job failed in the calibrated-texture replacement test, as it did on the [unchanged main baseline](https://github.com/ubiquitarianism/leonida/actions/runs/45977772928/job/140433726198). GPUs tested: N/A (CPU-only synthetic tests). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
MSedgeMC commented 2026-11-27 15:05:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-27T15:05:26Z.

Review: COMMENTED


Verified on the PR branch: python3 -m unittest tests.test_audio_config -v -> 23 tests OK, including the new bounded-chunk scanning cases. Not approving yet: the branch is 606 commits behind current main, so a rebase is needed before reviewing the final diff.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6090094100 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2448#pullrequestreview-6090094100). Originally posted by [MSedgeMC](https://github.com/MSedgeMC) on 2026-11-27T15:05:26Z. **Review:** COMMENTED --- Verified on the PR branch: python3 -m unittest tests.test_audio_config -v -> 23 tests OK, including the new bounded-chunk scanning cases. Not approving yet: the branch is 606 commits behind current main, so a rebase is needed before reviewing the final diff.
zmasi commented 2026-11-28 09:46:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:46:36Z.


#2448 | head fc4f6311a4 (merged cleanly with main 3ca0707dd) | python -I tests/test_audio_config.py | red on main: FAILED (failures=2) (AssertionError: unbounded read: -1 in test_individual_files_use_bounded_reads and 0 != 1) | green on PR+main: 23 tests OK (-k test_individual_files_use_bounded_reads: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _file_chunks and collect in tools/audio_config.py (streaming individual .bin files through scan_stream(_file_chunks(path)) in JOIN_BLOCK_BYTES chunks instead of reading full blobs into memory, resolving the earlier staleness hold against current main 3ca0707dd). Also passed tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py on the merged tree.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237458096 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2448#issuecomment-7237458096). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T09:46:36Z. --- #2448 | head fc4f6311a449bfc308237da1b7a548d4830f5f19 (merged cleanly with main 3ca0707dd) | `python -I tests/test_audio_config.py` | red on main: `FAILED (failures=2)` (`AssertionError: unbounded read: -1` in `test_individual_files_use_bounded_reads` and `0 != 1`) | green on PR+main: `23 tests OK` (`-k test_individual_files_use_bounded_reads`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_file_chunks` and `collect` in `tools/audio_config.py` (streaming individual `.bin` files through `scan_stream(_file_chunks(path))` in `JOIN_BLOCK_BYTES` chunks instead of reading full blobs into memory, resolving the earlier staleness hold against current `main` `3ca0707dd`). Also passed `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py` on the merged tree.
MoonEyes commented 2026-11-28 15:13:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T15:13:59Z.


Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head fc4f6311a4 unchanged since 2026-11-27, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241306537 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2448#issuecomment-7241306537). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T15:13:59Z. --- Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head fc4f6311a449 unchanged since 2026-11-27, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. 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!2448
No description provided.