Quarantine
How enrichment values that fail field validation are held for human review instead of silently written — with per-field validators, suggested corrections, and approve/reject/auto-correct actions.
Bad data never lands silently
When a provider returns a value, Pact validates it before writing it as a fact. A value that fails validation is not discarded and not written — it's quarantined for review. This is why the platform fee is worth paying: you get a bad email flagged, not a poisoned record.
Quarantined values are stored in the enrichment_quarantine table (alembic
0050), each row capturing the raw value, the provider that produced it, the
validator that rejected it, the failure reason, and — when possible — a suggested
correction.
What gets validated
core.enrichment.validators.validate_field dispatches to a per-field validator;
quarantine_record produces the quarantine entry on failure. Shipping validators
cover:
- Contact fields — email (RFC-shaped), phone (digit normalization), name, title
- Company fields — website/URL, industry, country, employee count, annual revenue
- Social handles and referential integrity checks
Each row records a confidence score and, where the validator can infer one, a
suggested_value for one-click correction.
Reviewing quarantine
GET /v1/enrichment/quarantine lists rows, defaulting to status=pending,
filterable by field_name, up to limit 500.
POST /v1/enrichment/quarantine/{id} takes one of three actions:
| Action | Effect |
|---|---|
approve | Write the raw value as a fact anyway (you trust it) |
reject | Discard it — nothing is written |
auto_correct | Write a corrected_value (or the stored suggestion) instead |
On approve or auto_correct, the value is written via
facts_mod.record_fact tagged quarantine_review:<provider>, and the row is
stamped with reviewer_user_id, reviewed_at, and your optional review_note.
Acting on a row that's already been reviewed returns 409 Conflict.
curl -X POST https://api.pact.place/v1/enrichment/quarantine/4821 \
-H "Authorization: Bearer $PACT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action": "auto_correct", "corrected_value": "[email protected]",
"review_note": "typo in domain"}'
Quarantine shows up on the record too
A record's provenance response
(GET /v1/enrichment/contacts/{id}/provenance) includes its pending quarantine
inline, so reviewers can resolve suspect values right where they see the fact
history.