Skip to content

fix(voting): stop the old-schedule notice for votes a pre-release build already cast - #1070

Merged
lklimek merged 3 commits into
v1.0-devfrom
fix/legacy-schedule-false-notice
Oct 12, 2026
Merged

lklimek merged 3 commits into
v1.0-devfrom
fix/legacy-schedule-false-notice

Conversation

@Claudius-Maginificent

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

Copy link
Copy Markdown
Collaborator

TL;DR

People who moved from 0.9 to a weekly pre-release and then to this build were told at every start that their old scheduled votes "will not be cast" — for votes the pre-release had already cast. The notice now checks what that pre-release did with each schedule and stays quiet when nothing is left to do. Nothing is imported or cast as a result of this check.

User story

As a masternode owner who scheduled votes in 0.9, upgraded to a weekly pre-release that cast them for me, and now installs the next build, I want the app to stay quiet about those votes, so that I am not sent to redo votes that are already on the network — and so that I can trust the notice when it does appear.

Scenario

A user scheduled a few name-contest votes in 0.9. They installed a weekly pre-release, which took those schedules over and cast them when they came due. They then install this build.

Actual behavior

On every start, for up to 14 days on Mainnet, a warning says that votes scheduled in an earlier version were not carried over and will not be cast, and asks the user to schedule them again. The votes were cast weeks ago. A careful user goes looking for votes that need no action; a less careful one learns to ignore the warning.

Expected behavior

  • Votes the pre-release cast and still lists as cast: no warning.
  • Votes that are no longer in the pre-release's list — cleared after being cast, or removed one by one: the warning appears, for the usual length of time. The app cannot tell these apart from votes the pre-release never took over, and a missed vote costs more than an unneeded reminder.
  • A vote the pre-release had taken over but not cast yet: the warning appears, because this build really will not cast it.
  • Upgrading straight from 0.9: the warning appears exactly as before, for the same length of time.
  • A fresh install, or a profile that only ever ran a pre-release: no warning, as before.

Detailed discussion

Root cause

has_legacy_scheduled_votes (src/context/legacy_scheduled_votes.rs) decides whether the startup notice is due by reading the legacy SQLite scheduled_votes table in data.db and the current vote journal. The weekly pre-releases (v1.0.0-weekly.20260717 through v1.0.0-weekly.20261006) copied those rows into their own k/v queue (det:scheduled_vote:<contested_name> per voter, indexed by det:scheduled_vote_voters:v1), cast them from there, and never updated or deleted the SQLite rows. So a row such a build cast still says executed = 0, the journal knows nothing about it, and the predicate reported it as unexecuted and unrepresented.

The signal

When at least one SQLite row is still unexecuted and unrepresented, the predicate now reads the retired queue, read-only:

Retired voter index Retired entry for the row Notice for that row
absent — due (unchanged; this is the direct 0.9 upgrade)
undecodable — due (fail-safe)
present, even empty marked cast not due
present, even empty absent due — removed there or never copied; the two cannot be told apart
present, even empty marked uncast due — this build will not cast it
present, even empty undecodable due (fail-safe)

Unreadable SQLite rows raise the notice as before, on every path: no build ever cast them.

Why the voter index: every affected weekly wrote it when it imported the SQLite rows and rewrote it — to an empty list, not deleted — when a voter's last schedule went away, so its presence survives the cases that matter. The entry format is identical across all eleven affected tags.

Why not a migration-completed marker: the app-data and wallet-drain completion markers are written by this build as well, under the same keys and with an identical payload (both builds record the same package version), on a direct 0.9 upgrade. They cannot tell the two paths apart.

Why a missing entry is not trusted: the pre-release copied the SQLite rows one at a time, updating the voter index after each row, and recorded completion only after the whole batch. A copy that stopped part-way (a crash, or a storage error) could leave a valid index and no entry for a row it never reached. Once this build has run, nothing stored shows whether that copy finished: this build writes the same completion marker in its own storage update, which ends before the startup check runs, and a removed entry leaves the same bytes as one never copied. So only an entry that is still present and marked cast leaves a schedule out.

What stays as decided in #901

  • Nothing is imported, queued or cast from the retired queue. The mirror type used to decode an entry has no serializer, so this build cannot write that format.
  • Schedules that exist only in the retired queue (made in a pre-release, never in 0.9) are still neither carried over nor reported.
  • The existing notice window, wording and its "first noticed" timestamp are untouched. A notice that is not due does not start its countdown.

Known limits

  • "Clear all" in the pre-release deleted the voter index together with the queue. Such a profile looks exactly like a direct 0.9 upgrade and still gets the notice, for the usual bounded window. Closing this would need this build to mark its own completion of the app-data pass, which changes migration code and misclassifies profiles already upgraded by development builds; left out on purpose.
  • Schedules the user cleared or removed in the pre-release raise the notice again, on each start until one contest duration after it first appeared (14 days on Mainnet, 90 minutes on Testnet). This is the same outcome as "Clear all" above and is accepted so that a vote nobody cast is never hidden.
  • The notice is still evaluated only for the network active at start (pre-existing; not changed here).

Errors

A store failure while reading the retired queue returns a dedicated typed error (TaskError::RetiredScheduledVotesRead, typed source, no text field) and surfaces through the existing "could not be checked" banner. Undecodable records are classified by matching the adapter's error variants, never by message text.

Documentation

docs/kv-keys.md no longer says the two retired keys are never read, and describes the rules above. CHANGELOG.md gains a Fixed entry; the Removed entry now says the old format is "no longer used" rather than "no longer read".

Testing

New unit tests in src/context/legacy_scheduled_votes.rs, built with the same fixtures as the existing ones (legacy table and row helpers, in-memory k/v store) and driven through legacy_scheduled_votes_notice_due, the call the boot path makes. The retired entries are written with a test-local copy of the weekly's stored type, independent of the production decoder.

  • cast by a pre-release → no notice, no countdown started (failed before the fix);
  • no longer held by a pre-release, index left empty → notice;
  • pre-release copy interrupted after an executed row, pending row never copied → notice (failed before the fix);
  • a store failure → typed error instead of a guess (failed before the fix);
  • left waiting by a pre-release → notice;
  • unreadable SQLite row after a pre-release → notice;
  • damaged index or entry → notice;
  • schedules made only in a pre-release, with and without an empty legacy table → no notice;
  • the check performs no write and no delete.

Unchanged and still passing: the four existing notice tests (direct upgrade, window, executed rows and other networks, unreadable rows), the v093_upgrade migration tests including the damaged-index one, the two finish_unwire tests that assert the notice after a real migration, and the banner test in src/app.rs.

Not covered: a profile written by a real weekly binary. No such fixture exists in the repository, and none was added.

🤖 Generated with Claude Code
https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

🤖 Co-authored by Claudius the Magnificent AI Agent

PR Hygiene · 1c28fe9

  • Bots — coderabbitai skipped by lklimek · thepastaclaw ✓
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, docs/kv-keys.md, src/backend_task/error.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.

…ld already cast

The weekly pre-releases (v1.0.0-weekly.20260717 to 20261006) copied the
legacy SQLite scheduled_votes rows into their own k/v queue, cast them
from there and never updated the SQLite rows. has_legacy_scheduled_votes
read only SQLite and the journal, so on 0.9.x -> weekly -> this build it
reported already-cast votes as "will not be cast" on every launch for one
contest duration.

When an unexecuted, unrepresented SQLite row remains, the predicate now
reads the retired queue, read-only:

- voter index det:scheduled_vote_voters:v1 absent: no such build took the
  schedules over, behaviour unchanged (direct 0.9.x upgrade);
- index present, even empty: a row is due only while its
  det:scheduled_vote:<name> entry is still marked uncast; a cast or
  missing entry needs no notice;
- undecodable index or entry: due, the same fail-safe as unreadable rows.

Nothing is imported or cast, and schedules that exist only in the retired
queue stay unreported, as decided in #901. The decode mirror has no
serializer, so the retired format cannot be written. The migration
completion markers were not usable as a signal: this build writes the
same keys with an identical payload on a direct upgrade.

A store failure returns the dedicated TaskError::RetiredScheduledVotesRead;
undecodable records are classified by KvAdapterError variant.

Known limit: "Clear all" in the pre-release deleted the index too, so
that profile is indistinguishable from a direct upgrade and still gets
the notice for the usual bounded window.

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: 4a291f45-6c87-4bcd-956d-88b5913f3ce4

📥 Commits

Reviewing files that changed from the base of the PR and between 2d354d8 and 1c28fe9.


📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/kv-keys.md
  • src/backend_task/error.rs
  • src/context/legacy_scheduled_votes.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 1c28fe9) · triage: normal · Phase 2 only (no Phase 1 for this repository)

@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 supplied Phase-2 finding against head 1535994 and the historical pre-release migration code. The new absence handling can suppress the warning for a vote that was never imported or cast after an interrupted migration. This was a static review; the supplied CI snapshot shows Test Suite and Clippy skipped, so it provides no executed validation for this head.

🔴 1 blocking

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: normal by gpt-6.1-sol (effort low) — The change adds historical-format decoding, fail-safe branching, and regression tests to a startup-notice predicate, but only reads retired records and does not change storage migrations or other critical surfaces.
  • 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 high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/context/legacy_scheduled_votes.rs`:
- [BLOCKING] src/context/legacy_scheduled_votes.rs:173-178: An interrupted pre-release import can hide votes that were never cast
  A present voter index does not prove that the pre-release imported every readable SQLite schedule. In `v1.0.0-weekly.20260908`, `insert_scheduled_votes` (`src/context/identity_db.rs:2336–2352`) writes each schedule and updates the index inside its loop, without a batch transaction; `migrate_app_data` writes its completion sentinel only after that batch succeeds. For a concrete reachable case, the first SQLite row can already be marked executed: the historical importer includes executed rows too. If the process stops after writing that row and its index but before importing a second, unexecuted row, the profile has a valid index and no retired entry for the pending vote. On upgrade, the current migration imports only top-up history, so it never repairs the missing entry. This `Retired::Absent` arm then excludes the pending vote and returns no notice, although nobody cast or removed it; the base predicate would have warned. Preserve the warning for absent entries unless completed takeover can be established, and add regression coverage for an interrupted batch containing an executed row followed by an unimported pending row.

Comment thread src/context/legacy_scheduled_votes.rs Resolved
@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 requested changes — dismiss the review or push a fix, 1 thread unresolved — resolve it. 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 waiting-bots Waiting for the review bots to report on this head waiting-self-review Waiting for the author to post /self-reviewed 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
…a pre-release queue

A pre-release build copied the old SQLite schedules into its own queue one
row at a time, updating the voter index after each row and recording
completion only once the whole batch was written. A copy interrupted after
an already-executed row therefore left a valid voter index and no entry for
a pending row behind it. The startup check read that missing entry as "cast
and cleared, or removed by the user" and raised no notice for a vote nobody
had cast.

Completion of that copy cannot be established afterwards: this build writes
the same completion marker in its own storage update, before the check runs,
and a removed entry leaves the same bytes as one never copied. So a missing
entry now raises the notice, and only an entry still present and marked cast
leaves a schedule out.

Schedules cleared or removed in the pre-release build raise the notice again
until one contest duration after it first appeared, as they do after
clearing the whole queue.

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

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Oct 9, 2026

@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 cb0dc55 and found no remaining actionable in-scope issues. The interrupted-import defect is fixed: missing retired entries preserve the warning, while retained entries marked cast suppress it without importing or modifying schedules. This was a static review; no builds or tests were run, and Test Suite and Clippy were still pending in the supplied CI snapshot.

🔴 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: normal by gpt-6.1-sol (effort low) — The change adds read-only legacy queue decoding and multiple fail-safe paths to startup notice logic, but does not alter storage migrations, vote casting, or any other 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 high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); 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.

@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:30
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
@github-actions

github-actions Bot commented Oct 12, 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 waiting-bots Waiting for the review bots to report on this head and removed 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. labels Oct 12, 2026
@lklimek
lklimek enabled auto-merge (squash) October 12, 2026 08:07
@lklimek

lklimek commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

/skip-bots

@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 at head 1c28fe9 contains no actionable in-scope findings. The retired-queue check is read-only, suppresses the notice only for retained entries marked successfully cast, and preserves it for missing or undecodable records; the interrupted-import defect is fixed. Validation was static only: the supplied exact-head CI snapshot reports successful Test Suite, Clippy, and Platform pin guard checks, with PR Hygiene pending.

🔴 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: normal by gpt-6.1-sol (effort low) — The change adds nontrivial read-only compatibility logic and fail-safe handling for a retired vote queue, but does not change vote casting, funds movement, or storage migrations.
  • 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 high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); 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.

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added 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 12, 2026
@lklimek
lklimek merged commit 18a649c into v1.0-dev Oct 12, 2026
11 checks passed
@lklimek
lklimek deleted the fix/legacy-schedule-false-notice branch October 12, 2026 08:11
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