You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: preserve vehicle construction across interrupted shutdowns - #32
Vehicle construction consumed materials but kept the queued job only in memory until plugin shutdown. An interrupted shutdown could therefore discard an accepted aircraft or boat build. Save accepted jobs immediately, checkpoint progress every 30 seconds while busy, and persist completion, cancellation and station removal with atomic file replacement.
Record the output vehicle UUID before the construction event can save it through SimpleFactions. Recovery recognizes live or destroyed saved outputs, while a missing runtime output can be rebuilt. Save the finished vehicle before clearing its station, refund a rejected start through the existing cancellation event, and keep a job queued when a later save fails. Existing identity fields and legacy station saves remain supported. Saves leave timer displays intact; accepted starts and output recovery are logged.
Validation: tfmc-mvn -o -B --no-transfer-progress clean verify on Java 21; 56 tests and the existing 100% instruction/line/branch coverage gate pass. Regression coverage includes restoration without shutdown, checkpoint timing, atomic replacement failure, failed-start refunds, completion ordering, output recovery and failed cancellation/removal saves. Muse reviewed the design, implementation and final follow-up at 5d05774 with no blockers. CodeRabbit reported no actionable findings on the initial implementation; its follow-up review was rate-limited.
Limits: inventory, registration payments and station storage are separate stores; a process failure during their handoff can require staff reconciliation. This does not restore already-lost jobs. Before downgrading, resolve any saved outputUuid markers to avoid replay by an older reader.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
Construction progress is now preserved when saving fails, helping prevent accepted builds from being lost or duplicated.
Failed construction starts return the materials, and station breaks are cancelled when construction cannot be safely saved.
Station removals are rolled back if they cannot be saved successfully.
Completing or cancelling a build now handles already-saved outputs without creating duplicates or refunding the blueprint incorrectly.
Reliability
Station data is saved periodically while builds are active, and saving no longer removes station holograms.
Station construction now checkpoints output vehicle identifiers and saves station data atomically. Completion, cancellation, construction starts, and station removal use save results to determine whether to retain or clear state.
Changes: Station Persistence and Construction
Layer / File(s)
Summary
Persist station state src/main/java/net/tfminecraft/vfbuilders/data/Database.java, src/test/java/net/tfminecraft/vfbuilders/DatabaseTest.java
Station saves write UTF-8 JSON to a temporary file and replace the destination atomically. Station data now stores and restores output UUIDs. Tests cover failed replacement, preservation of existing data, and output UUID persistence.
Checkpoint construction output src/main/java/net/tfminecraft/vfbuilders/core/ActiveStation.java, src/test/java/net/tfminecraft/vfbuilders/StationTest.java
ActiveStation checkpoints a spawned output UUID before dispatching the construction event. It reuses matching vehicles, saves live vehicles before clearing construction, and preserves construction state when persistence fails.
Manage station checkpoints and removal src/main/java/net/tfminecraft/vfbuilders/managers/StationManager.java, src/test/java/net/tfminecraft/vfbuilders/ManagerTest.java, src/test/java/net/tfminecraft/vfbuilders/SchedulerTest.java
StationManager binds station checkpoints, saves active blueprints every 600 ticks, and checks save results during construction starts and station removal. Tests cover save failures, state retention, and scheduled saves.
sequenceDiagram
participant StationManager
participant ActiveStation
participant Database
participant VehiclePersistence
StationManager->>Database: Save station state when construction starts
ActiveStation->>VehiclePersistence: Get persistence for construction completion
ActiveStation->>StationManager: Run station checkpoint
StationManager->>Database: Save station state with output UUID
ActiveStation->>VehiclePersistence: Save live vehicle
ActiveStation->>ActiveStation: Clear construction after successful save
Loading
Merge Risk:⚪ Minimal · up to 73e29
No demonstrated issue blocks merging after normal checks.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:L100-499 effective changed lines (tests excluded in mixed PRs).
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vehicle construction consumed materials but kept the queued job only in memory until plugin shutdown. An interrupted shutdown could therefore discard an accepted aircraft or boat build. Save accepted jobs immediately, checkpoint progress every 30 seconds while busy, and persist completion, cancellation and station removal with atomic file replacement.
Record the output vehicle UUID before the construction event can save it through SimpleFactions. Recovery recognizes live or destroyed saved outputs, while a missing runtime output can be rebuilt. Save the finished vehicle before clearing its station, refund a rejected start through the existing cancellation event, and keep a job queued when a later save fails. Existing identity fields and legacy station saves remain supported. Saves leave timer displays intact; accepted starts and output recovery are logged.
Validation:
tfmc-mvn -o -B --no-transfer-progress clean verifyon Java 21; 56 tests and the existing 100% instruction/line/branch coverage gate pass. Regression coverage includes restoration without shutdown, checkpoint timing, atomic replacement failure, failed-start refunds, completion ordering, output recovery and failed cancellation/removal saves. Muse reviewed the design, implementation and final follow-up at5d05774with no blockers. CodeRabbit reported no actionable findings on the initial implementation; its follow-up review was rate-limited.Limits: inventory, registration payments and station storage are separate stores; a process failure during their handoff can require staff reconciliation. This does not restore already-lost jobs. Before downgrading, resolve any saved
outputUuidmarkers to avoid replay by an older reader.Docs: TF-Minecraft/Docs#274