Repository navigation
fix: let the animal scan finish when an interrupted save left a temp player file - #104
Conversation
…player file A crash mid-save leaves a truncated <uuid>-<number>.dat beside the real player file. The startup scan read every *.dat, failed on those, and so treated every scan as incomplete: since 09-29 no lost animal on Main was restored or dropped, and their owners kept losing an animal place. - Read only <uuid>.dat player files. - Log which files or chunks could not be read, and why (first 10). - While a scan is incomplete, show lost animals as Missing in /animals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Scan diagnostics and player-file filtering src/main/java/net/tfminecraft/cooking/husbandry/HusbandryEntityScan.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryEntityScanTest.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryRemainingCoverageTest.java |
Result now carries unreadable-file details and derives completeness from that list. The scan records listing, player-file and chunk failures. Player scanning accepts UUID-named .dat files. Tests cover file filtering and diagnostic details. |
Locator handling of incomplete scans src/main/java/net/tfminecraft/cooking/husbandry/HusbandryLocator.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryLocatorTest.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryRuntimeCoverageTest.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryMaintenanceRegressionTest.java |
The locator skips animals from worlds that were not scanned. For animals in scanned worlds, it marks records missing when scan results are incomplete and reports unreadable details. Tests cover world checks, logging and retained records. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: ryanbarlow97
Merge Risk: 
Minimal · up to a1a7b
-
No merge-blocking issue was identified in the scan and reconciliation changes.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Action performed
|
Problem
A player on Main had an unnamed "Cow" in
/animalsthat took one of their 15 animal places but no longer existed. It was a calf they claimed at 10:39 on 10-28, about 20 seconds before a maintenance stop. It never came back after the restart, and nothing removed or restored it.Restoring lost animals from their snapshots should have handled this at the next start. But every startup scan on Main since 09-29 has logged
(some chunks could not be read, none dropped), so no lost animal has been restored or dropped since then.The cause is three 10-byte files in
TFMC_Map/playerdata, named<uuid>-<number>.dat. Vanilla writes player data to a temp file with that name and then swaps it in. A crash in the middle of that (09-29 twice, 10-21 once) leaves the temp file behind with only a gzip header. The scan read every*.dat, failed on these, and so counted every scan as incomplete. All entity chunks on Main read fine.Change
<uuid>.dat. It now skips leftover temp files,.dat_oldbackups and_corrupted_copies.Animal scan could not read 1 file or chunk: playerdata/<uuid>.dat: Not in GZIP format. Before, it only said "some chunks could not be read"./animalsnow shows them asMissinginstead of as if nothing were wrong. The summary line says how many were kept.The all-or-nothing gate itself is unchanged. Allowing restores around an unreadable chunk could duplicate an animal: last spots are recorded once a minute, and a ridden horse can be far from its last spot when the save happens.
Effect on Main at the next start
Read-only checks against the live files on 10-31:
14f5298e…).Testing
mvn verify: 1316 tests pass. New tests cover temp, corrupted and non-player files being skipped; unreadable files and chunks being named with a reason; the capped log line; and lost animals markedMissingwhen a scan is incomplete.<uuid>-<n>.datto playerdata.(some chunks could not be read, none dropped). The bug reproduces.kept 1 missing animals because some files could not be read, with the warning naming only that file andNot in GZIP format./animals HusbandryBotshowedScanFixGhost · Cow · Happy · Missing · last seen TFMC_Map 4005, 302, 4011.restoring 1 lost animalsandRestored lost animal ScanFixGhost (COW) … from its snapshot of 2026-10-28T09:46:58.917Z./animalsno longer shows it as Missing. Aftersave-all, exactly one copy is inentities/r.7.7.mca.husbandry.yml, Cooking DB, playerdata.Note: Dev-only BreedingBuddies 1.2.0 contains a copy of this scan with the same bug. It isn't in this workspace and isn't on Main.
🤖 Generated with Claude Code