Commit graph

17 commits

Author SHA1 Message Date
Adam Brown
31b98876f7
Pre-sync change probe: skip syncing unchanged projects (#584)
On app open, sync made ~4 HTTP round-trips per project even when nothing
had changed. Add a batched pre-sync probe: the client sends a project-wide
content hash for each eligible project in one request, and the server
returns which ones still match so the client can skip syncing them.

- base: ProjectContentHasher (entity hashes + project-data hash, computed
  identically on client and server) and probe request/response DTOs
- server: POST /projects/{userId}/sync_probe, recomputing each project's
  hash from stored state; skips projects with an in-flight sync session;
  400 on a malformed body
- client: cache the hash in the project journal (written at FinalizeSync,
  invalidated on any content mutation via one chokepoint); probe is
  best-effort and degrades to a full sync on any failure
- backstop: never skip a project with pending entity or project-data work,
  so a stale cache can't drop a change

Writing activity is excluded by design (per-device, conflict-free).

Tests: ProjectContentHasher, client/server probe units, and an e2e suite
covering client/server hash agreement, the session gate, auth, and 400s.
2026-06-10 23:15:50 -07:00
Adam Brown
c632d048fb
Fix project sync session lockout (same-install session reclaim) (#583)
Server reclaims a project sync session only for the originating install
(derived from the auth token), so a leaked or cancelled session no longer
blocks the owner; a different active install is still rejected. Client
ends sessions under NonCancellable so end_sync isn't dropped when a sync
coroutine is cancelled.
2026-06-10 19:29:01 -07:00
Adam Brown
255eae9c69
Document writing-activity sync phase in protocol doc
The protocol doc only referenced writing-activity sync in the flowchart
and an offhand parenthetical. Add a dedicated section explaining the
per-device slot model, the GET/POST endpoints, the own-slot merge
strategy, and why errors are swallowed.
2026-04-29 18:12:00 -07:00
Adam Brown
b1189d50dd
Add per-project synced settings (author, theme, word goal)
New project-data sync phase runs before entity transfer. The blob is a
single per-project row on the server, hash-checked for conflicts; the
client surfaces a per-field pick-a-side resolver UI when both sides
edited concurrently. Author name is a text field, custom theme uses a
clickable color swatch backed by skydoves/colorpicker-compose, and the
word-count goal is cadence + count. Each opt-in section nulls out its
data when unchecked so the wire signal is unambiguous.
2026-04-28 19:31:45 -07:00
Adam Brown
4ada7b3f14 Sync protocol can now heal stale server data 2026-01-12 14:26:40 -08:00
Adam Brown
c1016a6115 Syncing Protocol
- Enforce session expiration
- Handle missing project ID more gracefully
- Cleanup syncing protocol doc
2025-12-20 11:21:03 -08:00
Adam Brown
7fa9437ee5
Update SYNCING-PROTOCOL.md 2024-11-11 13:13:21 -08:00
Adam Brown
74781efc4f
Update SYNCING-PROTOCOL.md 2024-11-11 13:09:30 -08:00
Adam Brown
5274d87f1e Organize 2024-11-10 21:07:14 -08:00
Adam Brown
0e6db822c6 Documenting the syncing protocol 2024-11-10 20:52:34 -08:00
Adam Brown
017ad70694 Documenting the syncing protocol 2024-11-10 19:42:47 -08:00
Adam Brown
56237fd2f3
Update SYNCING-PROTOCOL.md 2024-10-23 18:10:57 -07:00
Adam Brown
433fa2fa17
Update SYNCING-PROTOCOL.md 2024-10-20 15:19:14 -08:00
Adam Brown
ee61217b8b Documented the Account Sync Protocol 2024-10-20 14:26:23 -07:00
Adam Brown
6128064879 Documented the Account Sync Protocol 2024-10-20 14:13:31 -07:00
Wavesonics
e965da0a29 tweaks 2023-08-26 23:12:42 -07:00
Wavesonics
e812192c07 Initial documentation on syncing protocol 2023-08-26 23:05:18 -07:00