fix(alerts): make alert-read sync outcome observable, fix offline queue gap#29
Merged
proofofprints merged 4 commits intoJun 18, 2026
Merged
Conversation
…obile acknowledge_alert previously only flipped the local flag — nothing reached the cloud, so a read marked on the desktop never showed up on the web portal or mobile app. It now POSTs the alert's (ruleName, minerIp, timestamp) tuple to the new /ingest/alert-read endpoint after marking it locally, falling back to the offline queue (drained by the sync loop) when offline or on failure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YYr4XG3SBHoSpP33d84Jqa
… queue acknowledge_alert always returned Ok(()) regardless of whether the cloud push succeeded, and the success path had no logging at all — making it impossible to tell from the console whether an ack ever reached the cloud. Also the offline queue's CHECK constraint never included 'alert-read' (or 'alerts-read-all'), so a queued ack while offline would silently fail to insert.
…ert-control-sync-dsu4ko # Conflicts: # src-tauri/src/commands/alerts.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
While debugging why desktop→cloud alert-read sync appeared to do nothing, found that
acknowledge_alertalways returnsOk(())regardless of whether the cloud push actually succeeded, and the success path has zero logging. There was no way to tell from the console whether an ack ever reached the cloud, or distinguish "it worked silently" from "it never ran" (e.g. clicking ack on an alert already marked acknowledged locally is also a silent no-op).Also found a real latent bug while in here: the offline sync queue's SQLite
CHECKconstraint only allowedkind IN ('snapshot', 'alert', 'miners')—'alert-read'/'alerts-read-all'were never added, so a queued ack while offline would fail to insert.What
acknowledge_alertnow logs the outcome of every branch: push succeeded, push failed (with the actual HTTP error), no api_key set, enqueue succeeded, enqueue failed.'alert-read'and'alerts-read-all'to the queue table'sCHECKconstraint (+ migration for existing installs, mirroring the existing'miners'migration pattern).Test plan
cargo check/build isn't runnable in this sandbox (missing system GTK/GDK dev libs) — review the diff; changes are two small, low-risk Rust edits (log calls + CHECK-constraint string literals).Generated by Claude Code