Data validation
Testing the hypothesis at data level
The API and event flow indicated that the transfer had reached a rejected state, but the customer's available balance suggested that the original funds reservation was still active.
At this point, the investigation moves beyond the service response and checks whether the persisted data reflects the expected business state.
The objective is not to query the database for every test, but to use SQL when backend data can confirm or reject a specific investigation hypothesis.
1. Confirm the transfer state and reservation
SQL
SELECT
t.transfer_id,
t.status AS transfer_status,
t.amount,
r.status AS reservation_status,
r.reserved_amount
FROM transfers t
LEFT JOIN fund_reservations r
ON r.transfer_id = t.transfer_id
WHERE t.transfer_id = 'TRF-908771';Expected investigation result
transfer_status = REJECTED
reservation_status = ACTIVE
reserved_amount = 8750.00
This confirms the inconsistency: the business transaction is rejected, but the funds reservation remains active.
2. Verify the customer balance impact
SQL
SELECT
account_id,
ledger_balance,
reserved_amount,
available_balance
FROM account_balances
WHERE account_id = 'ACC-ES-4410';Expected result
ledger_balance = 12480.00
reserved_amount = 8750.00
available_balance = 3730.00
The ledger balance has not decreased, but the active reservation is still reducing the amount available to the customer.
3. Check whether the release event was processed
SQL
SELECT
e.event_type,
e.event_version,
e.processing_status,
e.created_at
FROM integration_events e
WHERE e.transfer_id = 'TRF-908771'
ORDER BY e.created_at;Example result
transfer.created | 1.0 | PROCESSED
funds.reserved | 1.0 | PROCESSED
transfer.rejected | 2.0 | FAILED
The data supports the event-flow hypothesis: the rejection event exists, but downstream processing did not complete successfully.
4. Detect the broader pattern
SQL
SELECT
COUNT(*) AS affected_transfers,
SUM(r.reserved_amount) AS total_funds_still_reserved
FROM transfers t
JOIN fund_reservations r
ON r.transfer_id = t.transfer_id
WHERE t.status = 'REJECTED'
AND r.status = 'ACTIVE';This query changes the question from “Did one transfer fail?” to “Is this a repeatable systemic state inconsistency?”
SQL is used here as investigation evidence: each query exists to validate a specific hypothesis about state, money or event processing.