Repository navigation
fix: harden reward payout and store integrity - #6
Merged
Merged
Conversation
Findings from a full code and security review, none deployed yet so no migration: claimed milestone count becomes a paid-points threshold so changing reward-every cannot revive a paid claim; claim() refuses before mutating, saves synchronously and verifies the write before dispatching, and rolls back unpaid milestones if a command fails or throws; store values are sanitised on load, a corrupt file that cannot be quarantined blocks all writes, empty entries are not snapshotted and joins no longer create entries; vote resolution moves off the async vote thread; week and day keys come from one clock reading. PlayerStore gains a static test seam and its first tests.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes from a full-codebase review (code-reviewer + security-specialist). Plugin has never been deployed, so legacy
rewarded/daily-goalhandling is deleted rather than migrated.claimedmilestone count →claimed-pointsthreshold; changingbar.reward-everycan no longer revive paid claimsclaim(): refuse-before-mutate (unpayable names cost no write), synchronous save whose result is checked before any dispatch, dispatch exceptions caught, partial rollback of unpaid milestonesPlayerStore: floor/cap on load,loadedstays false if quarantine copy fails,loaded/instancevolatile, empty entries skipped in snapshot,onJoinno longer creates entriesVoteListener: player resolution moved into the scheduled task;runTaskguarded against disable raceActivityGui:activity.usere-checked on claim; no double messages on refusalPlayerStoregets a static seam and its first tests; property test over rollback arithmeticTest plan
mvn -B clean package→Tests run: 65, Failures: 0, Errors: 0, Skipped: 0%player%-only command as a Bedrock name →reward-failed, no write; claim with a throwing command → rollback, milestone still claimable