diff --git a/backend/src/cyclone/reconcile.py b/backend/src/cyclone/reconcile.py index e65c8bf..d500891 100644 --- a/backend/src/cyclone/reconcile.py +++ b/backend/src/cyclone/reconcile.py @@ -287,6 +287,10 @@ def run(session, batch_id: str) -> ReconcileResult: else: m.claim.state = ClaimState.REVERSED m.claim.matched_remittance_id = m.remittance.id + # Symmetric FK: also set Remittance.claim_id so list_unmatched (which + # filters on Remittance.claim_id IS NULL) correctly drops auto-matched + # remits from the orphan bucket. Manual matches do this too. + m.remittance.claim_id = m.claim.id session.add(ActivityEvent( ts=datetime.now(timezone.utc), kind=intent.activity_kind,