Snapshot and incremental sync
Bootstrap one coherent public generation, then apply ordered changes from its terminal checkpoint.
Initial snapshot
- Call health and record its public generation before reading any records.
- Page
/demand/gapsuntilnext_cursoris null, checkingmeta.public_generationas each response arrives. - Reject the read if any page identifies a different generation.
- Once the terminal page reports a complete snapshot, persist its returned records and
meta.sync.checkpointtogether.
Do not expose the partially paged dataset as a new local version. Build it separately, validate the terminal checkpoint, then replace the prior local snapshot atomically.
Incremental reads
Pass that terminal checkpoint to /demand/changes. Apply changes in response order and store each continuation with the page it accompanies.
A 409 means the checkpoint, filter window or public generation can no longer continue safely. Discard local incremental state and take a new full snapshot. Do not merge records from different generations.
Customer changes contain only scheduled cohort releases. A cohort release may supply a safe detail URL. If that URL returns 404, continue draining changes because a later tombstone or archive may already have won.
Coherence checks
A client should verify:
- every snapshot page has the same public generation;
- the terminal page reports a complete full snapshot and an opaque checkpoint;
- summary and taxonomy use that generation before presenting a combined dashboard; and
- a probe from the terminal checkpoint contains no unseen change before the bundle is accepted.
Date-window snapshots use a repeated full read for the final consistency check because the changes resource rejects date filters.
Crash-safe local application
Store records, active filters, public generation and checkpoint as one local transaction. During incremental sync, apply each page and its continuation together. If the process stops before commit, repeat the page. If a detail lookup returns unavailable, continue the ordered feed.
Retain the last coherent local snapshot during 429 and 503 responses. Clear it only when your own retention policy requires it or authorization is no longer valid.