Reconstruct any moment
Pass a past instant and membership rebuilds the live set as it stood then, from the same rows, with no snapshot table.
The situation
A shipment was late last Tuesday. The question is what the packing floor looked like at 14:00 that day: how many orders were waiting at each station.
The recipe
const then = await lt.escalations.aggregateByFacets({ query: { roles: ['picking', 'packing', 'shipping'] }, groupBy: { columns: ['role'] }, measure: { kind: 'membership', asOf: '2026-10-14T14:00:00Z' }, distinctBy: 'orderId',});ltc esc aggregate-facets --roles '["picking","packing","shipping"]' \ --group-columns role --as-of 2026-10-14T14:00:00Z --distinct-by orderIdA row was live at an instant when created_at is at or before it and ended_at is after it or still null. Omit asOf for now.
The guarantee
The intervals are row truth: resolve stamps resolved_at and cancel or expire stamp the transition inside their guarded updates, and no write path touches a terminal row afterward. Past answers do not change, so past-anchored results are cached. A future asOf is a 400. Grouping by status uses the row’s status now, since status history is not stored. See Analytics.
Related patterns
Analytics
Dwell and membership
One call answers how long entities spent in each state over a window, or how many are in each state right now.
Analytics
Gaps are a signal
One entity's timeline lists every interval across every queue and keeps the gaps between them, so hand-off delay is visible, not averaged away.
Analytics
Park every state
Each state an item passes through is one escalation row. The queue becomes a complete time series of the process with no extra instrumentation.
