fix: a tracked token reads quantity unknown at an address no refresh has read (closes #720) #735

Merged
clawbot merged 1 commits from issue-720-tracked-token-unknown-balance into next 2026-11-03 08:39:41 +01:00
Collaborator

A new address, a new wallet and a network switch each leave tracked tokens with no balance entry. Their lines read 0.0000 before any refresh had read them.

Each of these now sets balanceNotFetched, the field from #664 that a refresh already clears. Until then those lines read quantity unknown.

  • markTrackedTokensNotFetched() in src/popup/views/helpers.js sets it for "+" on Home and for the three import paths. Imports that scan call it again when the scan finds addresses, because a refresh may have cleared it during the scan.
  • applyChainSwitchFields() sets it on the incoming network's list.
  • doRefreshAndRender() in src/popup/index.js clears it only when the refresh read every address this page now holds.

What the diff does not show:

  • The field belongs to the token, not the address. After "+", an older address with no entry for that token also reads quantity unknown until the refresh returns.
  • The ETH line still reads 0.0000 in these cases. #720 covers tracked tokens only.

Disclosures:

  • Judgement call: src/popup/views/addressToken.js and README.md change only in wording that this change made untrue or incomplete.

Model: opus-5-5

A new address, a new wallet and a network switch each leave tracked tokens with no balance entry. Their lines read `0.0000` before any refresh had read them. Each of these now sets `balanceNotFetched`, the field from https://git.eeqj.de/sneak/AutistMask/pulls/664 that a refresh already clears. Until then those lines read `quantity unknown`. - `markTrackedTokensNotFetched()` in `src/popup/views/helpers.js` sets it for "+" on Home and for the three import paths. Imports that scan call it again when the scan finds addresses, because a refresh may have cleared it during the scan. - `applyChainSwitchFields()` sets it on the incoming network's list. - `doRefreshAndRender()` in `src/popup/index.js` clears it only when the refresh read every address this page now holds. What the diff does not show: - The field belongs to the token, not the address. After "+", an older address with no entry for that token also reads `quantity unknown` until the refresh returns. - The ETH line still reads `0.0000` in these cases. https://git.eeqj.de/sneak/AutistMask/issues/720 covers tracked tokens only. Disclosures: - Judgement call: `src/popup/views/addressToken.js` and `README.md` change only in wording that this change made untrue or incomplete. Model: opus-5-5
clawbot added the needs-review label 2026-11-03 07:51:58 +01:00
clawbot self-assigned this 2026-11-03 07:51:58 +01:00
clawbot force-pushed issue-720-tracked-token-unknown-balance from f3f752bea1 to 22170faae6 2026-11-03 07:52:00 +01:00 Compare
Author
Collaborator

FAIL: needs-rework

doRefreshAndRender() in src/popup/index.js: an address added during a refresh reads 0.0000.

Where: the clearBalanceNotFetched(stored, readTokens) call inside the saveState() callback.

What is wrong: a refresh that started before an address was added returns and takes balanceNotFetched off every token it read, though it did not read that address. The tracked tokens' lines at the new address then read 0.0000 until the next refresh returns. This happens when:

  • "+" is pressed during a refresh;
  • a wallet is imported during a refresh;
  • a wallet scan ends during a refresh, for each address the scan found.

A refresh starts when the popup opens and every ten seconds after that, so a user can meet this. The definition of done in #720 requires quantity unknown until a refresh has read the new address. That the plan names no code in this file does not take it out of scope.

Two sentences are false because of this. Both become true with the fix and need no edit:

  • README.md: "This lasts until a refresh has read the token's balance at every address."
  • The comment above doRefreshAndRender(): "The save also deletes balanceNotFetched from each tracked token whose balance this refresh read at every address."

Acceptable:

  • Call clearBalanceNotFetched(stored, readTokens) only when every address in state.wallets has an entry in refreshed. Balances are still copied as they are now.
  • Add one sentence to the comment above doRefreshAndRender(): a refresh that did not read every address this page now holds deletes no balanceNotFetched.
  • In tests/addedTokenBalance.test.js, add a test for each of: "+", a wallet from a private key, a wallet from a recovery phrase whose scan ends during a refresh, and a wallet from an extended private key whose scan ends during a refresh.
  • Each test holds a refresh started with page.tick(), inside the scanForAddresses mock for the two scan cases. It adds the address, holds the next refresh and finishes the first. It then expects quantity unknown and not 0.0000 at the new address, finishes the second refresh and expects 0.0000.
  • Remove the "Gap in the definition of done" disclosure from the PR body.

Follow-up note, not a failure: the ETH line at a new address and after a network switch still reads 0.0000 before any refresh has read it. The PR discloses this as out of scope, and I found no open issue that covers it.

Model: opus-5-5

**FAIL: `needs-rework`** **`doRefreshAndRender()` in `src/popup/index.js`: an address added during a refresh reads `0.0000`.** Where: the `clearBalanceNotFetched(stored, readTokens)` call inside the `saveState()` callback. What is wrong: a refresh that started before an address was added returns and takes `balanceNotFetched` off every token it read, though it did not read that address. The tracked tokens' lines at the new address then read `0.0000` until the next refresh returns. This happens when: - "+" is pressed during a refresh; - a wallet is imported during a refresh; - a wallet scan ends during a refresh, for each address the scan found. A refresh starts when the popup opens and every ten seconds after that, so a user can meet this. The definition of done in https://git.eeqj.de/sneak/AutistMask/issues/720 requires `quantity unknown` until a refresh has read the new address. That the plan names no code in this file does not take it out of scope. Two sentences are false because of this. Both become true with the fix and need no edit: - `README.md`: "This lasts until a refresh has read the token's balance at every address." - The comment above `doRefreshAndRender()`: "The save also deletes `balanceNotFetched` from each tracked token whose balance this refresh read at every address." Acceptable: - Call `clearBalanceNotFetched(stored, readTokens)` only when every address in `state.wallets` has an entry in `refreshed`. Balances are still copied as they are now. - Add one sentence to the comment above `doRefreshAndRender()`: a refresh that did not read every address this page now holds deletes no `balanceNotFetched`. - In `tests/addedTokenBalance.test.js`, add a test for each of: "+", a wallet from a private key, a wallet from a recovery phrase whose scan ends during a refresh, and a wallet from an extended private key whose scan ends during a refresh. - Each test holds a refresh started with `page.tick()`, inside the `scanForAddresses` mock for the two scan cases. It adds the address, holds the next refresh and finishes the first. It then expects `quantity unknown` and not `0.0000` at the new address, finishes the second refresh and expects `0.0000`. - Remove the "Gap in the definition of done" disclosure from the PR body. Follow-up note, not a failure: the ETH line at a new address and after a network switch still reads `0.0000` before any refresh has read it. The PR discloses this as out of scope, and I found no open issue that covers it. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-03 08:03:30 +01:00
clawbot added 1 commit 2026-11-03 08:18:36 +01:00
fix: a tracked token reads quantity unknown at an address no refresh has read (closes #720)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
a96085a2ba
A new address, a new wallet and a network switch each leave tracked tokens
with no balance entry, so their lines read 0.0000 before any refresh had read
them.

Each of these now sets `balanceNotFetched` on the tracked tokens, and a refresh
already clears it. Their lines read `quantity unknown` until then. Addresses
that the wallet scan finds get the same. A refresh that did not read every
address the page now holds leaves the field set.

Model: opus-5-5
clawbot force-pushed issue-720-tracked-token-unknown-balance from 22170faae6 to a96085a2ba 2026-11-03 08:18:36 +01:00 Compare
Author
Collaborator
  • doRefreshAndRender() calls clearBalanceNotFetched(stored, readTokens) only when every address in state.wallets has an entry in refreshed; balances are copied as before.
  • The comment above doRefreshAndRender() has the new sentence.
  • tests/addedTokenBalance.test.js has the tests for "+", a wallet from a private key, and a wallet from a recovery phrase or an extended private key whose scan ends during a refresh, in the order the finding gives; the older "+" test's profile moved into bootOnDerivingWallet() so both "+" tests share it.
  • The "Gap in the definition of done" disclosure is gone from the PR body; the body also gains a bullet for the new rule and src/popup/index.js leaves the judgement-call line, which was no longer true.

Model: opus-5-5

- `doRefreshAndRender()` calls `clearBalanceNotFetched(stored, readTokens)` only when every address in `state.wallets` has an entry in `refreshed`; balances are copied as before. - The comment above `doRefreshAndRender()` has the new sentence. - `tests/addedTokenBalance.test.js` has the tests for "+", a wallet from a private key, and a wallet from a recovery phrase or an extended private key whose scan ends during a refresh, in the order the finding gives; the older "+" test's profile moved into `bootOnDerivingWallet()` so both "+" tests share it. - The "Gap in the definition of done" disclosure is gone from the PR body; the body also gains a bullet for the new rule and `src/popup/index.js` leaves the judgement-call line, which was no longer true. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-03 08:18:58 +01:00
Author
Collaborator

PASS: #735 fixes #720, and the first review's finding is fixed as it asked.

  • Follow-up note, doRefreshAndRender() in src/popup/index.js: a refresh in a second open popup page deletes balanceNotFetched from the stored record, though it did not read an address another page just added. A popup opened again before that address is read then shows 0.0000 there until its refresh returns. Acceptable: also require an entry in refreshed for every address in stored.wallets.
  • Judgement call, README.md: "This lasts until a refresh has read the token's balance at every address." The background's refresh does not delete the field. I passed the sentence because the line shows only in an open popup, which refreshes at once. Acceptable as a follow-up: "until a refresh in the popup has read".

Model: opus-5-5

PASS: https://git.eeqj.de/sneak/AutistMask/pulls/735 fixes https://git.eeqj.de/sneak/AutistMask/issues/720, and the first review's finding is fixed as it asked. - Follow-up note, `doRefreshAndRender()` in `src/popup/index.js`: a refresh in a second open popup page deletes `balanceNotFetched` from the stored record, though it did not read an address another page just added. A popup opened again before that address is read then shows `0.0000` there until its refresh returns. Acceptable: also require an entry in `refreshed` for every address in `stored.wallets`. - Judgement call, `README.md`: "This lasts until a refresh has read the token's balance at every address." The background's refresh does not delete the field. I passed the sentence because the line shows only in an open popup, which refreshes at once. Acceptable as a follow-up: "until a refresh in the popup has read". Model: opus-5-5
clawbot merged commit 4531e8bce5 into next 2026-11-03 08:39:41 +01:00
clawbot deleted branch issue-720-tracked-token-unknown-balance 2026-11-03 08:39:41 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#735