Skip to content

AWC-OGG-RERUN-INVENTORY: skip stale Ogg exports - #6979

Open
Barbital11111 wants to merge 2 commits into
ItsNotRexed:mainfrom
Barbital11111:fix/awc-current-ogg-inventory
Open

Barbital11111 wants to merge 2 commits into
ItsNotRexed:mainfrom
Barbital11111:fix/awc-current-ogg-inventory

Conversation

@Barbital11111

@Barbital11111 Barbital11111 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

AWC-OGG-RERUN-INVENTORY · Coordination claim

A skipped bank or a partial re-export can leave Ogg files from a previous successful run. Directory WAV conversion used to decode those files as if they were current. The exporter now records previously produced names and the Ogg files it published on this run. The directory scanner ignores only names recorded as stale. It leaves the files on disk and still discovers untracked Ogg files and directories without an inventory.

Validation

  • Windows 11, CPython 3.14.3. Both synthetic regression scenarios reproduced on 56e607ac8 and pass after the fix: malformed-bank re-export and a write failure on the second stream. A subsequent successful two-worker export makes the generated track discoverable again.
  • AWC exporter: 58 passed. WAV decoder: 24 passed and 16 skipped. AWC manifest: 20 passed. The FFmpeg-dependent tests were skipped because FFmpeg is unavailable on PATH.
  • git diff --check and the changed-file no-game-data check passed.

Synthetic fixtures only. AI-assisted (Codex).

Main-branch integration

Merged upstream 8575d36ed into this branch, resolving the overlap with the optional music cue sheet. The export records each published music Ogg and still passes its final granule to the cue-boundary check. The combined regression starts with a current Ogg and cue record, then verifies that both are invalidated on a malformed-bank or failed-write rerun while the previous Ogg stays on disk.

On Windows 11 / CPython 3.14.3 with an existing FFmpeg 7.1 binary on the test PATH, the six audio suites ran 147 tests with 143 passed and 4 platform/filesystem skips. This includes actual FFmpeg decoding on synthetic inputs. The updated-branch diff and changed-file no-game-data check passed.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 222da71 merged with main 8575d36 on Linux/Python 3.12.16: pass

The PR head already contains main 8575d36 (the merge was a fast-forward); against main it changes tests/test_awc_markers.py, tests/test_awc_opus.py, tools/audio_wav.py, tools/awc_opus.py and adds tools/awc_ogg_inventory.py.

Commands run (-I isolated mode):

  • python -I tests/test_awc_markers.py -> Ran 11 tests, OK
  • python -I tests/test_awc_opus.py -> Ran 58 tests, OK
  • test_audio_wav.py OK (skipped=16), test_awc_cue_labels.py, test_awc_manifest.py, test_awc_names.py (skipped=1), test_awc_shorts.py -> all OK
  • Negative control: git checkout upstream/main -- tools/audio_wav.py tools/awc_opus.py (the new inventory module stays), rerun -> test_awc_markers.py FAILED (failures=2), test_awc_opus.py FAILED (failures=2). Restored with git checkout HEAD -- tools/audio_wav.py tools/awc_opus.py.

Diff read: awc_opus.py records the .ogg names it has ever written (known) and the ones from the latest run (current) in .awc-ogg.json, invalidating current before the bank is read so a failed rerun leaves nothing marked current; audio_wav.py's directory scan skips known - current files while an explicitly named input is still decoded. The inventory reader rejects malformed JSON, wrong types, or current not a subset of known with an OSError. 16 tests in test_audio_wav.py skip here (they need an Opus decoder), so the audio_wav scan change is covered only by the tests that ran.

@memorypressure

Copy link
Copy Markdown

Verified: tests/test_awc_opus.py runs Ran 58 OK merged (re-run at your rebased head 222da71, which now merges clean into 8575d36), and the two new tests fail on clean main, so the stale-.ogg skip path is genuinely exercised — and nothing is superseded: #6867, which landed mid-check and caused the earlier conflict, invalidates cue-region JSON only, while main's audio_wav.collect still decodes stale .ogg exports. The new tool is stdlib-only and the inventory writes through the staged-rename write_file. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@duudiis

duudiis commented Nov 23, 2026

Copy link
Copy Markdown

Tested 222da71 merged onto main 6f58bd2 on Windows 11 Pro, Intel i7-14700KF, CPython 3.11.0 (venv: pytest 9.2.0, numpy 2.4.6, Pillow 13.0.0; numpy is below the 2.5.5 pin because 2.5 needs Python 3.12), CPU only: pass, with notes.

  • Merge: git merge --no-ff refs/pr/6979 onto origin/main applied cleanly, no conflicts.
  • python -m pytest -q tests/test_awc_opus.py: 58 passed (main had 56, so the 2 new tests run and pass).
  • python -m pytest -q tests/test_awc_markers.py: 11 passed.
  • python -m pytest -q tests/test_audio_wav.py: 37 passed, 5 skipped.
  • python -m pytest -q tests/test_awc_manifest.py tests/test_awc_cue_labels.py tests/test_awc_shorts.py tests/test_awc_names.py: 20 passed / 2 skipped, 2 passed, 13 passed / 1 skipped, 30 passed.
  • python -I -m compileall -q on the 5 changed files: ok.
  • Regression check: with tools/awc_opus.py and tools/audio_wav.py put back to main's version, tests/test_awc_opus.py tests/test_awc_markers.py gives 4 failed, 67 passed (the 2 new test_awc_opus tests plus both subtests of test_awc_markers::test_failed_cli_rerun_clears_previous_regions). With the PR's tools, all pass, so the tests do cover the fix.
  • python -m pytest -q tests/test_text_write_line_endings.py: 1 failed, flagging tools/leonida_tui.py:753 and tools/wave_diff.py:373. Neither file is touched by this PR. This was already failing on main during the earlier run; it is not caused by this change.

Review notes:

  • tools/audio_wav.py:143-149: collect() skips any file in a folder whose name appears as stale in .awc-ogg.json. A user file that happens to reuse a generated name (for example 00000007.ogg) in that bank folder would also be skipped silently. It might be worth a short note in the docstring, or a log line when a file is skipped this way.
  • If read_inventory fails on a corrupt inventory, the OSError stops the whole directory scan. That matches how other scan errors are already handled there, so this is just a note.

AI-assisted (Claude Code).

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 222da71 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_awc_markers.py, test_awc_opus.py - all exit 0.

AI-assisted (Claude Code).

@KotikVanil KotikVanil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 222da71f on Windows x64 / Python 3.13. All 58 Opus tests passed. I reproduced a separate interruption case in a synthetic two-stream bank.

  1. Start the first export into an empty directory. In a child process, wrap write_ogg_opus so it runs the real writer and then calls os._exit(73) after the first file. The actual publish completes, then the child exits before the in-memory current.add or the inventory write.
  2. Replace the synthetic input with malformed bytes and run the exporter again. It reports a skipped bank and zero files.
  3. audio_wav.collect still schedules the first Ogg. The inventory is absent, so the directory walker classifies the published file as unrelated.

The same window applies to a new stream name added by a later export, even when an inventory exists. The old inventory cannot identify that new name. Consider recording newly owned output names as pending before publication and marking successful files current when the run finishes. That can preserve automatic discovery for files the exporter never targeted.

AI-assisted (Codex). Synthetic inputs, no game data or GPU.

@KotikVanil

Copy link
Copy Markdown

Candidate fix and abrupt-exit regression for the interruption case in my review. On Windows, the added test fails on 222da71f and passes with the patch. After the change, 59 Opus and 11 marker tests pass. The WAV suite ran 42 tests (4 skipped).

Known names require no extra write before publication. An ordinary write failure rolls back a provisional name, and an abrupt exit leaves it recorded as stale so directory decoding skips the result. AI-assisted (Codex), synthetic fixtures only.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
AWC-OGG-RERUN-INVENTORY: skip stale Ogg exports

Independent review: ItsNotRexed#6979 (comment)

Fork integration. AI-assisted (Codex).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants