Skip to content

Commit bf2f857

Browse files
authored
feat(pds): emit sync 1.1 firehose events (#171)
Brings the firehose payload up to the current spec so the bsky.network relay's strict-validation warnings (notably "missing prevData field") stop firing against Cirrus hosts, and so account/sync state actually propagates without polling. - #commit gets prevData + ops[].prev, tooBig pinned to false, and the CAR slice now carries the MST covering proof (newBlocks + relevantBlocks) needed for inductive verification. - Writes go through repo.formatCommit + repo.applyCommit instead of applyWrites so the CommitData is available; drops the SQL-by-rev block reconstruction. - New #sync and #account events; activate/deactivate now emit them (plus #identity on activate). - #identity.handle is optional; rpcEmitIdentityEvent routes through the sequencer instead of writing empty payloads. - #info OutdatedCursor sent when a cursor predates the retention window; the stream continues from the earliest available event. - applyWrites caps at 200 ops per spec.
1 parent 9dce7fe commit bf2f857

4 files changed

Lines changed: 833 additions & 183 deletions

File tree

.changeset/sync-1-1-compliance.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@getcirrus/pds": minor
3+
---
4+
5+
The firehose now emits the sync 1.1 message shape, matching what the bsky.network relay and other AT Protocol consumers expect. Existing subscribers will start seeing new fields and new event types; nothing has to change on the consumer side, but the warnings some relays were logging against Cirrus hosts (notably `missing prevData field`) will stop.
6+
7+
What changed on the wire:
8+
9+
- `#commit` messages now include `prevData` (the prior commit's MST root CID), so relays can verify each commit inductively without re-fetching the repo. The CAR slice now also carries the MST covering-proof blocks needed for that verification.
10+
- Each `ops[]` entry on update and delete now includes `prev`, the previous CID of the touched record. Creates omit it as before.
11+
- `tooBig` is always `false`. It was previously set based on payload size, which never matched the field's meaning under sync 1.1.
12+
- New `#account` events are emitted on activation and deactivation, so relays learn about account status changes without polling. Deactivation reports `status: "deactivated"`; activation reports `active: true` with no status.
13+
- New `#sync` events are emitted on activation (after migration or initial setup), giving relays the current commit block without a diff.
14+
- `#identity` events now allow the `handle` field to be omitted, per spec.
15+
- A `#info` frame with `name: "OutdatedCursor"` is sent when a client connects with a cursor older than the retained event window. The stream continues from the oldest available event instead of disconnecting.
16+
- `applyWrites` rejects calls with more than 200 operations, matching the spec cap.

0 commit comments

Comments
 (0)