Fix rental/sale income leaking into business accounts#15
Merged
Conversation
TreasuryEconomyProvider.resolveRecipientAccount resolved every payment recipient by preferring GOVERNMENT > BUSINESS > PERSONAL among the accounts that UUID owns. Because a firm's BUSINESS account is owned by the proprietor's own player UUID, any landlord who also runs a firm had their rent (and sale/auction/refund proceeds) silently routed into the business account instead of their personal balance. Prefer the recipient's PERSONAL account first, falling back to the prior GOVERNMENT > BUSINESS > first-available ordering only when no personal account exists. This is safe given Treasury's invariants: PERSONAL accounts are one-per-real-player, and GOVERNMENT/SYSTEM accounts are owned by the virtual UUID (0,0), never a player. So player landlords are paid personally while synthetic authority UUIDs (no personal account) still route to their government treasury account. Also: - Add TreasuryEconomyProviderTest covering the three routing cases. - Add treasury-api to the test classpath (was compileOnly, so tests couldn't reference Treasury types). - Fix RealtyPaperApiImplTest, which no longer compiled: ExecutorState gained a third component (networkExec) but the test passed only two. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
Rental payments (and sale/auction/refund proceeds) were silently landing in business accounts instead of the landlord's personal balance.
TreasuryEconomyProvider.resolveRecipientAccountresolved every recipient by preferringGOVERNMENT>BUSINESS>PERSONALamong the accounts that UUID owns. A firm'sBUSINESSaccount in the Business plugin is created ascreateAccount(AccountType.BUSINESS, proprietorUuid, ...)β i.e. owned by the proprietor's own player UUID. So any landlord who also runs a firm hadgetAccountsByOwner(landlordUuid)return both their PERSONAL and their firm's BUSINESS account, and theBUSINESS-over-PERSONALpreference routed their income into the firm.All economy flows (rent, buy, auction bids, offers, refunds) funnel through this one method, so they were all affected.
Fix
Prefer the recipient's PERSONAL account first, falling back to the prior
GOVERNMENT > BUSINESS > first-availableordering only when no personal account exists.This is correct and minimal given two Treasury invariants:
(0,0), never a player.So:
default-*-authority-uuid) β no PERSONAL account β still falls through to GOVERNMENT β (legitimate path preserved)Also in this PR
TreasuryEconomyProviderTestcovering all three routing cases.treasury-apito the test classpath (it wascompileOnly, so tests couldn't reference Treasury types).RealtyPaperApiImplTest, which no longer compiled onmain:ExecutorStategained a third component (networkExec) but the test still passed only two args. This was blocking the whole test module from compiling.Testing
./gradlew :realty-paper:testβ green (new test + previously-uncompilable suite)../gradlew :realty-paper:shadowJarβ builds.π€ Generated with Claude Code