Skip to content

fix(tools): keep a Platform info fetch and its result through background refreshes - #1072

Merged
lklimek merged 1 commit into
v1.0-devfrom
fix/platform-info-result-lost-during-refresh
Oct 12, 2026
Merged

lklimek merged 1 commit into
v1.0-devfrom
fix/platform-info-result-lost-during-refresh

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

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::update calls refresh() on the visible screen for every TaskResult::Refresh it drains. PlatformInfoScreen::refresh() treated that as "start over": it cleared active_tasks (the spinner and the disabled button), current_result and current_result_title.

During a contest refresh those notifications arrive several times a second, so:

  1. the first one after the click removed the in-flight marker — spinner gone, "No results yet" back;
  2. the result did arrive and was stored, but the next notification, a fraction of a second later, erased it.

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_context now has an explicit arm for this screen that assigns the new context and calls PlatformInfoScreen::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 AppState routes 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: each refresh() 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.rs drives 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.
  • Unit tests in src/ui/tools/platform_info_screen.rs pin the contract: refresh() keeps a fetch in flight and keeps a shown result, and a network switch through Screen::change_context clears both.
  • The kittest and the two refresh() unit tests fail without the fix; the network-switch test fails when the reset call is removed from Screen::change_context. All four pass with the fix.
  • Not covered: a run against a live network with the real background refresh.

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-dev and 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 · c48fbe9

  • Bots — coderabbitai skipped after its own rate limit · thepastaclaw ✓
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, src/ui/mod.rs, src/ui/tools/platform_info_screen.rs and 2 more) — approved by lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

… 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
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-evo-tool/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4f3f53c-b0b2-4286-884b-24a60aaf9b72

📥 Commits

Reviewing files that changed from the base of the PR and between f34335e and c48fbe9.


📒 Files selected for processing (5)
  • CHANGELOG.md
  • src/ui/mod.rs
  • src/ui/tools/platform_info_screen.rs
  • tests/kittest/main.rs
  • tests/kittest/platform_info_screen.rs


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit c48fbe9) · triage: low · Phase 2 only (no Phase 1 for this repository)

@Claudius-Maginificent
Claudius-Maginificent marked this pull request as ready for review October 9, 2026 18:48
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: low by gpt-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort medium); agent phase2-reviewer

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: lklimek.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 9, 2026
@github-actions
github-actions Bot requested a review from lklimek October 9, 2026 20:29
@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. label Oct 12, 2026
@lklimek
lklimek enabled auto-merge (squash) October 12, 2026 07:22
@lklimek
lklimek merged commit 2d354d8 into v1.0-dev Oct 12, 2026
15 checks passed
@lklimek
lklimek deleted the fix/platform-info-result-lost-during-refresh branch October 12, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants