Expire presence independently of disconnect delivery
A server restart loses disconnect events and rooms retain ghosts. Make lease expiry authoritative across process recovery.
- Focused work estimate
- 4h + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Recovery · Concurrency
Estimated field mix
- Distributed systems50%
- Real-time systems30%
- Site reliability20%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
Fictional document team Pine shows collaboration presence for synthetic accounts. Build a loopback WebSocket server and injected clocks; no message content or activity surveillance is required.
Setup prerequisites
- Create synthetic memberships and session identifiers.
- Implement controllable sockets and an in-memory TTL adapter.
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
- CPRES-101 · Define online presence as an unexpired connection lease
- CPRES-102 · Validate presence room identifiers before subscribing
- CPRES-103 · Scope presence membership checks to each room subscription
- CPRES-104 · Count multiple presence connections without duplicating people
- CPRES-105 · Reject stale presence heartbeats after reconnect
- CPRES-106 · Send a presence snapshot before incremental updates
Acceptance criteria
- Restart cannot preserve expired entries
- Cleanup repeats safely
- Concurrent renewal cannot delete fresh lease
Implementation constraints
- Compare stored lease identity before removal.
Verification to include
- Restart with expired leases
- Renew during cleanup
Deliverables
- Expiry reconciliation and interleaving cases
Rollout and recovery
Disable cleanup writes if lease identity cannot be checked.
Value of the work
For the engineer: Practice ephemeral state, ordering and reconnect semantics.
For the team: Inspect whether online indicators avoid stale or unauthorized claims.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.