awc_shorts: refuse a catalog destination that aliases an input bank #196

Closed
Andretuta wants to merge 1 commit from upstream-pr/196 into main
Andretuta commented 2026-11-24 02:40:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:40:44Z.


Carried over from old PR 9927 by neoisg8 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9927, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
neoisg8: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue: https://github.com/ProjectLeonida/Leonida/issues/9677 (from finding by @kawaii-shakal: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115664188)

Depends on: none.

What and why

In tools/awc_shorts.py, the output catalog was previously published to <out>/shorts.csv without verifying whether that path collided with an input bank. When an input bank was named shorts.csv or exported into a directory of that name, publishing the catalog replaced the source input file with the CSV header/rows and exited 0.

Fix:

  1. Import same_report_path from report_paths.
  2. Check upfront before creating directories or exporting clips whether <out>/shorts.csv aliases any bank in banks, reporting awc_shorts: error: catalog would overwrite the input bank <path> and exiting 2.
  3. Check whether <out>/shorts.csv collides with any bank export directory <out>/<bank>, reporting awc_shorts: error: catalog would collide with bank export directory <target> and exiting 2.

Tested

  • Windows 11 Pro 26100, Python 3.12.10, CPU only, no GPU, no game files.
  • Negative control on main (5d74c2723):
    An input file shorts.csv was overwritten with CSV contents and exited with returncode 0.
  • Positive control on fix/awc-shorts-protect-input-catalog:
    The collision is refused with exit code 2 and diagnostic message before directory creation; input file contents remain untouched.
  • Unit tests:
    python -I tests/test_awc_shorts.py -> 17 tests passed (1 expected skip: case-distinct test on Windows).
  • Hygiene checks:
    python -m compileall -q tools/awc_shorts.py tests/test_awc_shorts.py: clean.
    python -I scripts/check_no_game_data.py tools/awc_shorts.py tests/test_awc_shorts.py: clean.
    git diff --check origin/main: clean.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465063392 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/196). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:40:44Z. --- > Carried over from **old PR 9927** by `neoisg8` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9927`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `neoisg8`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue: https://github.com/ProjectLeonida/Leonida/issues/9677 (from finding by `@kawaii-shakal`: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115664188) Depends on: none. ### What and why In `tools/awc_shorts.py`, the output catalog was previously published to `<out>/shorts.csv` without verifying whether that path collided with an input bank. When an input bank was named `shorts.csv` or exported into a directory of that name, publishing the catalog replaced the source input file with the CSV header/rows and exited 0. Fix: 1. Import `same_report_path` from `report_paths`. 2. Check upfront before creating directories or exporting clips whether `<out>/shorts.csv` aliases any bank in `banks`, reporting `awc_shorts: error: catalog would overwrite the input bank <path>` and exiting 2. 3. Check whether `<out>/shorts.csv` collides with any bank export directory `<out>/<bank>`, reporting `awc_shorts: error: catalog would collide with bank export directory <target>` and exiting 2. ### Tested - Windows 11 Pro 26100, Python 3.12.10, CPU only, no GPU, no game files. - Negative control on `main` (`5d74c2723`): An input file `shorts.csv` was overwritten with CSV contents and exited with returncode 0. - Positive control on `fix/awc-shorts-protect-input-catalog`: The collision is refused with exit code 2 and diagnostic message before directory creation; input file contents remain untouched. - Unit tests: `python -I tests/test_awc_shorts.py` -> 17 tests passed (1 expected skip: case-distinct test on Windows). - Hygiene checks: `python -m compileall -q tools/awc_shorts.py tests/test_awc_shorts.py`: clean. `python -I scripts/check_no_game_data.py tools/awc_shorts.py tests/test_awc_shorts.py`: clean. `git diff --check origin/main`: clean. AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: no translator change.)
aslan2142 commented 2026-11-24 19:18:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:18:12Z.


This carry-over of old upstream PR 9927 has been taken over in #934, so I'm closing this draft as #17 describes. The branch old-pr/9927 stays.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141898382 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/196#issuecomment-7141898382). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:18:12Z. --- This carry-over of old upstream PR 9927 has been taken over in #934, so I'm closing this draft as #17 describes. The branch `old-pr/9927` stays. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

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!196
No description provided.