Skip to content

test(core): close wallet test gaps found by mutation testing - #357

Merged
zaxovaiko merged 14 commits into
chore/mutation-testingfrom
chore/wallet-mutation-tests
Oct 27, 2026
Merged

zaxovaiko merged 14 commits into
chore/mutation-testingfrom
chore/wallet-mutation-tests

Conversation

@zaxovaiko

@zaxovaiko zaxovaiko commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Tests only, no app code. Covers the wallet holes Stryker found: deposit and withdrawal asset gates and minimum/fee edges, the daily auto-approval cap and threshold edge, velocity and rate-limit windows, deposit PSP hand-off, settle-once and held/refunded redelivery, deposit webhook network and refund handling, transaction history filters and owner scoping, the withdrawal queue and its ordering, wallet command guards (non-bet debits, bonus-only bets, conversion audit), admin search, and the HMAC webhook verifier edges.
  • Fixes the recordTimezone flake (two stamps in the same millisecond).

Mutation numbers (wallet, unit + integration, no-coverage / survived, string literals excluded)

  • wallet.service.ts: 155 / 0 -> 46 / 46. Of the survivors seen in triage, about 40 killed, 41 equivalent, 5 not worth a test.
  • wallet-commands.service.ts: 23 / 5 -> 9 / 6, all 6 equivalent.
  • wallet-reader.service.ts: 18 / 2 -> 0 / 4, 3 equivalent, 1 not worth a test.
  • admin-reporting.ts: 14 / 10 -> 0 / 10, equivalent (an empty and()).

Remaining survivors, why they stay

  • Equivalent, no test can tell them apart:
    • drizzle inArray([]) compiles to false, so empty-array guards are only shortcuts (service 1994, 2127, 3128; reader 121).
    • an aggregate always returns a row, so ?. and !row checks never fire (service 2161-2167, 3186-3187; reader 113).
    • upserts and openWallet return a row either way (commands 134, 313; service 531, 1416-1431, 3651).
    • the in-lock replay gives the same outcome as the pre-lock check (service 1410, 1443, 1697, 1705, 1876-1917, 3701).
    • drizzle .set drops undefined (service 2310-2311); the status re-read returns completed anyway (2441-2443).
    • auto-approval: enabled is checked twice (2701); a null threshold fails closed into the same manual queue (2705); the lock tag is still caught (2733).
    • non-bet debits: realPart equals the amount (commands 215, 250, 252).
  • Not worth a test: log-only payloads (service 2595, 2697, 3755-3799), a lookup skipped for an empty list (1257), and a .sort Postgres already satisfies (2163).

Not covered here

  • Reconciliation, custody sweep, on-ramp, swap, router.

Depends on

@zaxovaiko
zaxovaiko force-pushed the chore/wallet-mutation-tests branch from b1dc11f to 15995c4 Compare October 26, 2026 20:36
@zaxovaiko
zaxovaiko added this pull request to stack #358 October 26, 2026 20:39
@zaxovaiko
zaxovaiko added this pull request to the merge queue Oct 27, 2026
Merged via the queue into dev with commit d797717 Oct 27, 2026
7 checks passed
@zaxovaiko
zaxovaiko deleted the chore/wallet-mutation-tests branch October 27, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants