[PR #196] [CLOSED] awc_shorts: refuse a catalog destination that aliases an input bank #248

Closed
opened 2026-11-26 20:17:16 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/196
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/9927


📝 Commits (1)

  • 2496bef awc_shorts: refuse a catalog destination that aliases an input bank

📊 Changes

2 files changed (+35 additions, -1 deletions)

View changed files

📝 tests/test_awc_shorts.py (+26 -0)
📝 tools/awc_shorts.py (+9 -1)

📄 Description

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.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/196 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/9927` --- ### 📝 Commits (1) - [`2496bef`](https://github.com/ubiquitarianism/leonida/commit/2496beffe5b1ee52e9d470c8b9f73d59d8d9e0b8) awc_shorts: refuse a catalog destination that aliases an input bank ### 📊 Changes **2 files changed** (+35 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_awc_shorts.py` (+26 -0) 📝 `tools/awc_shorts.py` (+9 -1) </details> ### 📄 Description > 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.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:16 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#248
No description provided.