Repository navigation
opus_tags: validate Ogg checksums before replacing tags - #6561
Conversation
|
Checked on macOS 27.2.1 / Apple M1 Max, Python 3.15.2, CPU only: replicated, with one better number than the PR's own run.
AI-assisted (OpenCode / DeepSeek V4.1 Flash + GLM-5.3): the agent ran the battery and the negative control sandboxed. |
|
Independent Windows check of head 2bb4302 with Python 3.14.6: CPU only, synthetic fixtures, no game data. AI-assisted (Hy4 flash). |
|
Tested 2bb4302 merged with main 042c5f3 on Linux/Python 3.12.16: pass Merge was clean (tools/opus_tags.py, tests/test_opus_tags.py).
Diff read: |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
tools/opus_tags.py adds checked_pages(), which verifies every Ogg page's checksum with ogg_crc before its bytes are copied, and retag() now exhausts the audio tail before publishing a replacement. Corrupt or truncated files raise ValueError and are skipped unchanged by tag_folder, including dry runs. tests/test_opus_tags.py covers flipped checksum bytes on header/tags/audio pages, a truncated tail, and the skipped-file stats.
Why merge
Stops a bad CRC from being silently rewritten into a new file; validation happens before any write and tests cover both detection paths.
Verdict: Approve
Summary
Why mergeStops a bad CRC from being silently rewritten into a new file; validation happens before any write and tests cover both detection paths. Verdict: Approve |
opus_tags accepted Ogg pages with corrupt checksums and could replace their tags, making the damaged page look newly valid. Validate Ogg page CRCs before publishing a replacement, including the copied audio tail, and reject truncated tails. Corrupt streams are counted as skipped and left byte-identical in both normal and dry-run mode; other named streams can still be tagged.
Uses the existing awc_opus Ogg CRC implementation. Validation adds one linear checksum pass over the file, with scratch memory bounded by one Ogg page. No codec or audio re-encoding changes.
Validation:
python -I tests/test_opus_tags.py: 23 run, 22 pass; one pre-existing Windows path-format failure intest_cli_reports_incomplete_directory_discovery, reproduced on clean upstream (19/20 pass). tools: print Windows paths in error messages without repr() doubling #6049/tools: print a refused or unreadable path as typed, not through repr() (5 tests fail on Windows) #5927 already address this unrelated formatting work.Claim: #6414 (comment) (new item; ID pending). No PR dependencies.
Windows, Python 3.14.10; CPU only, no GPU/driver required and no game files. AI-assisted: Codex implementation and testing; Claude static patch review. Review follow-ups were checked locally (existing Opus error-key normalization and preserved Unicode test text). Claude did not execute tests.
Common checks: compileall (
make_game.py tools tests),python -I make_game.py --help, andgit diff --checkpassed. The repository-wide text-newline check has one existing failure attools/f64_omod_probe.py:268; reproduced on clean upstream696cce455as well as this branch. That file is untouched.