Right now, new_chain_id() uses a simple counter that starts at 1 whenever the app launches. Because it resets every session and isn't saved when resuming a match, you end up with repeating IDs like chain-1#0 across different runs.
When feedback.training_pairs tries to clean up duplicates by taking the latest edit per (match, segment_id), a new correction from a completely different session can silently overwrite an older one on the same match. This means we accidentally throw away valid training pairs.
Suggested fix:
Give PlayChain a unique ID (like a short uuid4().hex[:8], or save the counter in the session file). Keep segment_id formatted as {chain_id}#{index}.
Definition of Done:
Two corrections logged in separate app runs for the same match both appear in training_pairs. test_feedback.py passes.
Right now, new_chain_id() uses a simple counter that starts at 1 whenever the app launches. Because it resets every session and isn't saved when resuming a match, you end up with repeating IDs like chain-1#0 across different runs.
When feedback.training_pairs tries to clean up duplicates by taking the latest edit per (match, segment_id), a new correction from a completely different session can silently overwrite an older one on the same match. This means we accidentally throw away valid training pairs.
Suggested fix:
Give PlayChain a unique ID (like a short uuid4().hex[:8], or save the counter in the session file). Keep segment_id formatted as {chain_id}#{index}.
Definition of Done:
Two corrections logged in separate app runs for the same match both appear in training_pairs. test_feedback.py passes.