Merge /purge regions into /purge; drop status/stop; simplify /purge unowned#2949
Merged
tastybento merged 3 commits intodevelopfrom Apr 18, 2026
Merged
Merge /purge regions into /purge; drop status/stop; simplify /purge unowned#2949tastybento merged 3 commits intodevelopfrom
tastybento merged 3 commits intodevelopfrom
Conversation
…y /purge unowned The old /purge command only soft-flagged islands as deletable and left the .mca region files in place. Disk wasn't freed until the next housekeeping sweep (or a manual /purge regions). This merges the region-file deletion directly into /purge <days> so admins get the full reap in one step, and removes now-redundant subcommands. Changes: - /purge <days> now delegates to PurgeRegionsService: scans for region files older than N days whose islands aren't protected/spawn/unowned, lists each island location to the log, and reaps the .mca files on confirm. - Dropped /purge regions (merged in), /purge status, /purge stop (regions approach is synchronous from the admin's POV — no state to supervise). - /purge unowned: simplified to flag orphan islands deletable via IslandsManager.deleteIsland(island, true, null); logs each orphan's location; tells the admin to run /purge deleted to reap. - /purge deleted unchanged — still reaps anything already flagged. - Locale cleanup: removed keys for the dropped subcommands; updated description to reflect disk-freeing behavior; added unowned.flagged. - Tests: AdminPurgeCommandTest rewritten end-to-end against a real PurgeRegionsService with a tempDir region layout; AdminPurgeRegionsCommandTest removed; AdminPurgeUnownedCommandTest gains coverage for already-deletable islands. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Drop always-true `this.user.equals(user)` guards in AdminPurgeCommand and AdminPurgeDeletedCommand — `this.user = user` was assigned on the prior line, so the check could never fail. - Parameterize the three days-validation tests (notanumber / 0 / -3) as a single @ParameterizedTest. - Extract `wireIsland(id, deletable, purgeProtected, spawn)`, `wireEmptyGrid()`, and `createRegionFile()` helpers in AdminPurgeCommandTest to collapse ~15-line setup blocks duplicated across the 8 scenario tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ommands AdminPurgeCommand and AdminPurgeDeletedCommand each carried their own inPurge/toBeConfirmed/lastScan state machine and near-identical canExecute / scan-and-prompt / deleteEverything bodies (~75 lines apiece, diverging only in scan source, log prefix, confirm message and an optional chunk-evict step). Pull the shared scaffolding into a package-private AbstractPurgeCommand, with subclasses supplying: - logPrefix() — log line prefix - successMessageKey() — locale key sent on a successful delete - sendConfirmPrompt() — main-thread prompt(s) before user types confirm - beforeDelete(scan) — optional pre-delete hook (used by /purge deleted to evict in-memory chunks before the async file delete) - logScanContents(islands, scan) — optional scan-time logging Behaviour is preserved: same locale keys, same log prefixes, same async threading. The "after a non-empty scan" tail on the failed-delete log line in /purge deleted is dropped — it was always true (we'd already returned on empty) and made the message harder to share. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
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
/purge regionsinto the top-level/purge <days>so a single command now both flags islands and frees the.mcafiles on disk (old/purgeonly soft-flagged)./purge regions(merged in),/purge status, and/purge stop— the regions approach is fast enough that the iterative-state subcommands are no longer useful./purge unownedto flag orphans viaIslandsManager.deleteIsland(island, true, null), logging each orphan's location; admin runs/purge deletedafterwards to reap.Util.xyz) before confirmation so admins can audit what a purge will touch.Why
Prior to PR #2933 the old
/purgehard-deleted islands synchronously. Since #2933 it only soft-flagged them and left region files on disk untilHousekeepingManager's next sweep (or a manual/purge regions). Admins running/purge 30reasonably expected disk to be freed. This realigns behaviour with expectation and collapses the duplicate entry points.Subcommand surface after this PR
/purge <days>/purge unowned/purge deletedafterwards to reap./purge deleted/purge protectTest plan
./gradlew test— BUILD SUCCESSFUL (full suite)AdminPurgeCommandTestrewritten end-to-end against a realPurgeRegionsServicewith a tempDir region layoutAdminPurgeUnownedCommandTestgainstestNoPurgeIfIslandAlreadyDeletableAdminPurgeRegionsCommandTestremoved (command merged)/bsb purge 30, confirm region files are removed and island locations are logged/bsb purge unownedlists orphan coords, flags them;/bsb purge deletedreaps🤖 Generated with Claude Code