Skip to content

bink_names: reserve index.json before a directory becomes a carve - #6777

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
Solthodox:fix/bink-names-reserve-mount-manifest
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
Solthodox:fix/bink-names-reserve-mount-manifest

Conversation

@Solthodox

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: four media-tool items on #6603, bink_names item.

What and why

When a source or mount directory had no index.json, --out could create a names report there. The second invocation then treated that path as the carve manifest and refused to rerun; for mount directories, other lookups would switch from XML discovery to the carve reader. Reserve the root manifest path on the first run as bink_index already does, without rejecting a regular names.json.

Tested

AI-assisted: yes.

Checklist

  • No game data, keys or decryption, including in logs or reports quoted here. All fixtures were synthetic.
  • Translator-rule contract: not applicable; no translator changes.

Keep an ordinary input directory from being mistaken for a carve on the next lookup.
@Sqoutv

Sqoutv commented Nov 23, 2026

Copy link
Copy Markdown

Tested 7f53ace on Linux (Ubuntu 24.04.5 LTS, x86_64, Python 3.12.16, CPU-only, no game files): pass.

Commands run:

  • python3 -m compileall -q make_game.py tools tests (pass)
  • python3 -I tests/test_bink_names.py -v (33/33 passed)
  • python3 -I tests/test_bink_index.py -v (26/26 passed)
  • python3 -I tests/test_bink_play.py -v (8/8 passed)
  • python3 -I scripts/check_no_game_data.py tests/test_bink_names.py tools/bink_names.py and git diff --check (pass)
  • python3 -I tests/test_text_write_line_endings.py failed only on pre-existing tools/f64_omod_probe.py:268 on main; the files touched by this PR (tools/bink_names.py, tests/test_bink_names.py) have 0 violations.

Code review notes:

  • Removing the os.path.isfile(manifest) guard aligns tools/bink_names.py with tools/bink_index.py and prevents a first-run --out from turning an ordinary source or --mount directory into a carve directory on the next run.
  • Spot-checked additional CLI edge cases (--help, dangling symlink targeting <mount>/index.json, symlinked source directory <link>/index.json, hard link to an existing index.json, and repeated runs writing regular names.json inside source/mount directories); all behaved as expected.
  • Stdlib-only under python -I, synthetic fixtures only, no game data.

(AI-assisted review)

@kapitche

Copy link
Copy Markdown
Contributor

Tested 7f53ace merged with main 1cc6e3c on Linux/Python 3.12.16: pass.

Ran (venv python, -I): tests/test_bink_names.py: 33 tests OK.
tests/test_docs_*.py: all OK.

Negative control: tools/bink_names.py from main, PR tests kept: 2 failures.
Not run: native Windows.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

tools/bink_names.py:main() now reserves index.json in any source or mount directory as the carve manifest, even when that file does not yet exist: the same_output_path() guard moved outside os.path.isfile(manifest), and --out help spells out the reservation. tests/test_bink_names.py adds a loop over both folders asserting exit 2, a "carve manifest" stderr message, and no file created.

Why merge

Closes a hole where a fresh report could be written over a future carve manifest. The test covers both source and mount paths and checks the guard before any file exists.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

tools/bink_names.py:main() now reserves index.json in any source or mount directory as the carve manifest, even when that file does not yet exist: the same_output_path() guard moved outside os.path.isfile(manifest), and --out help spells out the reservation. tests/test_bink_names.py adds a loop over both folders asserting exit 2, a "carve manifest" stderr message, and no file created.

Why merge

Closes a hole where a fresh report could be written over a future carve manifest. The test covers both source and mount paths and checks the guard before any file exists.

Verdict: Approve

@shayderrr
shayderrr merged commit 26ecd9f into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
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.

4 participants