Use INSERT OR IGNORE for excluded_statuses markers - #2189
Merged
jocmp merged 2 commits intoAug 2, 2026
Merged
Conversation
upsertUnread/upsertStarred insert into excluded_statuses(article_id, type) with no conflict clause. markAllUnread runs the marker inserts and the updateStaleUnreads cleanup in one transaction, so a duplicate or stranded marker makes the insert throw, rolls back the transaction, skips the cleanup, and strands the markers -- failing identically on every subsequent sync, so unread refresh never completes. Use INSERT OR IGNORE so duplicate/leftover markers are skipped and the cleanup self-heals. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yVKgdxd3ZSrFeY5eWpFuA
Owner
|
Pushed a follow-up commit to this branch (maintainer edit) rather than opening a competing PR. Two additions on top of the
Verified the tests fail with either fix reverted and pass with both — One note on the description: the "marker stranded by an earlier interrupted sync" mechanism doesn't hold, since the marker inserts and |
ron159
pushed a commit
to ron159/MeerkatReader
that referenced
this pull request
Aug 13, 2026
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.
Problem
During
refreshUnreadEntries→markAllUnread, syncing fails with:upsertUnread/upsertStarredinsert a marker row intoexcluded_statuses(article_id, type)with no conflict clause (the siblingarticle_statusesinsert correctly usesON CONFLICT).markAllUnreadruns all the marker inserts and theupdateStaleUnreads()cleanup — which deletes those markers — in a single transaction. So if any marker already exists (a duplicate ID in the batch, or a marker stranded by an earlier interrupted sync), the insert throws, the whole transaction rolls back, the cleanup never runs, and the leftover markers guarantee the same failure on every subsequent sync. Unread refresh never completes and the client churns.Fix
Make the marker insert idempotent with
INSERT OR IGNORE. Duplicates/leftovers are skipped, the transaction completes, andupdateStaleUnreads/updateStaleStarsclean up the markers as intended — self-healing.Verified on a Boox device (Android 11): the recurring
db_errordisappears and unread refresh completes cleanly.🤖 Generated with Claude Code
https://claude.ai/code/session_015yVKgdxd3ZSrFeY5eWpFuA