Skip to content

test(assets-controller): repro stale balance for fully-spent tokens (… - #10024

Draft
Kriys94 wants to merge 1 commit into
mainfrom
fix/ASSETS-3856-stale-balance-polling
Draft

test(assets-controller): repro stale balance for fully-spent tokens (…#10024
Kriys94 wants to merge 1 commit into
mainfrom
fix/ASSETS-3856-stale-balance-polling

Conversation

@Kriys94

@Kriys94 Kriys94 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

…ASSETS-3856)

The Accounts API reports a zero balance by omission: a token the account no longer holds is absent from balance responses rather than returned as "0". Subscription poll responses are applied with updateMode 'merge' — an object spread that can only add or overwrite keys — so an omitted token keeps its last non-zero balance through every poll cycle until app restart.

Adds a repro driving the real subscription pipeline (unlock, startup fetch, AccountsApiDataSource poll) against a mocked Accounts API client, mirroring the reported scenario: a Linea account max-swaps USDC to USDT and the API omits USDC from subsequent polls.

NOTE: the first test asserts the DESIRED behavior and intentionally FAILS on current code (expected "0", received "100"); it becomes the regression test once a fix lands. The second test (explicit zero through the same pipeline) passes, isolating the defect to omission handling.

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

…ASSETS-3856)

The Accounts API reports a zero balance by omission: a token the account
no longer holds is absent from balance responses rather than returned as
"0". Subscription poll responses are applied with updateMode 'merge' —
an object spread that can only add or overwrite keys — so an omitted
token keeps its last non-zero balance through every poll cycle until app
restart.

Adds a repro driving the real subscription pipeline (unlock, startup
fetch, AccountsApiDataSource poll) against a mocked Accounts API client,
mirroring the reported scenario: a Linea account max-swaps USDC to USDT
and the API omits USDC from subsequent polls.

NOTE: the first test asserts the DESIRED behavior and intentionally
FAILS on current code (expected "0", received "100"); it becomes the
regression test once a fix lands. The second test (explicit zero through
the same pipeline) passes, isolating the defect to omission handling.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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