Prerequisites
Before you begin, prepare:- disposable credentials with the exact read and write scopes used by the workflow;
- a persisted request or event identifier before the first network attempt;
- synthetic task, webhook, or event data plus a cleanup plan;
- storage for durable run, cursor, delivery, or receipt readback;
- an acceptance assertion that proves SSE and signed webhooks deduplicate, resume, and reconcile to one terminal state.
1. Persist the SSE cursor
Save the last processed event ID after your application commits the event. On reconnection, sendLast-Event-ID and require increasing event
sequences. A heartbeat is liveness, not a state transition.
2. Build a durable webhook inbox
Verify the signature over the exact raw body before parsing JSON. Within one transaction or durable operation:- insert the immutable event ID with a unique constraint;
- store the validated payload and delivery metadata;
- enqueue or apply the application transition;
- return 2xx only after durable acceptance.
3. Reconcile the two views
SSE and webhook arrival order can differ. Use the Praxa run ID and event sequence as authority, not HTTP arrival time. When either lane observes a terminal state, read the run if your product needs an authoritative final projection.4. Test failure paths
SSE event reference
Read framing, resumption, heartbeats, and terminal-event behavior.
Webhook tutorial
Implement signing, deduplication, replay, and cleanup.
Troubleshooting
Best practices
- Persist identity before I/O and state transitions after durable processing.
- Treat admission, delivery attempt, and cancellation request as non-terminal acknowledgements.
- Verify signatures against the raw body before parsing webhook JSON.
- Deduplicate streams and webhooks using stable event or delivery identity.
- Test disconnect, duplicate, out-of-order, timeout, revocation, and cleanup paths.
Optimize for production
- Prefer event-driven updates while retaining bounded polling or readback reconciliation.
- Commit cursors in batches only when that cannot lose acknowledged application work.
- Keep webhook handlers short: verify, persist, acknowledge, then process asynchronously.
- Measure admission-to-terminal time, reconnect rate, duplicate rate, delivery latency, and reconciliation backlog.
Cleanup and next steps
- Cancel or terminally reconcile disposable runs.
- Disable test webhook endpoints and remove their signing secrets.
- Delete synthetic inbox, cursor, and delivery records after assertions.
- Revoke disposable credentials and keep only redacted lifecycle evidence.