Repository navigation
fix(voting): stop the old-schedule notice for votes a pre-release build already cast - #1070
Conversation
…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
|
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 details
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 1c28fe9) · triage: normal · Phase 2 only (no Phase 1 for this repository) |
thepastaclaw
left a comment
There was a problem hiding this comment.
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:
normalbygpt-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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-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.
|
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 |
…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
|
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.
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:
normalbygpt-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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-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.
|
Ready for review — files with no dedicated owner: lklimek. |
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
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
/skip-bots |
thepastaclaw
left a comment
There was a problem hiding this comment.
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:
normalbygpt-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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-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.
|
Policy satisfied — this can merge. |
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
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 SQLitescheduled_votestable indata.dband the current vote journal. The weekly pre-releases (v1.0.0-weekly.20260717throughv1.0.0-weekly.20261006) copied those rows into their own k/v queue (det:scheduled_vote:<contested_name>per voter, indexed bydet:scheduled_vote_voters:v1), cast them from there, and never updated or deleted the SQLite rows. So a row such a build cast still saysexecuted = 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:
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
Known limits
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.mdno longer says the two retired keys are never read, and describes the rules above.CHANGELOG.mdgains aFixedentry; theRemovedentry 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 throughlegacy_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.Unchanged and still passing: the four existing notice tests (direct upgrade, window, executed rows and other networks, unreadable rows), the
v093_upgrademigration tests including the damaged-index one, the twofinish_unwiretests that assert the notice after a real migration, and the banner test insrc/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 ·
1c28fe9CHANGELOG.md,docs/kv-keys.md,src/backend_task/error.rsand 1 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.