M3: implement Data Quality Workbench

Five rule scanners (duplicate customers, missing fields, odometer regression, booking overlap, status conflict) run automatically after seed and via an explicit scan endpoint. Issue defer/reject/merge-customers endpoints with transactional customer merge (booking rewiring, tombstone, audit). Data Quality nav + workbench UI with two-column duplicate comparison and inline (non-native) confirm. Dashboard attention items now link to issues. 35 backend tests passing, ruff clean. Fixed a real false-positive bug in odometer-regression detection found through iteration on seed data, and two TS narrowing errors. Verified end-to-end via browser: S2 merge and S4 overlap scenarios.
This commit is contained in:
NuklearRabbit
2026-08-01 22:11:06 +02:00
parent 0091c57c7f
commit a7cbeaae3b
17 changed files with 1127 additions and 5 deletions
+23
View File
@@ -92,6 +92,7 @@ export interface AttentionItem {
detail: string;
link_type: "vehicle" | "booking" | "customer";
link_ref: string;
issue_ref: string | null;
}
export interface TodayItem {
@@ -144,6 +145,28 @@ export interface RegisterReturnResult {
next_booking_risk: NextBookingRisk | null;
}
export interface EntitySnapshot {
public_ref: string;
[key: string]: unknown;
}
export interface DataQualityIssueDetail extends DataQualityIssue {
entity_snapshot: EntitySnapshot | null;
related_snapshots: EntitySnapshot[];
}
export interface MergeCustomersRequest {
survivor_ref: string;
field_overrides?: Record<string, string>;
}
export interface MergeCustomersResult {
issue_ref: string;
survivor_ref: string;
loser_ref: string;
rewired_bookings: number;
}
export interface AuditEvent {
id: string;
actor_type: string;