Clean production data to spec
Remove disallowed records, sharpen the classification logic, and verify the remaining dataset against an explicit definition.
Use this when
Use this when a production dataset contains records that no longer match a product, policy, taxonomy, or quality definition and the classifier allowed them through.
How it runs
- Write the allowed definition as explicit inclusion, exclusion, and edge-case rules before changing data.
- Audit production records, preserve a recoverable record of proposed removals, and separate clear violations from uncertain cases.
- Remove confirmed invalid records through the approved production path and improve the classifier with regression examples.
- Rerun classification tests and audit the remaining production data until every sampled and queried record meets the definition.
Done when
✓ Every remaining record meets the allowed definition. Representative classification tests and a post-cleanup audit prove the retained data is valid.
Why it works
Fixing both the existing records and the classifier closes the immediate data problem and reduces recurrence. Explicit rules and regression examples make future cleanup decisions reviewable.
Implementation note
Follow access, retention, privacy, and audit requirements. Use backups or reversible operations where appropriate, and do not delete uncertain records without review.
More database loops
Apply database migrations cleanly
Run migrations, fix schema or SQL errors, and repeat until prisma migrate status reports clean, capped at 6 turns.
N+1 query hunt
Instrument the test suite with query logging, find endpoints issuing N+1 queries, and fix them with eager loading or batching until the hot paths are clean.