Repair zero-byte DDS files on TTPF export resume #451
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/451"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-11-24T05:40:08Z.
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123161839
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-passos.scandir()fast path (withos.stat()fallback only for case-only spelling misses) and keepingFile: nullunsupported 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/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
gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).ubiquitarianism/leonidamain(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.Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-24T11:07:55Z.
Verified PR #451 on Windows 11 x64 at commit
031bab29f8905a5c6eba0c306f5e328e23b54e54(synthetic fixtures only, zero game data):Environment
.NET 8.0.401,Python 3.14.7upstream/main(21625bca): clean auto-merge (exit 0, 0 conflicts)Checks run
dotnet build tools/rpf9dump/rpf9dump.csproj -c Release— 0 warnings, 0 errorsdotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release— 6/6 suites passedpython -I tests/test_ttpf_export_resume.py -v(withRPF9DUMP_DLLset) — 6/6 OK (test_resume_repairs_empty_dds_and_keeps_siblingsandtest_resume_checks_dds_symlink_targetsboth ran and passed on Windows NTFS symlinks without skipping)python -I tests/test_make_game_dry_run.py— 25/25 OKpython -I tests/test_ci_registration.py— 15/15 OKpython -I tests/test_text_write_line_endings.py— 3/3 OKpython -I scripts/check_no_game_data.py— exit 0python -I tests/test_rpf9dump_exit_codes.py(withRPF9DUMP_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 unmodifiedupstream/main(21625bca, fixed separately in #655) and unrelated to this PR.make_game.ttpf_manifeston NTFS symlinks: verifiedDirEntry.stat()returns targetS_ISREG=Trueand target size (5bytes), accepts uppercase aliasLINK.DDSon NTFS, and returnsNonefor a zero-byte symlink target and a broken symlink.Looks good on Windows 11.
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:40:24Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, .NET SDK 11.0.100, main
53b77df14: red = main / green = main + this PRgit submodule update --init,dotnet build tools/rpf9dump/rpf9dump.csproj -c Release,RPF9DUMP_DLLset to that build) with the test file as merged; green = main +git merge --no-ffof this PR (clean), rpf9dump built from the merged tree.python -I tests/test_make_game_dry_run.py:test_texture_pools_resume_only_when_their_listed_dds_files_are_nonempty(case "listed DDS is empty"): no re-export call.test_ttpf_manifest_requires_nonempty_listed_dds_files: main'sttpf_manifestaccepts a manifest listing a 0-byte DDS.python -I tests/test_ttpf_export_resume.py:test_resume_repairs_empty_dds_and_keeps_siblings: main's rpf9dump skips the 0-byte DDS on resume, so it stays empty.test_resume_checks_dds_symlink_targets: main trusts a symlink to an empty target.MEASURED: the 4 failing tests alone, 3 runs each side: red 3/3 fail, green 3/3 pass.
Verdict: READY.
AI-assisted: Claude Code (Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:49:42Z.
#451 | head
031bab29f8(merged cleanly onto origin/main59e65849b0) | Windows 11 (10.0.26200.9974), .NET SDK 8.0.428, Python 3.12.10 | AI-assisted: yesIndependent Verification (Windows 11 + NTFS + .NET 8.0)
make_game.py(ttpf_manifestrequiringstat.S_ISREG(output.st_mode)andoutput.st_size > 0via WindowsDirEntry.stat()with case-insensitiveos.statfallback),tools/rpf9dump/Program.cs(HasNonemptyDds),tests/test_make_game_dry_run.py, andtests/test_ttpf_export_resume.py.python -I scripts/check_no_game_data.py make_game.py tests/test_make_game_dry_run.py tests/test_ttpf_export_resume.py tools/rpf9dump/Program.cspassed (rc=0).origin/main59e65849b0):make_game.ttpf_manifest(pool_dir)accepted a pool containing a0-byteempty.ddsalongside a valid sibling DDS instead of returningNone.#451 + origin/main):make_game.ttpf_manifest(pool_dir)returnedNonewhenempty.ddswas0bytes.python -I tests/test_make_game_dry_run.py->25/25passed (OK,2.122s, includingtest_texture_pools_resume_only_when_their_listed_dds_files_are_nonemptyandtest_ttpf_manifest_requires_nonempty_listed_dds_files).HasNonemptyDds(string path)C# helper fromtools/rpf9dump/Program.csunder.NET 8.0.428(dotnet run -c Release) on Windows 11 NTFS -> rejected missing files,0-byte files, and directories while accepting non-empty regular.ddsfiles (rc=0;tests/test_ttpf_export_resume.pyskipped6/6cleanly without thethird_party/rpf9-explorersubmodule).Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T18:27:28Z.
Thank you! Merged into
mainwith a merge commit. It was verified ready on its current head (031bab29f) by OreoFR's Mac agent (macOS) and MoonEyes' agent; see the verification comment above. (AI-assisted, posted for DadaCap.)