Design notes / contract v1
Correlate once. Observe everywhere.
PulseFlow's fictional architecture separates durable event acceptance from analytical reads and outbound notifications. This keeps instrumentation predictable when a dashboard or destination is temporarily unavailable.
Data plane and control plane
Application / SDK / CLI
|
v
Regional ingest gateway -- auth, schema, quotas
|
v
Durable event log -----> normalization + redaction
| |
v v
Webhook delivery queue Trace / metric indexes
| |
v v
Customer receiver Query API + dashboard
Control plane: workspaces, scoped tokens, rules, retentionIn this design, data stays in the selected workspace region. us-east-1 and eu-west-1 are illustrative region labels, not claims about deployed infrastructure. Control-plane changes propagate asynchronously; a newly revoked token may have a short cache invalidation window, which a real implementation would need to measure and document.
Identity and correlation
An event ID identifies a logical observation; a run ID groups a business workflow; a trace ID groups spans. These are different concepts. Retries keep the event ID, while a genuinely new workflow run receives a new run ID. The workspace is derived from validated credentials, then checked against the envelope; a client-supplied workspace field is never sufficient authorization.
| Boundary | Demo contract | Consumer responsibility |
|---|---|---|
| Ingestion | 202 after durable acceptance | Keep acceptance IDs for diagnostics |
| Indexing | Eventually consistent, target under 10 seconds | Allow a visibility window before polling again |
| Webhooks | At least once; no global ordering guarantee | Deduplicate by workspace and event ID |
| Idempotency | Identical request key/body cached for 24 hours | Do not reuse keys for unrelated operations |
Backpressure and recovery
Each workspace has an independent token bucket. A burst that exceeds capacity returns 429 with Retry-After; sustained downstream failures accumulate in a bounded delivery queue. After the retry window expires, an event enters a dead-letter state and requires an explicit operator replay. A replay preserves the original event ID and records a new attempt ID for auditability.
Assume a worker can crash after committing its work but before acknowledging the message. A redelivery must not charge a customer twice or run a destructive action again. Use a durable deduplication record in the same transaction as the side effect; an in-memory set is only suitable for the browser demo.
Security and privacy boundaries
- Use TLS for transport and authenticated, scoped service identities at ingestion.
- Strip secrets before enqueueing; downstream redaction is defense in depth, not permission to transmit sensitive data.
- Apply per-workspace authorization to queries, exports and replay operations.
- Sign webhooks over the timestamp and exact raw request bytes; check freshness before processing.
- Expire indexed and raw event data according to the same documented retention policy.
Operational trade-offs
Longer retention makes historical debugging easier but increases storage and privacy exposure. Aggressive batching reduces overhead but adds flush latency. Sampling keeps costs bounded but can hide rare failures; preserve errors and document which traffic was sampled. The synthetic incident history illustrates how queue age and consumer lag expose failures that request-count dashboards miss.
Next: emit a first event or review the webhook verification contract.