Change capture and change feeds
Change capture is how a row inserted, updated or deleted in a source system becomes a new version of an object, once, in the right order, even when the change arrives late, twice or out of sequence. This page follows a change from the source's own log to the object store, explains the columns and rules that keep it ordered, and shows how to read every object change back out through the change feed
In the platform today
- Connectors write source rows into raw Delta Lake tables by cursor, snapshot or watched folder, as described on connectors, and pipelines merge them by key, so each table's change data feed records real inserts, updates and deletes, and sync turns those into object versions
GET /api/v2/types/{type}/changes?since=reads an object type's feed by table version, with row policies and hidden properties applied, as shown under the change feed below- Push updates run as server-sent events
- An incremental stream with
lookbackreads again from a window before its cursor, so rows that land late with an older cursor are not missed - A delete or create made by an action survives later syncs through
_deletedand_createdmarkers until the source agrees
- Log-based capture, source positions and
@sequence, history datasets, the delete guard, lateness windows, quarantine and the fuller feed parameters
How a change moves
A change passes through four hands before anyone sees it. A connector finds it and writes it to a raw dataset as a row that says what happened and where in the source's history it happened. A pipeline merges it into a current-state dataset, and optionally a history dataset, using that position to decide whether it is newer than what is already there. The sync service reads the backing dataset's change data feed and writes an object version. The object store then publishes that version on the object change feed, where your own code, webhooks and automations pick it up
Key terms
| Term | Meaning |
|---|---|
| Log-based capture | Reading inserts, updates and deletes from the log the source already keeps for its own recovery or replication, in commit order |
| Snapshot comparison | Reading the whole source table on a schedule and comparing it with the previous read, key by key, to work out what changed |
| Watermark query | Reading only rows whose modified-time column has passed the last high-water mark. Sees inserts and updates, not hard deletes |
| Source position | Where a change sits in the source's history: a log sequence number, a binlog offset, a stream offset, a cursor or a connector run number. Stored in _ms_source_position |
| Sequencing column | The column, or list of columns, a merge uses to decide which of two rows for one key is newer. Declared with @sequence |
| Tombstone | An object version that records a delete. It keeps the key, the version number and the sequence of the delete |
| Current-state dataset | One row per key, holding the newest state. What object types are backed by |
| History dataset | One row per state each key has been in, with the source time it started and ended |
| Lateness window | How far back a correction may reach before it is quarantined instead of applied |
| Change cursor | An opaque position in an object type's change feed, returned with every page |
Two ways to see a change
In the platform service, connectors read a source by cursor, by full snapshot or from a watched folder, as described on connectors, and pipelines merge the rows by key. A snapshot sees every row each time it runs, but only the states that exist when it looks. On request, log-based capture reads each change from the source's own log in commit order, so it sees every intermediate state and every delete
Sequencing and ordering
The order rows reach the platform says nothing about the order they happened in: webhooks are retried, a connector restart re-reads a range, and clocks on tills and servers disagree. In the platform service, an incremental stream with lookback reads again from a window before its cursor, so a row that lands late with an older cursor value is still picked up, and an unchanged row is not written again. Edge agents that lost their uplink send their buffer in order before any new data. On request, a merge orders the rows for each key by the source's own sequence, so late or out-of-order rows never overwrite newer ones
Deletes and tombstones
A delete travels the same path as any other change
- Captured. A full snapshot sees a delete as a key that is gone. A cursor on a modified-time column cannot see a hard delete, so such sources rely on a soft-delete column or a periodic snapshot. On request, log-based capture delivers the delete itself
- Merged. The pipeline's merge by key removes the row from the current-state dataset, and the table's change data feed records the delete
- Synced. The sync service sees the delete in the backing dataset's change data feed. In the platform service today it removes the object's row, and the change feed shows the delete. On request it writes a tombstone instead, a new object version that marks the delete. Queries stop returning the object, and links to it resolve as missing
- Kept. On request, tombstones stay for the type's version retention, so the change feed and time travel can still show the delete
Many sources never delete. They void, cancel or close. On request, such a column is mapped to a delete, and a regular key reconciliation catches hard deletes that a cursor cannot see
Deletes made in the Ontology run the other way. In the platform service today, an action's delete removes the object and leaves a _deleted marker, so a sync that still finds the source row skips it until the source deletes the row too, through writeback or a later build. An action's create of a key the source doesn't hold leaves a _created marker, so a full sync keeps the object until the source reports it. See object storage
A delete from the source wins over edits made by actions, because the thing no longer exists in the system of record. On request, the type's owners get a review task listing any edit that could not be written back
Current state and full history
A merge produces a current-state dataset: one row per key, the newest state. That is what object types are backed by, and it is what most screens need. On request, the same step also writes a history dataset, one row per state each key has been in, with when it was true in the source and when the platform learned it. Object versions record when the Ontology changed; a history dataset answers "what did the plan say at 23:00 on Friday, and when did we learn it", which matters for recalls and traceability
Exactly once, end to end
Each stage is built on at-least-once delivery, because processes crash and networks drop. The exactly-once effect comes from every stage being idempotent: connectors resume from their committed cursor, a merge by key gives the same output from the same inputs, and a row that changes nothing writes nothing
The boundary is your code. Inside the platform, a change is applied once. Delivery to your code is at least once: a consumer that crashes after processing a page but before saving its cursor will read that page again. Store the version of each object you copy and ignore entries at or below it
Reading the object change feed
Every object type has a change feed: one entry per object version, in commit order, whether the version came from a source change, an action or a delete. It is the right way to keep another system in step with the Ontology, because it returns only what changed and never skips a version
In the platform service, since is a table version: -1 on a first call, then the cursor from the previous response. Each entry is one change to one object
GET /api/v2/types/batch/changes?since=4430
Authorization: Bearer eyJhbGciOi…
{
"objectType": "batch",
"since": 4430,
"cursor": 4431,
"data": [
{ "op": "modified", "key": "B-0844", "version": 6,
"tableVersion": 4431, "at": "2026-10-24T08:10:14.402Z",
"object": { "_key": "B-0844", "line": "Line 1", "litres": 1300, "…": "…" } },
{ "op": "deleted", "key": "B-0845", "version": 4,
"tableVersion": 4431, "at": "2026-10-24T08:10:14.402Z",
"object": null }
]
}
Every response carries a cursor, even an empty one, and the next call should pass it as since. On request, the feed filters by property and operation, returns each change's values before and after with where it came from, and holds a request open until there is something new
Permissions in the feed
The feed applies the caller's row access, field access and access labels like any other read. Versions of objects outside the caller's rows are skipped, under every row policy of the type and judged on the deleted row for a delete, and properties the caller cannot see are left out of object. The cursor still moves past them. On request, properties the caller cannot see are also left out of changed, a version that only changed hidden properties is skipped entirely, and when an object leaves the caller's view, because an access label was added or a policy changed, the feed emits one entry with "op": "hidden"; treat it like a delete in your copy. If it comes back into view, the next entry is a create with its full values
From the SDK
In the platform today the cursor is the object table's version, an integer. On request, a timestamp cursor, a property selection and a long-polling wait
// -1: from the start of the table's history
let cursor = (await loadCursor("batch")) ?? -1;
while (true) {
const batch = await mso.changes("batch", cursor);
for (const change of batch.data) {
// { op, key, version, at, object }; skips versions it already has
await upsertIntoPlanningSheet(change);
}
cursor = batch.cursor; // the table version it read up to
await saveCursor("batch", cursor); // only after the batch is applied
if (!batch.data.length) await new Promise((r) => setTimeout(r, 30_000));
}
import os
import time
from mso_client import Client
mso = Client("https://ontology.example.com", token=os.environ["MSO_TOKEN"])
cursor = load_cursor("batch")
if cursor is None:
cursor = -1
while True:
batch = mso.changes("batch").since(cursor)
for change in batch.data:
upsert_into_planning_sheet(change) # idempotent on (key, version)
cursor = batch.cursor
save_cursor("batch", cursor)
time.sleep(30)
Both examples run against the platform service today with the built TypeScript and Python clients
Cursors that expire
On request, a cursor older than the type's version history returns CHANGE_CURSOR_EXPIRED, and the consumer rebuilds its copy from a consistent read and resumes from there
Push updates
The platform service pushes changes as server-sent events. A hub reads the object change feeds, the action log, edge batches, notifications and alert tables, and each connection gets only what its caller may see: access labels, row policies and hidden properties apply, and an object that leaves a person's rows arrives as deleted. Every event has an id, so a client that reconnects with Last-Event-ID resumes after it; when the service restarted or the gap is older than the buffer, it gets reset and reloads. A rebuild that changes many rows of one type arrives as a single reload
- Tickets. A browser cannot set headers on an event stream, so the app first takes a one-use ticket from
POST /api/v2/stream/ticketsand puts it in the URL; the access token never does - Long polling.
GET /api/v2/stream/eventsserves the same events by long polling where a proxy buffers the stream - In the app. Each page keeps one connection and the live workspaces update objects in place, so an action applied in one tab shows in another
- Several copies. When the service runs as several copies, they share one ordered log, so a client resumes on any copy
- History.
GET /api/v2/stream/history?from=&to=&kinds=lists what happened in a period, newest first: applied actions, proposals, audit entries and alerts, filtered the same way - Settings. Under
stream:inontology.yaml
A connection can also follow a filtered set of objects: the ticket's body names an object type or interface and a filter in the query grammar, optionally only some properties. Each change is matched against the filter before and after it, so the subscriber gets entered, changed and left with the same access rules, and with snapshot the objects matching now come first. Resuming with Last-Event-ID works as for topics
{
"topics": ["actions"],
"subscriptions": [
{ "id": "held", "objectType": "batch",
"where": { "qaStatus": "On hold" },
"properties": ["qaStatus", "holdReason"], "snapshot": true }
]
}
Push delivery to other systems uses the object.changed and object.deleted webhook events, which carry the changed values and the object's version. Webhooks are convenient; the feed is replayable. Many consumers use both, the webhook to wake up and the feed to read
Worked example: a late production plan
On a stormy Friday night the illustrative creamery's plant link drops while the planner moves batch B-0844 to Line 1 and deletes the plan line for B-0845. The edge agent buffers both changes and sends them in order when the link returns at dawn, so the Ontology shows the new plan within seconds and the weekend cover automation runs again on it. On request, log-based capture and sequencing on the point of sale's own revision number keep both sources right, so a late or reordered update never overwrites a newer one
Where guarantees stop
- Exactly once ends at the object store. Delivery from the change feed or webhooks to your code is at least once, and your consumer must be idempotent on
_keyand_version - There is no order across sources or across object types. A batch from the ERP and a shop from the point of sale can reflect moments minutes or, after an outage, hours apart. Each object's freshness is shown beside it
- A transaction in the source that touches several tables arrives as separate dataset versions, one per table, and its objects can become visible a few seconds apart
- Snapshot comparison sees only the states present when it runs. Intermediate states are lost and cannot be recovered later
- Watermark queries miss hard deletes until reconciliation runs, and miss updates that do not move the modified-time column, such as changes made by a database script that skips the trigger. Move such tables to log-based capture if the source allows it
- Sequences must increase per key. A source that resets its counter, for example after a point-of-sale reinstall, makes new rows look older than stored ones until the dataset is rebaselined from a snapshot
- An edge agent whose buffer fills after its 72 hours stops reading its lowest-priority sources. A gap closed by a later snapshot has the end states but not the steps between
- Change cursors last as long as version history. A consumer that is away longer must rebuild from a snapshot
- Purging an object to erase personal information removes it from the object store, the change feed and history datasets. History is complete, not immutable