Skip to content

syncCircuitsShapes

syncCircuitsShapes(options): Promise<CircuitsSyncHandle>

Defined in: packages/client/src/circuits/sync-engine.ts:178

Sync K Circuits shape streams into one consistency group (ADR-0055 + ADR-0056).

The commit gate is the whole of ADR-0056’s steady state: commit when every shape’s most recent response asserted up-to-date. That is a happens-before, not a position comparison. Offsets are per-stream and the protocol only sanctions comparing them within a stream, so no min over positions exists to take, and none is taken.

The happens-before is airtight at ALIGNMENT — every stream has drained what the server held, and everything held commits together — and weaker in the live steady state, where every stream’s report is latched true between parked long polls and each delivery commits on arrival. Two streams carrying halves of one server transaction are answered separately, so the window in which one half is applied and the other is not is their response inter-arrival, normally milliseconds. Closing it needs a fence the engine does not emit — see docs/backlog/0014-cross-stream-commit-fence.md.

The barrier is consulted once per alignment generation, at boot and after any must-refetch. Its job there is narrow and specific: every stream can report drained while the engine still holds a computed revocation, and a boot that claimed consistency in that window would present a store missing an eviction. Mid-session the same condition is just a change arriving late.

CircuitsSyncOptions

Promise<CircuitsSyncHandle>