Skip to content

fix(dpns): keep the background contest refresh from resetting unrelated screens - #1071

Merged
lklimek merged 19 commits into
v1.0-devfrom
fix/contest-refresh-notifies-voting-screens-only
Oct 12, 2026
Merged

lklimek merged 19 commits into
v1.0-devfrom
fix/contest-refresh-notifies-voting-screens-only

Conversation

@Claudius-Maginificent

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

Copy link
Copy Markdown
Collaborator

TL;DR

While the app refreshed name contests in the background, whatever screen you were on kept being reset: a lookup you had just started lost its spinner and its answer, search text you had typed disappeared, and amount fields flickered away. The refresh now only touches the voting screen; every other screen is left alone.

User story

As someone using the app while it keeps its voting data up to date in the background, I want the screen I am working on to stay exactly as I left it, so that a refresh I did not ask for cannot wipe what I typed or hide the answer I am waiting for.

Scenario

Open the app with at least one masternode loaded and wait until the background refresh of name contests starts (about a minute after launch, then every few minutes). While it runs, work on a screen that has nothing to do with voting: start a lookup on Tools ▸ Platform info, type a query on Contracts, or enter an amount on a form that adds funds to an identity.

Actual behavior

Several times a second, for as long as the refresh runs, the screen is told to start over. The Platform info result area falls back to "No results yet" and the answer never appears. Text typed into the Contracts query can be cleared. The amount field on the add-funds form can be replaced by "Checking the available amount…" for a moment, and keystrokes typed meanwhile can be lost.

Expected behavior

Nothing on those screens changes because of the background refresh. Masternodes ▸ Votes, the node cards, the Masternodes badge and the "needs your vote" indicators keep updating as the refresh progresses, exactly as before.

Detailed discussion

Builds on #1066 and #1067, which are merged.

Root cause

The contest refresh pass (query_dpns_contested_resources) reported progress with TaskResult::Refresh — once per list page, after the end-time read, per contender read, and after the early vote proof. AppState::update answers every TaskResult::Refresh with refresh() on the visible screen, whatever it is. That was harmless while a pass only ran behind a manual Refresh on the voting screen; since the pass also runs by itself on a timer, the notifications reach any screen the user happens to be on, and several screens treat refresh() as "start over".

Design

A dedicated notification, TaskResult::DpnsContestsChanged, replaces the pass's four TaskResult::Refresh sends. AppState::update merges it with adjacent cache notifications the same way it already merges refreshes, and answers it with refresh() only when the visible screen is the Masternodes screen.

Who needs to hear about contest data:

  • MasternodesScreen is the only screen that caches it: its refresh() reloads the node cards and the embedded voting panel. Votes sub-views and node pages are views inside this screen, not pushed screens.
  • The left-panel badge, the attention chip and the identity home's pending-username indicator read from AppContext every frame. The sender already requests a repaint, so they need nothing more.

TaskResult::Refresh keeps its meaning and its other senders are unchanged: identity refresh, owned-names refresh and token-balance refresh each send one notification when their task finishes, not a stream. The wallet event bridge sends only TaskResult::Repaint.

Why a scoped notification rather than the alternatives: merging more aggressively still resets a screen once per frame; a typed success result would pass through every success hook and every screen's result handler; having the voting screen poll for changes would alter when and how that screen refreshes. This changes exactly one thing — who is told.

Of the symptoms above, the Platform info, add-funds and Contracts ones were reproduced on Testnet on a build without this change, each while a refresh was running; the Send amount field kept its digits there, so that one is predicted from the code only.

Unchanged: the pass's requests, their order and pacing, the early vote proof, what the voting screen does on each notification, and a pass started by Refresh on the voting screen. A voting screen that is hidden was not refreshed by the pass before and is not now; it re-reads on arrival.

Testing

  • a_pass_reports_contest_changes_without_refreshing_every_screen (lib) runs a pass against a mock SDK and asserts it sends the scoped notification and no TaskResult::Refresh.
  • contest_notifications_do_not_refresh_a_screen_without_contest_data (kittest) puts a withdrawal form on screen, changes its identity in storage, feeds contest notifications through the app's result channel and asserts the form did not re-read; a TaskResult::Refresh then makes it re-read, proving the probe detects a refresh.
  • contest_notifications_update_the_open_votes_view (kittest) opens Masternodes ▸ Votes, caches a new open contest, sends one contest notification and asserts the contest appears.
  • The existing masternode_tab kittests and the contested-names and voting-panel lib tests pass unchanged.
  • Live check on Testnet (debug build of this branch, fresh profiles with an empty contest history, every check made while the first refresh was running): a Platform info fetch showed its result within 5 seconds in 7 of 7 attempts on three profiles (0 of 3 on a build without this change); ten digits typed into the add-funds amount were all kept (without this change the field was replaced by "Checking the available amount…" and digits were dropped); text typed into the Contracts query box stayed and the query result was shown (without this change the text was cleared); Masternodes → Votes kept updating by itself, History filling in within about 8 seconds. No rate-limit errors in 6 sessions.
  • Not covered live: Tokens and DashPay screens (the test profile has no tokens and no social profile, so nothing was loading there), and a vote cast from this build.

🤖 Generated with Claude Code

https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

🤖 Co-authored by Claudius the Magnificent AI Agent

PR Hygiene · ce968a8

  • Bots — coderabbitai ✓ · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, src/app.rs, src/backend_task/contested_names/query_dpns_contested_resources.rs and 1 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.

Summary by CodeRabbit

  • Bug Fixes
    • Background name-contest updates now refresh contest and voting information without disrupting unrelated screens, clearing search results, or interrupting amount entry.
    • Open voting screens update when contest information changes.

lklimek and others added 5 commits October 9, 2026 13:22
A contest refresh pass asked Platform for the contenders of every contest
the app had ever seen, finished ones included: one request per contest,
about a thousand on Testnet, 24 at a time. Since #901 that pass also runs on
arrival at Masternodes > Votes and from a background timer, so it fired
every few minutes. The SDK sends requests to five endpoints at a time and
each allows 150 a minute; one pass went past that, the endpoints answered
ResourceExhausted and were banned, and every other action shared the loss.

- A stored contest that already has its outcome (awarded or locked) is
  final: a refresh that lists it stamps it as current and no longer queues a
  contender query for it. A pass now costs the contest list plus the
  contests that are still open.
- Only one refresh pass runs at a time. The timer and a user refresh used to
  overlap and each walk the same unfilled cache.
- Contender queries of a pass start no closer than 125 ms apart, so the
  first load of a long history stays inside the request budget instead of
  arriving as one burst.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Pacing the contender queries made the first load of a long contest history
take about two minutes, with the contests that can still be voted on sitting
at a random alphabetical position in that queue.

- The pass now waits for the contest end times (a query it already made)
  before it starts the contender queries, and reads the contests whose end
  time is in the future first. The unread history is back-filled after them.
- The first 100 contender queries of a pass start at once; only the ones
  after them are paced. With 480 paced queries a minute that keeps a pass
  within 580 of the roughly 750 requests a minute the app has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
On a first load the voting choices and the Votes badge waited for the whole
paced back-fill, about two minutes for a thousand contests: both need each
node's proved votes, and the pass read those only after its last contender
query.

Reading them earlier was not safe as it stood. A listed contest nobody has
read yet has no end time and counts as open, so every unread finished
contest would have shown as waiting for a vote.

- While a pass runs, the names it has listed but not read, and has no end
  time to call open, are left out of the open contests. Each returns as soon
  as its contenders arrive, and whatever is left returns when the pass ends,
  however it ends. The set lives in memory only.
- When a pass has such unread history, it proves the nodes' votes right
  after the open contests are read and refreshes the screen, then
  back-fills. The proof at the end of the pass is kept.

A pass on a filled cache has nothing unread, takes neither step and sends
the same requests as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…tart

The names a first load had listed but not read were kept out of the open
contests by a set held in memory for the length of the pass. The early vote
proof, however, is stored. Quitting during a first load and starting again
within the proof's lifetime — or a pass that ended with names still unread —
left every unread name counted as an open contest the node had not voted
on: a badge in the hundreds and enabled choices on finished contests.

- A name that was only listed (never read, no end time, no contenders) is
  not an open contest, wherever the open contests are read. The rule lives
  on the contest itself, so it holds in a new process and after any pass.
  The in-memory set, its guard and its lock are gone.
- While a pass is running and unread names remain, To decide and Voted say
  the contests are still loading instead of saying none are open.

Tests that seeded such a bare name as an open contest now give it an end
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…ntest data

The contest refresh pass reported progress with TaskResult::Refresh: per list page, after the end-time read, per contender read and after the early vote proof. AppState answers each one with refresh() on the visible screen, so since the pass also runs by itself on a timer, any screen the user was on was told to start over several times a second: lookups lost their spinner and result, typed search text was cleared, amount fields disappeared while their limit was re-checked.

The pass now sends TaskResult::DpnsContestsChanged. AppState merges it with adjacent cache notifications as it merges refreshes, and answers it with refresh() only when the visible screen is the Masternodes screen, the one screen that caches contest data. The badge, the attention chip and the identity home's pending-username indicator read live each frame, and the sender already requests the repaint they need.

Unchanged: the pass's requests, order and pacing, the early vote proof, what the voting screen does per notification, and every other TaskResult::Refresh sender.

Tests: a pass against a mock SDK sends the scoped notification and no TaskResult::Refresh; a withdrawal form on screen is not refreshed by it while a TaskResult::Refresh still refreshes it; an open Votes view shows a contest cached just before the notification.

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

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-evo-tool/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f476844b-4faa-42d1-bea5-3471bc66b618

📥 Commits

Reviewing files that changed from the base of the PR and between 4da4b63 and ce968a8.


📒 Files selected for processing (4)
  • CHANGELOG.md
  • src/app.rs
  • src/backend_task/contested_names/query_dpns_contested_resources.rs
  • tests/kittest/masternode_tab.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough
📝 Walkthrough

Walkthrough

The app now distinguishes general refresh notifications from DPNS contest-change notifications. Contest changes refresh the voting screen only when it is visible. General refreshes continue to refresh the visible screen.

Changes

DPNS contest refresh

Layer / File(s) Summary
Scoped refresh handling
src/app.rs, tests/kittest/masternode_tab.rs, CHANGELOG.md
The app merges refresh requests by scope and refreshes the visible screen or the visible voting screen, as appropriate. Tests cover withdrawal-form identity and contest updates in the open Votes view. The changelog describes the refresh behavior.
Contest change notifications
src/backend_task/contested_names/query_dpns_contested_resources.rs
Contest-list, end-time, contender, and vote updates now report DpnsContestsChanged instead of Refresh. A test checks that a contest refresh pass reports contest changes without requesting a general refresh.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ContestRefreshPass
  participant AppState
  participant MasternodesScreen
  ContestRefreshPass->>AppState: Send DpnsContestsChanged
  AppState->>AppState: Queue VotingScreen refresh scope
  AppState->>MasternodesScreen: Refresh when Masternodes is visible
Loading

Suggested reviewers: lklimek


Merge Risk: ⚪ Minimal · up to ce968

Background name-contest updates now refresh only the Masternodes voting screen instead of resetting other screens. No concrete merge-blocking risk was identified.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing background DPNS contest refreshes from resetting unrelated screens.

Full details: Docstring Coverage

Explanation

Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • 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

🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit ce968a8. Normal review starts when eligible; priority review starts as soon as a slot is available.

@Claudius-Maginificent
Claudius-Maginificent marked this pull request as ready for review October 9, 2026 18:48
lklimek and others added 4 commits October 9, 2026 19:03
The pace only spaced out the spawning of contender queries; each spawned
query then waited for one of the 24 slots on its own. While answers were
slow the pace kept spawning, so queries piled up behind the slots and all
started at once when the answers arrived, well above the request allowance.

The dispatcher now takes the slot first and waits for the pace second, so
a query starts as soon as it is spawned and no sooner than one pace after
the query before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…ld-load-early-vote-state

Brings in the fix that takes a query slot before waiting for the pace.
Both dispatch calls of this branch, for the open contests and for the
rest, now pass the shared slots and the contender query to start_in_order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The first-load test sampled the vote state for a second and relied on the
paced back-fill outlasting that. A loaded machine could stretch the
sampling past the end of the pass and fail the test.

The pass now reports to a channel with room for one report, so it gets
only as far as the reports the test takes: the proof is awaited report by
report and the back-fill stays held while the vote state is checked.

A second test answers every contender read. It checks that the votes are
not proved before the read of the open contest has finished, and that
history read to its outcome does not show as waiting for a vote while the
rest is still unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…contest-refresh-notifies-voting-screens-only

Brings in the fix that takes a query slot before waiting for the pace and
the first-load tests that hold the back-fill by its reports. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

@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)

The exact-head diff confirms that contest notifications refresh only the visible Masternodes screen, while broader refresh requests retain their existing behavior and are flushed before typed results. The added regression tests cover backend notification delivery, preservation of an unrelated form, and updates to the open Votes view; no actionable in-scope issues were found. Verification was static, without local builds or test execution; the supplied CI snapshot reports successful Test Suite and Clippy checks.

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 change to contest-notification routing and refresh coalescing with focused regression tests, without changing any critical surface.
  • 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

@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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

The complete diff preserves generic refresh behavior and notification ordering while restricting contest-cache refreshes to the visible Masternodes screen. The regression tests cover unrelated-screen isolation and updates to the open Votes view; independent static inspection found no actionable in-scope defects. No builds or tests were run locally; the supplied CI snapshot reports successful Test Suite, Clippy, and Platform pin guard checks.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

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); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: 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 change to contest-refresh notification routing and coalescing with focused regression tests, without changing any critical surface.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • 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, gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

lklimek and others added 2 commits October 9, 2026 20:13
…r the proof

The helper took reports until the stored proof became visible. Another
worker could publish the proof right after an earlier report was taken, so
the helper returned with a report still filling the one-slot channel. The
pass then stayed blocked on its proof report and never began the
back-fill, and the answered-history test failed with "no history was read".

A pass sends its reports in a fixed order. Both tests now take exactly the
reports up to and including the proof report, which puts the pass in the
back-fill whichever task ran first, and then check the vote state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…contest-refresh-notifies-voting-screens-only

Brings in the first-load tests that take a fixed number of pass reports
instead of polling for the proof. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

@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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

Independently reviewed the complete diff at head 217faf9 and verified the supplied reviewer claims against notification producers, result routing, and screen refresh behavior. The scoped notification leaves unrelated screens untouched while preserving visible Masternodes updates, broader refresh requests, and typed-result ordering; no actionable in-scope findings were identified. Regression tests cover screen isolation and visible Votes updates, and the supplied exact-head CI snapshot reports successful Test Suite and Clippy checks; no builds or tests were run locally in this static-review lane.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

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); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: 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 change to contest-refresh notification routing and coalescing, with regression tests, without altering requests, voting logic, or critical surfaces.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • 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, gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

lklimek and others added 4 commits October 12, 2026 07:25
Conflict in CHANGELOG.md: both entries kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-early-vote-state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-refresh-notifies-voting-screens-only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
* fix(dpns): let operators vote while a long contest history loads

On a first load the voting choices and the Votes badge waited for the whole
paced back-fill, about two minutes for a thousand contests: both need each
node's proved votes, and the pass read those only after its last contender
query.

Reading them earlier was not safe as it stood. A listed contest nobody has
read yet has no end time and counts as open, so every unread finished
contest would have shown as waiting for a vote.

- While a pass runs, the names it has listed but not read, and has no end
  time to call open, are left out of the open contests. Each returns as soon
  as its contenders arrive, and whatever is left returns when the pass ends,
  however it ends. The set lives in memory only.
- When a pass has such unread history, it proves the nodes' votes right
  after the open contests are read and refreshes the screen, then
  back-fills. The proof at the end of the pass is kept.

A pass on a filled cache has nothing unread, takes neither step and sends
the same requests as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(dpns): keep unread contest names out of the open list after a restart

The names a first load had listed but not read were kept out of the open
contests by a set held in memory for the length of the pass. The early vote
proof, however, is stored. Quitting during a first load and starting again
within the proof's lifetime — or a pass that ended with names still unread —
left every unread name counted as an open contest the node had not voted
on: a badge in the hundreds and enabled choices on finished contests.

- A name that was only listed (never read, no end time, no contenders) is
  not an open contest, wherever the open contests are read. The rule lives
  on the contest itself, so it holds in a new process and after any pass.
  The in-memory set, its guard and its lock are gone.
- While a pass is running and unread names remain, To decide and Voted say
  the contests are still loading instead of saying none are open.

Tests that seeded such a bare name as an open contest now give it an end
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(dpns): hold the contest back-fill by its reports instead of by time

The first-load test sampled the vote state for a second and relied on the
paced back-fill outlasting that. A loaded machine could stretch the
sampling past the end of the pass and fail the test.

The pass now reports to a channel with room for one report, so it gets
only as far as the reports the test takes: the proof is awaited report by
report and the back-fill stays held while the vote state is checked.

A second test answers every contender read. It checks that the votes are
not proved before the read of the open contest has finished, and that
history read to its outcome does not show as waiting for a vote while the
rest is still unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(dpns): take a fixed number of pass reports instead of polling for the proof

The helper took reports until the stored proof became visible. Another
worker could publish the proof right after an earlier report was taken, so
the helper returned with a report still filling the one-slot channel. The
pass then stayed blocked on its proof report and never began the
back-fill, and the answered-history test failed with "no history was read".

A pass sends its reports in a fixed order. Both tests now take exactly the
reports up to and including the proof report, which puts the pass in the
back-fill whichever task ran first, and then check the vote state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from fix/votes-cold-load-early-vote-state to fix/votes-history-dapi-flood October 12, 2026 07:55
lklimek and others added 3 commits October 12, 2026 07:57
…x/contest-refresh-notifies-voting-screens-only

The squash commit's tree equals this branch's already-merged view of
#1067 on top of its parent, so it is recorded as merged without changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Conflict in CHANGELOG.md: both entries kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-notifies-voting-screens-only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Base automatically changed from fix/votes-history-dapi-flood to v1.0-dev October 12, 2026 08:32
@github-actions

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

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 12, 2026
…tifies-voting-screens-only

The squash commit's tree equals the #1066 head this branch already
contains, so it is recorded as merged without changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai ✓ · 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.

@lklimek
lklimek enabled auto-merge (squash) October 12, 2026 08:35

@lklimek lklimek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/skip-bots

@lklimek
lklimek disabled auto-merge October 12, 2026 08:52
@lklimek
lklimek merged commit f4962f0 into v1.0-dev Oct 12, 2026
13 of 14 checks passed
@lklimek
lklimek deleted the fix/contest-refresh-notifies-voting-screens-only branch October 12, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants