The smallest social data pipeline that is still reliable
Four stages: acquire with an idempotency key, validate against a schema, store with provenance, and expose a view that carries coverage.
Most pipelines start as a script and grow into an incident. Four explicit stages keep the failure surface small enough to observe.
The four stages
Acquire with an idempotency key so a retry cannot duplicate work. Validate against a versioned schema and reject rather than coerce. Store the raw response with its observation time and coverage state. Serve from a view that always carries those fields, so no consumer can read a value without its provenance.
Failure modes worth designing for
- Timeout ambiguity: the run started but the client did not hear back.
- Partial results that look complete.
- Schema drift that silently drops a field.
The artefact each stage must leave behind
A pipeline is only debuggable if every stage leaves evidence. Decide these artefacts before the first deployment; adding them after an incident costs far more.
| Stage | Artefact to keep | Failure it makes visible |
|---|---|---|
| Acquire | Idempotency key, run id, request time | Duplicate or lost work after a retry |
| Validate | Schema version and rejected-payload reason | Silent schema drift |
| Store | Raw payload, observation time, coverage state | A partial result read as complete |
| Serve | Provenance and freshness per field | A cached answer mistaken for a fresh one |
- Idempotency belongs at the acquisition boundary.
- Store provenance with the payload, not in a separate note.
- Reject schema drift loudly instead of coercing silently.
Related pages
Related reading
- Normalising social data without losing what was observedA normalised model should add consistency, not confidence. Keep the raw payload, map to a versioned contract, and never invent a missing value.
- Why an API-first data layer beats a dashboard-first oneA dashboard serves one interface. A contract serves the product, the analyst and the agent from the same source of truth.
- Async requests and signed webhooks, without duplicate workAccept, then follow the run: idempotency keys stop duplicate collection, and stable event IDs make retries safe.