Skip to content

Incremental sync (v2): delta upload + manifest reconciliation + persisted state#1

Merged
Gedthub merged 2 commits into
mainfrom
incremental-loot-session-sync
Jun 19, 2026
Merged

Incremental sync (v2): delta upload + manifest reconciliation + persisted state#1
Gedthub merged 2 commits into
mainfrom
incremental-loot-session-sync

Conversation

@Gedthub

@Gedthub Gedthub commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves the companion from re-uploading the entire loot history on every sync to incremental syncing (payload v2), and persists sync state across restarts.

Problem

Previously, any change re-sent the full history and the backend replaced everything. The dedup hash lived only in memory, so every app restart re-uploaded the whole history again.

Changes (electron/watcher.ts, electron/store.ts)

  • Delta upload — on a file change, only entries whose content hash differs from the last acknowledged hash are sent (is_full_sync: false). Per-entry id and hash use the same formulas as the addon and backend.
  • Manifest reconciliation — at startup and once per day, the companion fetches GET /api/loot-sessions/manifest ({ entryId: hash }); if local state diverges it performs a full reconcile, otherwise it uploads nothing. Self-healing against drift.
  • Persisted sync statesyncState (acknowledged hashes + last reconcile time) is stored per file via electron-store, so restarting no longer triggers a full re-upload.
  • v1 path preserved — payloads without per-entry id (older addon) keep the previous behavior.

Verification

  • Type-checks clean (tsc -p tsconfig.node.json).
  • The backend counterpart was verified end-to-end against a development database.

Note

Requires the matching backend (v2 endpoints) to be deployed. Until then the v1 fallback keeps working.

🤖 Generated with Claude Code

@Gedthub
Gedthub force-pushed the incremental-loot-session-sync branch from 1bc45d9 to bdd015c Compare June 19, 2026 22:04
…sted state

watcher.ts: processV2 sends only entries whose content hash differs from the acknowledged one (delta), with a manifest reconciliation safety net (GET /api/loot-sessions/manifest at startup and once per day, full reconcile on drift). store.ts persists syncState per file (acked hashes + last reconcile) so restarting no longer re-uploads the whole history. v1 path preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Gedthub
Gedthub force-pushed the incremental-loot-session-sync branch from bdd015c to 84e4fcd Compare June 19, 2026 22:08
Englishize pre-existing French strings/comments in App.tsx (UI labels) and watcher.ts (logs, connection-test and sync status messages), so the public repo contains no French.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Gedthub
Gedthub merged commit 0ec81fa into main Jun 19, 2026
1 check passed
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