shader_library: reject --save paths that overlap extraction outputs #465

Manually merged
github merged 1 commit from gh-pr/465/head into gh-pr/465/base 2026-11-26 09:01:59 +00:00
Owner

@⁠EdenBendheim on GitHub · 2026-11-24 05:50 UTC · original
EdenBendheim:ubiq/shader-library-save-overlap → main · +187 −24 · 2 files · 1 commits · merged 2026-11-24 08:53 UTC

Claim: #14

What changed

  • tools/shader_library.py: Validate --save with same_report_path against all requested --out outputs (index.json, library.json, selected fspx/ .code/.json/.state including stale-state cleanup paths, matched .dxbc, eligible disasm/ .s, output directories, and ancestors of --out) before creating directories or writing either output. Overlapping paths exit 2 leaving existing files untouched; non-overlapping --save inside a fresh --out tree succeeds because extraction directories are created before opening --save.
  • tests/test_shader_library.py: Synthetic tests covering fresh/existing outputs, path aliases (relative, case-only, symlink, hardlink), ancestor-directory collisions, nested fresh-tree saves, and separate destinations.

Testing & Disclosure

  • AI-assisted: Implemented with Codex (gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).
  • Environment: macOS 27.3, Apple M1 Max, Python 3.14.3 (CPU-only, synthetic fixtures, zero game data).
  • Verified on ubiquitarianism/leonida main (8f481cf16): all test_shader_library*.py and test_*report_paths.py suites (76/76), compileall, check_no_game_data.py, LF check — all passed.
**@⁠EdenBendheim** on GitHub · 2026-11-24 05:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/465) `EdenBendheim:ubiq/shader-library-save-overlap` → `main` · +187 −24 · 2 files · 1 commits · merged 2026-11-24 08:53 UTC Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### What changed - **`tools/shader_library.py`**: Validate `--save` with `same_report_path` against all requested `--out` outputs (`index.json`, `library.json`, selected `fspx/` `.code`/`.json`/`.state` including stale-state cleanup paths, matched `.dxbc`, eligible `disasm/` `.s`, output directories, and ancestors of `--out`) before creating directories or writing either output. Overlapping paths exit `2` leaving existing files untouched; non-overlapping `--save` inside a fresh `--out` tree succeeds because extraction directories are created before opening `--save`. - **`tests/test_shader_library.py`**: Synthetic tests covering fresh/existing outputs, path aliases (relative, case-only, symlink, hardlink), ancestor-directory collisions, nested fresh-tree saves, and separate destinations. ### Testing & Disclosure - **AI-assisted:** Implemented with Codex (`gpt-6.2-sol`) and reviewed with Codex (`gpt-6.2-astra`). - **Environment:** macOS 27.3, Apple M1 Max, Python 3.14.3 (CPU-only, synthetic fixtures, zero game data). - **Verified on `ubiquitarianism/leonida` `main` (`8f481cf16`):** all `test_shader_library*.py` and `test_*report_paths.py` suites (76/76), `compileall`, `check_no_game_data.py`, LF check — all passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:01:55 +00:00
github manually merged commit 0db11decd0 into gh-pr/465/base 2026-11-26 09:01:59 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 08:53 UTC · original

Merging. Why merged: a --save path that would overwrite extraction outputs is refused before anything is written.
Why it's good: security-reviewed; on main 1c93c86: shader_library tests 31 -> 37 (19 fail without the fix); it uses report_paths, which is already a listed translator input; repo-consistency set 563/563.

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

**@⁠QemmHD** on GitHub · 2026-11-24 08:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/465#issuecomment-7126691264) Merging. Why merged: a --save path that would overwrite extraction outputs is refused before anything is written. Why it's good: security-reviewed; on main 1c93c86: shader_library tests 31 -> 37 (19 fail without the fix); it uses report_paths, which is already a listed translator input; repo-consistency set 563/563. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.