A migration mapping lists source value, target value, preconditions, null handling, owner, and test case. Unknown source states should enter a reason-coded quarantine rather than a plausible default. Ask the model to identify collisions where distinct source meanings map to one target value, then have the data owner approve any intentional loss. Deterministic code applies the versioned mapping and emits a per-row outcome. Keep the original value and row key so a corrected mapping can replay only affected records.
Make this comfortable
Backfill prompts: map known states and quarantine unknowns
Operational case
Of 47,000 Harbor orders, 46,940 map under the approved rules. Forty-seven have unfamiliar legacy statuses, and 13 lack required tenant IDs; the groups are disjoint, so 60 rows are quarantined. The assistant does not call the unknown status 'pending' just to make every row load. It creates an exception ledger with reason, pseudonymous key, observed value, and owner.
47,000 = mapped 46,940 + quarantined 60
UNKNOWN_STATUS: 47 | TENANT_ID_MISSING: 13
Fallback to pending: prohibited without approval
Preserve source value and row keyPerformance and review cost
Applying an indexed mapping to N rows is O(N) expected time and O(K+E) memory for K mapping keys and E exceptions. Quarantine costs review time but avoids semantic loss. A model can cluster unknown values; only an owner can authorize new meaning.
Common Mistakes
- Do not silently default unknown statuses.
- Do not double-count overlapping exception IDs.
- Do not erase the original value after quarantine.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Prompt inputs: normalize records before asking for conclusions
- Schema migration prompts: check old and new clients together
- Backfill prompts: pin source, target, and snapshot
- Backfill prompts: bound batches and make retries idempotent
- Backfill prompts: account for writes during migration
- Backfill prompts: compare count and field-level parity
- Backfill prompts: hold cutover until fallback is rehearsed
- Project: review Harbor's order-status backfill
- Database backfill prompt decisions
prompt engineering
database migration
