Feed preference writes can overwrite concurrent changes #24
Labels
No labels
auth
bug
composer
correctness
database
durability
enhancement
feeds
interactions
notifications
performance
reliability
safety
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starsetbyte/peregrine#24
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
putPreferences replaces complete array from cached snapshot. Other client's changes overwritten.
Proposed fix
Fetch latest immediately before write.
Source: Codex code review — data #3
Already fixed on
mainby PR #25 (codex/fix-feed-preference-race).FeedPreferencesRepository.syncToServer()now fetches a fresh snapshot viafetchPreferencesSnapshot()immediately before theputPreferenceswrite, splices only the updatedsavedFeedsPrefV2into the latest array, and preserves all non-feed items (val nonFeedItems = latestSavedItems.filter { it.type != "feed" }) so another client's concurrent changes survive. AsyncMutexserializes concurrent syncs from this app.Covered by
FeedPreferencesRepositoryTest:sync fetches latest preferences and preserves concurrent unrelated changessync preserves non-feed saved items from latest snapshotVerified green on
mainjust now. Closing as completed.