($r['target']??'')==='yellow'))===8,'Huit cartons jaunes reconnus, staff inclus'); $apply=function($rows)use($actor){DB::query('INSERT INTO import_batches(actor_id,kind,filename,fingerprint,payload,base_revision) VALUES(?,?,?,?,?,?)',[$actor,'discipline','yellow.xlsx',hash('sha256',json_encode($rows)),json_encode($rows),DB::revision()]);Csv::apply((int)DB::conn()->lastInsertId(),$actor);}; $apply($rows);$before=DB::value("SELECT COUNT(*) FROM disciplinary_events WHERE source='footclubs_import'"); $again=Csv::previewRows('discipline',0,$raw);ok(count(array_filter($again,fn($r)=>($r['target']??'')==='yellow'&&$r['action']==='unchanged'))===8,'Réimport des huit jaunes identique');$apply($again); ok(DB::value("SELECT COUNT(*) FROM disciplinary_events WHERE source='footclubs_import'")===$before,'Aucun doublon'); ok((int)DB::value("SELECT COUNT(*) FROM sanctions WHERE external_ref IN ('23990107','24010813','24006253','24010810','24010500','24010811','24022315','24022317')")===0,'Aucun jaune transformé en suspension'); ok(DB::value("SELECT warning_end_date FROM disciplinary_events WHERE source_ref='footclubs:23990107'")==='2026-11-29','Fin officielle du jaune ADAM conservée'); ok(DB::value("SELECT warning_effective_date FROM disciplinary_events WHERE source_ref='footclubs:24010813'")==='2026-09-06','Effet officiel du jaune BARBIER conservé'); DB::query("UPDATE disciplinary_events SET review_status='cancelled',review_reason='Correction justifiée pour test' WHERE source_ref='footclubs:23990107'"); $cancelled=Csv::previewRows('discipline',0,$raw);ok(count(array_filter($cancelled,fn($r)=>str_contains($r['error']??'','annulé manuellement')))===1,'Un réimport ne réactive pas un jaune annulé');