Skip to content

Fix Google Sheets sync dedup and stale row index bugs#7

Open
romanlv wants to merge 1 commit intomainfrom
roman/fix-sync-dedup-stale-rows
Open

Fix Google Sheets sync dedup and stale row index bugs#7
romanlv wants to merge 1 commit intomainfrom
roman/fix-sync-dedup-stale-rows

Conversation

@romanlv
Copy link
Copy Markdown
Owner

@romanlv romanlv commented Mar 27, 2026

Summary

  • Upsert on save: saveArticle/saveArticles now check for existing URLs before writing, preventing duplicate rows when multiple devices save the same article
  • Fresh row indices on update/delete: batchUpdateArticles re-fetches row numbers right before writing, avoiding stale indices caused by concurrent sheet modifications from other devices
  • Deduplicate on read: getArticles deduplicates by URL (keeps last occurrence), handling pre-existing duplicates gracefully
  • Mock Google Sheets API server: Stateful test mock with external mutation helpers and request interceptors for simulating cross-device race conditions
  • Sync engine tests: 11 tests covering dedup, stale index handling, multi-device scenarios, and cleanup safety

- saveArticle/saveArticles now upsert instead of blindly appending,
  preventing duplicate rows when multiple devices save the same URL
- batchUpdateArticles re-fetches fresh row numbers before writing,
  avoiding stale indices after concurrent sheet modifications
- getArticles deduplicates by URL, keeping the last occurrence
- Add mock Google Sheets API server and sync engine tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant