Repair zero-byte DDS files on TTPF export resume #451

Open
github-bot wants to merge 1 commit from github-bot/gh-451 into main AGit
Owner

@⁠EdenBendheim on GitHub · 2026-11-24 05:40 UTC · original
EdenBendheim:ubiq/ttpf-zero-byte-dds-resume → main · +164 −36 · 4 files · 1 commits · open

Claim: #14

What changed

  • make_game.py (ttpf_manifest): Require every listed DDS output to be a non-empty regular file (st_size > 0) before accepting a pool manifest on resume, preserving the single-pass os.scandir() fast path (with os.stat() fallback only for case-only spelling misses) and keeping File: null unsupported rows valid.
  • tools/rpf9dump/Program.cs (HasNonemptyDds): Treat zero-byte DDS outputs as incomplete on resume (following symlink targets and handling inaccessible/non-regular paths safely) so the existing atomic writer regenerates broken files while leaving valid sibling DDS files untouched.
  • Tests (tests/test_ttpf_export_resume.py, tests/test_make_game_dry_run.py): Synthetic tests verifying byte-for-byte repair, untouched sibling bytes/mtime, preserved skipped rows, symlink handling, os.scandir() fast path, and fallback error rejection (with LF line endings pinned).

Scope is intentionally limited to listed, extractable DDS outputs (unlisted files in the pool folder are never deleted).

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 (CPU-only, synthetic fixtures, zero game data).
  • Verified on ubiquitarianism/leonida main (8f481cf16): dotnet build -c Release (0 warnings, 0 errors), test_ttpf_export_resume.py (6/6), test_make_game_dry_run.py (25/25), check_no_game_data.py, LF check — all passed.
**@⁠EdenBendheim** on GitHub · 2026-11-24 05:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/451) `EdenBendheim:ubiq/ttpf-zero-byte-dds-resume` → `main` · +164 −36 · 4 files · 1 commits · open Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### What changed - **`make_game.py` (`ttpf_manifest`)**: Require every listed DDS output to be a non-empty regular file (`st_size > 0`) before accepting a pool manifest on resume, preserving the single-pass `os.scandir()` fast path (with `os.stat()` fallback only for case-only spelling misses) and keeping `File: null` unsupported rows valid. - **`tools/rpf9dump/Program.cs` (`HasNonemptyDds`)**: Treat zero-byte DDS outputs as incomplete on resume (following symlink targets and handling inaccessible/non-regular paths safely) so the existing atomic writer regenerates broken files while leaving valid sibling DDS files untouched. - **Tests (`tests/test_ttpf_export_resume.py`, `tests/test_make_game_dry_run.py`)**: Synthetic tests verifying byte-for-byte repair, untouched sibling bytes/mtime, preserved skipped rows, symlink handling, `os.scandir()` fast path, and fallback error rejection (with LF line endings pinned). Scope is intentionally limited to listed, extractable DDS outputs (unlisted files in the pool folder are never deleted). ### 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 (CPU-only, synthetic fixtures, zero game data). - **Verified on `ubiquitarianism/leonida` `main` (`8f481cf16`):** `dotnet build -c Release` (0 warnings, 0 errors), `test_ttpf_export_resume.py` (6/6), `test_make_game_dry_run.py` (25/25), `check_no_game_data.py`, LF check — all passed.
Require a non-empty file before the manifest or exporter considers a DDS complete. Rebuild empty outputs through the atomic writer and cover skipped rows and surviving siblings with synthetic tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:00:56 +00:00
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-24 11:07 UTC · original

Verified PR #451 on Windows 11 x64 at commit 031bab29f8905a5c6eba0c306f5e328e23b54e54 (synthetic fixtures only, zero game data):

Environment

  • OS: Windows 11 x64 (NTFS with symlinks enabled)
  • Toolchain: .NET 8.0.401, Python 3.14.7
  • Merge check against current upstream/main (21625bca): clean auto-merge (exit 0, 0 conflicts)

Checks run

  • dotnet build tools/rpf9dump/rpf9dump.csproj -c Release — 0 warnings, 0 errors
  • dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release — 6/6 suites passed
  • python -I tests/test_ttpf_export_resume.py -v (with RPF9DUMP_DLL set) — 6/6 OK (test_resume_repairs_empty_dds_and_keeps_siblings and test_resume_checks_dds_symlink_targets both ran and passed on Windows NTFS symlinks without skipping)
  • python -I tests/test_make_game_dry_run.py — 25/25 OK
  • python -I tests/test_ci_registration.py — 15/15 OK
  • python -I tests/test_text_write_line_endings.py — 3/3 OK
  • python -I scripts/check_no_game_data.py — exit 0
  • python -I tests/test_rpf9dump_exit_codes.py (with RPF9DUMP_DLL) — 6/8 passed; the 2 failures (test_failed_texture_write_exits_nonzero_and_withholds_manifest, test_failed_xma_write_exits_nonzero_and_rerun_completes) are pre-existing on unmodified upstream/main (21625bca, fixed separately in #655) and unrelated to this PR.
  • Ad-hoc Windows check of make_game.ttpf_manifest on NTFS symlinks: verified DirEntry.stat() returns target S_ISREG=True and target size (5 bytes), accepts uppercase alias LINK.DDS on NTFS, and returns None for a zero-byte symlink target and a broken symlink.

Looks good on Windows 11.

AI-assisted: yes

**@⁠kirigayakazima** on GitHub · 2026-11-24 11:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/451#issuecomment-7129696856) Verified PR #451 on **Windows 11 x64** at commit `031bab29f8905a5c6eba0c306f5e328e23b54e54` (synthetic fixtures only, zero game data): ### Environment - OS: Windows 11 x64 (NTFS with symlinks enabled) - Toolchain: `.NET 8.0.401`, `Python 3.14.7` - Merge check against current `upstream/main` (`21625bca`): clean auto-merge (`exit 0`, 0 conflicts) ### Checks run - `dotnet build tools/rpf9dump/rpf9dump.csproj -c Release` — **0 warnings, 0 errors** - `dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release` — **6/6** suites passed - `python -I tests/test_ttpf_export_resume.py -v` (with `RPF9DUMP_DLL` set) — **6/6 OK** (`test_resume_repairs_empty_dds_and_keeps_siblings` and `test_resume_checks_dds_symlink_targets` both ran and passed on Windows NTFS symlinks without skipping) - `python -I tests/test_make_game_dry_run.py` — **25/25 OK** - `python -I tests/test_ci_registration.py` — **15/15 OK** - `python -I tests/test_text_write_line_endings.py` — **3/3 OK** - `python -I scripts/check_no_game_data.py` — **exit 0** - `python -I tests/test_rpf9dump_exit_codes.py` (with `RPF9DUMP_DLL`) — 6/8 passed; the 2 failures (`test_failed_texture_write_exits_nonzero_and_withholds_manifest`, `test_failed_xma_write_exits_nonzero_and_rerun_completes`) are pre-existing on unmodified `upstream/main` (`21625bca`, fixed separately in #655) and unrelated to this PR. - Ad-hoc Windows check of `make_game.ttpf_manifest` on NTFS symlinks: verified `DirEntry.stat()` returns target `S_ISREG=True` and target size (`5` bytes), accepts uppercase alias `LINK.DDS` on NTFS, and returns `None` for a zero-byte symlink target and a broken symlink. Looks good on Windows 11. AI-assisted: yes
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/451/head:github-bot/gh-451'
git switch 'github-bot/gh-451'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-451'
git switch 'github-bot/gh-451'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-451'
git switch 'github-bot/gh-451'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-451'
git switch 'main'
git merge --squash 'github-bot/gh-451'
git switch 'main'
git merge --ff-only 'github-bot/gh-451'
git switch 'main'
git merge 'github-bot/gh-451'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.