awc_markers: reject incomplete reads (AWC-MARKERS-SHORT-READ) #1159

Open
github-bot wants to merge 1 commit from github-bot/gh-1159 into main AGit
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-24 19:22 UTC · original
Taffyyy-ops:fix/awc-markers-short-read → main · +52 −1 · 2 files · 1 commits · open

Item ID: AWC-MARKERS-SHORT-READ

Rejects truncated or short reads in tools/awc_markers.py by raising OSError instead of silently parsing incomplete windows or returning partial counts with exit code 0.

Changes

  • tools/awc_markers.py (iter_banks, _read): Checks that fh.read(WINDOW + 3) returns at least min(WINDOW + 3, size - pos) bytes during bank scanning and that _read(fh, at, size) returns all size bytes, raising descriptive OSError exceptions on short reads.
  • tests/test_awc_markers_short_read.py: Adds synthetic tests verifying OSError on truncated bank scans as well as truncated marker and metadata chunk reads.

Verification

  • AI-assisted; synthetic tests only, no game data (python -I scripts/check_no_game_data.py).
**@⁠Taffyyy-ops** on GitHub · 2026-11-24 19:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1159) `Taffyyy-ops:fix/awc-markers-short-read` → `main` · +52 −1 · 2 files · 1 commits · open Item ID: `AWC-MARKERS-SHORT-READ` Rejects truncated or short reads in `tools/awc_markers.py` by raising `OSError` instead of silently parsing incomplete windows or returning partial counts with exit code `0`. ### Changes - **`tools/awc_markers.py` (`iter_banks`, `_read`):** Checks that `fh.read(WINDOW + 3)` returns at least `min(WINDOW + 3, size - pos)` bytes during bank scanning and that `_read(fh, at, size)` returns all `size` bytes, raising descriptive `OSError` exceptions on short reads. - **`tests/test_awc_markers_short_read.py`:** Adds synthetic tests verifying `OSError` on truncated bank scans as well as truncated marker and metadata chunk reads. ### Verification - AI-assisted; synthetic tests only, no game data (`python -I scripts/check_no_game_data.py`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:40:51 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:23 UTC · original · approved these changes

Reviewed and verified. Robust error handling for truncated audio streams in tools/awc_markers.py. Explicitly validates buffer lengths against expected window sizes in iter_banks and _read, raising OSError on short read and preventing partial/corrupted scans from completing with exit 0. Verified with tests/test_awc_markers_short_read.py. 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1159#pullrequestreview-6045862292) · **approved these changes** Reviewed and verified. Robust error handling for truncated audio streams in tools/awc_markers.py. Explicitly validates buffer lengths against expected window sizes in iter_banks and _read, raising OSError on short read and preventing partial/corrupted scans from completing with exit 0. Verified with tests/test_awc_markers_short_read.py. 100% clean-room.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:12 UTC · original

Recommendation: [MERGE]

Reasoning: awc_markers rejects incomplete reads instead of parsing truncated data. Tiny tool hardening with a synthetic test; minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1159#issuecomment-7143181103) **Recommendation:** [MERGE] **Reasoning:** `awc_markers` rejects incomplete reads instead of parsing truncated data. Tiny tool hardening with a synthetic test; minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Author
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-25 10:45 UTC · original

@⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and [MERGE] recommendation! Updated the PR description with a full summary of the short-read checks in tools/awc_markers.py and tests/test_awc_markers_short_read.py.

**@⁠Taffyyy-ops** on GitHub · 2026-11-25 10:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1159#issuecomment-7160125456) @⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and `[MERGE]` recommendation! Updated the PR description with a full summary of the short-read checks in `tools/awc_markers.py` and `tests/test_awc_markers_short_read.py`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1159/head:github-bot/gh-1159'
git switch 'github-bot/gh-1159'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1159'
git switch 'github-bot/gh-1159'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1159'
git switch 'github-bot/gh-1159'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1159'
git switch 'main'
git merge --squash 'github-bot/gh-1159'
git switch 'main'
git merge --ff-only 'github-bot/gh-1159'
git switch 'main'
git merge 'github-bot/gh-1159'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.