- 5 tasks: revert vaultLoop to SQL, replace broadcast backfill with
per-entry re-fetch, wire into entry points, delete unused helper
and its test, smoke check
- refetchRunningBalances walks /log pagination and UPDATEs each row
from its own data.balance
- Drops the fetchLiveVaultBalance helper (queried /money which is
total-vault not per-user)
- The previous fix's broadcast backfill was clobbering per-entry
historical balances with a single value
- 4 tasks: failing test, helper implementation, vaultLoop switch, smoke check
- New helper fetchLiveVaultBalance(string $user): ?int in includes/utilities.php
- vaultLoop prefers the live value, falls back to MAX(running_balance)
- Per-request cache to avoid N HTTP calls
- Test hook via $GLOBALS['liveBalanceTestHook'] for unit testing
- Falls back gracefully on API failure