Repository navigation
fix(tools): keep a Platform info fetch and its result through background refreshes - #1072
Conversation
… notifications AppState calls refresh() on the visible screen for every TaskResult::Refresh. PlatformInfoScreen::refresh() cleared the in-flight markers and the shown result, so while background work sent those notifications several times a second, the spinner vanished right after the click and the result was erased a moment after it arrived. Nothing was left to show once the notifications stopped. The screen reads nothing from local data, so refresh() no longer touches that state. What belongs to the previous network is dropped where the network changes instead: Screen::change_context now calls PlatformInfoScreen::reset_for_network_switch, the pattern other screens use, rather than waiting for the next refresh to reach the screen. Tests: a kittest clicks the fetch button, feeds refresh notifications and the result through AppState, and asserts on the rendered spinner, result and heading; unit tests pin that refresh() keeps a fetch in flight and a shown result, and that a network switch clears both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Final review complete — no blockers (commit c48fbe9) · triage: low · Phase 2 only (no Phase 1 for this repository) |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (no Phase 1 for this repository)
Verified the complete diff at c48fbe9 and the surrounding screen lifecycle, notification routing, and test harness; no in-scope defects were identified. The change preserves Platform Info fetch state and results across refresh notifications, explicitly resets network-bound state on context changes, and adds regression coverage for both behaviors. This was a static review with no local builds or test execution; the supplied CI snapshot reports successful Test Suite and Clippy checks, with PR Hygiene pending.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff makes a small, contained UI lifecycle fix by preserving Platform info state during refresh notifications and clearing it on network switches, with focused regression tests and no critical-surface changes. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer
|
Ready for review — files with no dedicated owner: lklimek. |
|
Policy satisfied — this can merge. |
TL;DR
Pressing a fetch button on Tools ▸ Platform info while the app was refreshing name contests in the background showed nothing: no progress, no error, and the answer never appeared. The fetch and its answer now stay on screen until the next fetch replaces them.
User story
As someone checking the state of the network, I want the answer to the question I just asked to appear and stay visible, whatever the app is doing in the background, so that I do not have to guess whether my click was registered and press the button again.
Scenario
Open the app on Testnet with a fresh profile and wait about a minute, until the background refresh of name contests starts. Go to Tools ▸ Platform info and press "Fetch Current Epoch Info".
Actual behavior
The result area keeps saying "No results yet". There is no spinner and no error. The answer never appears, not even after the background refresh has finished minutes later. Pressing the same button again once the refresh is over returns the answer within a few seconds.
Expected behavior
The result area shows the loading spinner while the request is running, then the answer under its own heading. The answer stays there until another fetch replaces it.
Detailed discussion
Root cause
AppState::updatecallsrefresh()on the visible screen for everyTaskResult::Refreshit drains.PlatformInfoScreen::refresh()treated that as "start over": it clearedactive_tasks(the spinner and the disabled button),current_resultandcurrent_result_title.During a contest refresh those notifications arrive several times a second, so:
The result was therefore lost rather than late: by the time the notifications stopped there was nothing left to show.
Nothing this screen shows is read from local data, so a refresh notification gives it nothing to re-read. The code is unchanged since before the last weekly build; what changed is that the contest refresh now starts by itself shortly after launch and then periodically, instead of only behind a manual Refresh.
Fix
PlatformInfoScreen::refresh()no longer touches the screen's state: a refresh notification leaves the fetch in flight and the shown result alone.What belongs to the previous network is dropped where the network changes.
Screen::change_contextnow has an explicit arm for this screen that assigns the new context and callsPlatformInfoScreen::reset_for_network_switch()— the pattern the top-up, send and new-identity screens already use. A result from the previous network is therefore gone as soon as the switch happens, instead of lingering until some later refresh notification reaches the screen.No change to the contest refresh, to how
AppStateroutes results or notifications, or to network traffic.Other screens
Several other screens also reset view state in
refresh()— among them the document query screen, the group actions screen, the identity hub and the DashPay profile and contacts views. They are not changed here: eachrefresh()is also the hook a deliberate caller relies on, so none is the same safe few-line change. Two of them were reproduced on Testnet while the contest refresh was running: the add-funds amount field was replaced by "Checking the available amount…" and typed digits were dropped, and text typed into the Contracts query box was cleared. #1071 handles those at the source, by keeping the contest refresh from notifying screens that show no contest data.Known and left as is: a result that lands while another screen is in view is still handed to that screen, so leaving Platform info mid-fetch leaves its spinner up until the next fetch completes. That routing predates this change.
Testing
tests/kittest/platform_info_screen.rsdrives the real path with no network: it clicks the fetch button, feeds refresh notifications through the app's result channel, delivers the result, feeds more notifications, and asserts on what is rendered — spinner while running, then the answer under the right heading.src/ui/tools/platform_info_screen.rspin the contract:refresh()keeps a fetch in flight and keeps a shown result, and a network switch throughScreen::change_contextclears both.refresh()unit tests fail without the fix; the network-switch test fails when the reset call is removed fromScreen::change_context. All four pass with the fix.Relationship to #1066, #1067 and #1071
Independent of #1066 and #1067. Those change how the contest refresh paces and orders its work; with them applied this symptom is unchanged, because any refresh notification that reaches this screen triggered it. This branch is based on
v1.0-devand does not touch the refresh pass.Overlaps with #1071. That PR stops the contest refresh from sending refresh notifications to this screen at all, which removes the reported symptom without this change. This PR is the narrower, complementary half: it makes this one screen keep its fetch and result whatever sends a refresh notification. With #1071 merged it is optional hardening. Both add an entry to
CHANGELOG.md, so whichever merges second needs that file resolved.🤖 Generated with Claude Code
https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
🤖 Co-authored by Claudius the Magnificent AI Agent
PR Hygiene ·
c48fbe9CHANGELOG.md,src/ui/mod.rs,src/ui/tools/platform_info_screen.rsand 2 more) — approved by lklimekWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.