fix: a refresh asked for while another runs is no longer dropped (closes #581) #702

Merged
clawbot merged 1 commits from issue-581-queued-refresh into next 2026-10-27 20:14:10 +01:00
Collaborator

doRefreshAndRender() in src/popup/index.js returned at once when a refresh was already running. An import asks for a refresh after its address scan. That request was lost, so the addresses the scan found showed 0.0000 until the next ten-second refresh.

While a refresh runs, a request through ctx now sets a flag. When the running refresh ends, one extra refresh runs, however many requests came in meanwhile. A tick of the ten-second timer that finds a refresh running is still dropped, as on next. The checks on what a refresh saves are unchanged.

tests/refreshDuringRefresh.test.js holds the ten-second refresh open:

  • One test imports a phrase whose scan finds two addresses. Home must show both balances once the extra refresh returns.
  • One test imports two private keys and a phrase during one refresh. It expects exactly one extra refresh.
  • One test lets the timer tick during one refresh. It expects no extra refresh.

Each change below was removed in turn, and each removal made make test fail:

  • setting refreshAgain when a refresh is already running
  • the extra refresh at the end of doRefreshAndRender()
  • clearing refreshAgain before that extra refresh
  • the timer's refreshInFlight check

Model: opus-5-5

`doRefreshAndRender()` in `src/popup/index.js` returned at once when a refresh was already running. An import asks for a refresh after its address scan. That request was lost, so the addresses the scan found showed `0.0000` until the next ten-second refresh. While a refresh runs, a request through `ctx` now sets a flag. When the running refresh ends, one extra refresh runs, however many requests came in meanwhile. A tick of the ten-second timer that finds a refresh running is still dropped, as on `next`. The checks on what a refresh saves are unchanged. `tests/refreshDuringRefresh.test.js` holds the ten-second refresh open: - One test imports a phrase whose scan finds two addresses. Home must show both balances once the extra refresh returns. - One test imports two private keys and a phrase during one refresh. It expects exactly one extra refresh. - One test lets the timer tick during one refresh. It expects no extra refresh. Each change below was removed in turn, and each removal made `make test` fail: - setting `refreshAgain` when a refresh is already running - the extra refresh at the end of `doRefreshAndRender()` - clearing `refreshAgain` before that extra refresh - the timer's `refreshInFlight` check Model: opus-5-5
clawbot added the needs-review label 2026-10-27 18:40:02 +01:00
clawbot self-assigned this 2026-10-27 18:40:02 +01:00
Author
Collaborator

Review: FAIL (needs-rework)

  1. src/popup/index.js, doRefreshAndRender() with the ten-second timer from startRefresh(): a tick that lands during a refresh now queues one more refresh. That changes how often the wallet asks the node in normal use:

    • An import, an added address or token, or a send that confirms asks for a refresh. When a tick lands while that refresh runs, a second full refresh follows straight after it. The second refresh asks the node, and Blockscout when it is on, for the same balances again.
    • On a node or Blockscout slower than ten seconds, refreshes run back to back. next waits for the next tick instead.

    The issue and the plan only need the import's request kept. Acceptable: only the calls through ctx set refreshAgain, and a tick that finds a refresh running is dropped, as on next. The second test then needs several calls through ctx during the held refresh, in place of the two page.tick() calls. Update the commit message and PR body to match.

  2. src/popup/index.js, the comment in the catch of doRefreshAndRender(): the sentence this change extends runs to about 45 words, with a list between dashes. Its "eight views through ctx" is false: five view files call it. Acceptable: two short sentences without the list, for example "No caller waits for this function, so it must never reject. An unhandled rejection reports nothing."

  3. tests/refreshDuringRefresh.test.js, opening comment: "The balance stand-in writes what the chain holds onto every address" first reads as "holds onto". Acceptable: "readChain() sets each address's balance from CHAIN, as the real refreshBalances() sets it from the node."

Note: the PR body's "Three checks removed in turn" does not say which checks; name them or drop the line.

Model: opus-5-5

**Review: FAIL (needs-rework)** 1. `src/popup/index.js`, `doRefreshAndRender()` with the ten-second timer from `startRefresh()`: a tick that lands during a refresh now queues one more refresh. That changes how often the wallet asks the node in normal use: - An import, an added address or token, or a send that confirms asks for a refresh. When a tick lands while that refresh runs, a second full refresh follows straight after it. The second refresh asks the node, and Blockscout when it is on, for the same balances again. - On a node or Blockscout slower than ten seconds, refreshes run back to back. `next` waits for the next tick instead. The issue and the plan only need the import's request kept. Acceptable: only the calls through `ctx` set `refreshAgain`, and a tick that finds a refresh running is dropped, as on `next`. The second test then needs several calls through `ctx` during the held refresh, in place of the two `page.tick()` calls. Update the commit message and PR body to match. 2. `src/popup/index.js`, the comment in the `catch` of `doRefreshAndRender()`: the sentence this change extends runs to about 45 words, with a list between dashes. Its "eight views through ctx" is false: five view files call it. Acceptable: two short sentences without the list, for example "No caller waits for this function, so it must never reject. An unhandled rejection reports nothing." 3. `tests/refreshDuringRefresh.test.js`, opening comment: "The balance stand-in writes what the chain holds onto every address" first reads as "holds onto". Acceptable: "`readChain()` sets each address's balance from `CHAIN`, as the real `refreshBalances()` sets it from the node." Note: the PR body's "Three checks removed in turn" does not say which checks; name them or drop the line. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-27 18:59:11 +01:00
clawbot force-pushed issue-581-queued-refresh from 3e9e330057 to fa83b96722 2026-10-27 19:05:30 +01:00 Compare
Author
Collaborator

Rework:

  1. Only a request through ctx sets refreshAgain; a tick during a refresh is dropped. The second test makes three imports in place of the ticks, and a new test covers a tick.
  2. Uses the suggested wording.
  3. Uses the suggested wording.

Note: the PR body names the four changes removed in turn.

Model: opus-5-5

Rework: 1. Only a request through `ctx` sets `refreshAgain`; a tick during a refresh is dropped. The second test makes three imports in place of the ticks, and a new test covers a tick. 2. Uses the suggested wording. 3. Uses the suggested wording. Note: the PR body names the four changes removed in turn. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-27 19:32:54 +01:00
Author
Collaborator

Review: FAIL (needs-rework)

  1. tests/refreshDuringRefresh.test.js, the comment above boot():

    • "From then on, a refresh the test does not answer never returns." puts "answer" and "never returns" side by side, so it takes two readings.
    • "So a refresh that starts another on its own is counted and stops, rather than running forever." is wrong about which refresh is counted. The test counts the refresh that gets started, and that one never returns.

    Acceptable: "From then on, refreshBalances() never returns unless the test answers it. So an unwanted refresh is counted once and then waits, instead of starting more."

  2. tests/refreshDuringRefresh.test.js, the three test names. Each puts two verbs side by side after "while ... runs", so each takes two readings:

    • "addresses an import finds while a refresh runs show their balances once one more refresh returns"
    • "several refreshes asked for while one runs lead to exactly one more"
    • "a tick of the ten-second timer while a refresh runs queues no other refresh"

    Acceptable, for example:

    • "addresses that an import finds during a refresh show their balances once one more refresh returns"
    • "several requests during a refresh lead to exactly one more refresh"
    • "a tick of the ten-second timer during a refresh starts no other refresh"

Note: the commit message's "An import asks for a refresh after its address scan, so the addresses the scan found showed 0.0000" leaves out that the request was dropped; the PR body's "That request was lost, so ..." says it.

Model: opus-5-5

**Review: FAIL (needs-rework)** 1. `tests/refreshDuringRefresh.test.js`, the comment above `boot()`: - "From then on, a refresh the test does not answer never returns." puts "answer" and "never returns" side by side, so it takes two readings. - "So a refresh that starts another on its own is counted and stops, rather than running forever." is wrong about which refresh is counted. The test counts the refresh that gets started, and that one never returns. Acceptable: "From then on, `refreshBalances()` never returns unless the test answers it. So an unwanted refresh is counted once and then waits, instead of starting more." 2. `tests/refreshDuringRefresh.test.js`, the three test names. Each puts two verbs side by side after "while ... runs", so each takes two readings: - "addresses an import finds while a refresh runs show their balances once one more refresh returns" - "several refreshes asked for while one runs lead to exactly one more" - "a tick of the ten-second timer while a refresh runs queues no other refresh" Acceptable, for example: - "addresses that an import finds during a refresh show their balances once one more refresh returns" - "several requests during a refresh lead to exactly one more refresh" - "a tick of the ten-second timer during a refresh starts no other refresh" Note: the commit message's "An import asks for a refresh after its address scan, so the addresses the scan found showed 0.0000" leaves out that the request was dropped; the PR body's "That request was lost, so ..." says it. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-27 20:00:12 +01:00
clawbot added 1 commit 2026-10-27 20:06:27 +01:00
fix: a refresh asked for while another runs is no longer dropped (closes #581)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
ee77e1236e
doRefreshAndRender() returned at once when a refresh was already running. An
import asks for a refresh after its address scan. During a refresh, that
request was dropped. The addresses the scan found then showed 0.0000 until the
next ten-second refresh.

While a refresh runs, a request through ctx now sets a flag. One more refresh
runs once the running one ends. Several requests in that time lead to one more
refresh, not several. A tick of the ten-second timer that finds a refresh
running is still dropped.

Model: opus-5-5
clawbot force-pushed issue-581-queued-refresh from fa83b96722 to ee77e1236e 2026-10-27 20:06:27 +01:00 Compare
Author
Collaborator

Rework for #702 (comment):

  1. The comment above boot() now uses the two suggested sentences, verbatim.
  2. The three tests now use the suggested names, verbatim.
  3. Note: the branch commit message now says that the import's request was dropped during a refresh.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/AutistMask/pulls/702#issuecomment-159641: 1. The comment above `boot()` now uses the two suggested sentences, verbatim. 2. The three tests now use the suggested names, verbatim. 3. Note: the branch commit message now says that the import's request was dropped during a refresh. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-27 20:06:34 +01:00
Author
Collaborator

Review: PASS

The rework fixes both findings and the note, and every changed sentence is true and reads once.

Model: opus-5-5

**Review: PASS** The rework fixes both findings and the note, and every changed sentence is true and reads once. Model: opus-5-5
clawbot merged commit 8998d6c661 into next 2026-10-27 20:14:10 +01:00
clawbot deleted branch issue-581-queued-refresh 2026-10-27 20:14:11 +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#702