CC Worker 1671518ca8 FX-1: auto-map re-run must not PK-collide with confirmed ghosts
_refresh_ai_rows deleted only unconfirmed AI rows, then bulk-inserted freshly
generated rows keyed by a deterministic uuid5 of (template_id, semantic key).
A confirmed ghost keeps that id, so a re-run re-emitted it → primary-key
conflict that failed the whole insert batch (reachable: auto-map is blocked only
when marks exist, not when ghosts are confirmed).

Fix: after the delete, read the ids that survived (confirmed-AI + manual) and
skip re-inserting any freshly generated row whose id matches — preserving the
teacher's curated row and making the insert PK-safe.

Adds test_auto_map_rerun_after_confirm_does_not_pk_collide, which confirms a
ghost at its REAL generated id (the prior test used an arbitrary id that never
collided) and asserts the row survives exactly once with confirmed=True.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 21:02:10 +00:00
..
2025-11-14 14:47:19 +00:00
2025-08-23 19:01:36 +01:00
2025-08-23 19:01:36 +01:00
2025-11-19 19:38:09 +00:00
2025-11-14 14:47:19 +00:00
2026-05-28 14:14:35 +01:00
2025-08-23 19:01:36 +01:00
2025-08-23 19:01:36 +01:00
2025-08-23 19:01:36 +01:00
2025-07-11 13:52:19 +00:00
2025-11-14 14:47:19 +00:00
2025-07-11 13:52:19 +00:00
2025-11-14 14:47:19 +00:00
2025-11-14 14:47:19 +00:00
2025-11-14 14:47:19 +00:00
2026-05-28 17:55:37 +01:00