Skip to content

refactor!: retire the legacy vehicle claim event - #72

Merged
ryanbarlow97 merged 1 commit into
mainfrom
stage7/account-api
Oct 14, 2026
Merged

ryanbarlow97 merged 1 commit into
mainfrom
stage7/account-api

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Replace the legacy cancellable VehicleOwnerClaimedEvent with the existing VehicleOwnershipChangeEvent CLAIM pre-event and paired VehicleOwnershipChangedEvent. Cancellation still prevents every write and reports failure under the same operation ID. This intentionally removes a public event and must ship with the coordinated SimpleFactions modern guard/legacy bridge update.

Also fix the accepted TLibs 2.6.1 carryover: when SQLite rolls back an Error, VehicleRepository now restores both eager occupancy and tracked-car caches before rethrowing the original Error. Persisted formats, names mode, ownership authority, raw legacy records and migration/hold readers stay intact.

Validation:

  • Java 21 tfmc-mvn -o -B clean verify: 1,709 tests, no failures/errors/skips; existing coverage checks pass.
  • Full 41-repository source and 89-distinct-JAR binary/reflection/config census found only the known SimpleFactions fallback guard as a consumer of the removed event.
  • Isolated class loading with actual VF 2.10.0, published 2.13.0 and this candidate selects the appropriate SF guard, links its Bukkit handler signature and avoids loading the legacy bridge under modern providers.
  • Real released TLibs 2.6.1 regression: before fix SQL rolled back while both caches stayed changed; after fix rows/caches agree, Error identity is preserved and reopen is stable. Default-pin provider-contract regression also demonstrates red/green. The compile dependency pin remains unchanged.

Docs: TF-Minecraft/Docs#240

Deploy only with the reviewed SF counterpart after verified 6c Dev activation, in a stopped coherent cohort. If versions are split, upgrade SF first. Retain the complete 6c rollback set; no Main deployment.

Required SF guard counterpart: TF-Minecraft/SimpleFactions#166

@github-actions github-actions Bot added the size:M 30-99 effective changed lines (tests excluded in mixed PRs). label Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20cc4bb9-50ab-4326-a7ae-d3711f904770
📥 Commits

Reviewing files that changed from the base of the PR and between 799577a and ba95e7f.

📒 Files selected for processing: 9
  • src/main/java/net/tfminecraft/vehicleframework/database/VehicleRepository.java
  • src/main/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEvent.java
  • src/main/java/net/tfminecraft/vehicleframework/ownership/OwnershipActions.java
  • src/test/java/net/tfminecraft/vehicleframework/data/RuntimeValuesCoverageTest.java
  • src/test/java/net/tfminecraft/vehicleframework/database/TrackedCarIndexTest.java
  • src/test/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEventTest.java
  • src/test/java/net/tfminecraft/vehicleframework/managers/OwnershipManagerTest.java
  • src/test/java/net/tfminecraft/vehicleframework/managers/VehicleManagerCoverageTest.java
  • src/test/java/net/tfminecraft/vehicleframework/ownership/OwnershipActionsTest.java
💤 Files with no reviewable changes: 3
  • src/test/java/net/tfminecraft/vehicleframework/data/RuntimeValuesCoverageTest.java
  • src/test/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEventTest.java
  • src/main/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEvent.java

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
    • Database transactions now restore vehicle records and indexes if an error occurs, while rethrowing the original error.
  • Changes
    • Vehicle ownership claims and takeovers no longer fire the legacy VehicleOwnerClaimedEvent. Ownership changes continue to use VehicleOwnershipChangeEvent, which can cancel the change before it is saved.
    • The legacy claim event and its cancellation capability have been removed. Integrations relying on it should use the ownership-change event instead.

The repository now rebuilds cached state after transaction failures caused by an Error. The legacy VehicleOwnerClaimedEvent was removed, and ownership claim handling and tests now use VehicleOwnershipChangeEvent.

Changes: Transaction recovery

Layer / File(s) Summary
Error recovery and validation
src/main/java/net/tfminecraft/vehicleframework/database/VehicleRepository.java, src/test/java/net/tfminecraft/vehicleframework/database/TrackedCarIndexTest.java
Transaction failure handling now catches Error as well as RuntimeException. A new test checks that the original error is rethrown and that repository indexes and live rows are restored before and after reopening the database.

Ownership event removal

Layer / File(s) Summary
Claim flow and event test updates
src/main/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEvent.java, src/main/java/net/tfminecraft/vehicleframework/ownership/OwnershipActions.java, src/test/java/net/tfminecraft/vehicleframework/data/RuntimeValuesCoverageTest.java, src/test/java/net/tfminecraft/vehicleframework/events/VehicleOwnerClaimedEventTest.java, src/test/java/net/tfminecraft/vehicleframework/managers/OwnershipManagerTest.java, src/test/java/net/tfminecraft/vehicleframework/managers/VehicleManagerCoverageTest.java, src/test/java/net/tfminecraft/vehicleframework/ownership/OwnershipActionsTest.java
The legacy event class, its claim dispatch and cancellation check, and its dedicated tests were removed. Ownership claim and takeover tests now check VehicleOwnershipChangeEvent.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to ba95e

No actionable issue is established for the intended deployment; the change is mergeable 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ryanbarlow97
ryanbarlow97 merged commit 6716613 into main Oct 14, 2026
3 checks passed
@ryanbarlow97
ryanbarlow97 deleted the stage7/account-api branch October 14, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant