From 3318c9418a6044b2d58b1ed48c51606c5a598110 Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 19 Jun 2026 23:28:17 -0600 Subject: [PATCH] fix(backend): set Remittance.claim_id symmetrically in reconcile.run T12's list_unmatched filters Remittance by claim_id IS NULL. T10's reconcile.run was only setting Claim.matched_remittance_id, leaving auto-matched remits visible in the orphan bucket. Mirror the FK on both sides so both list_unmatched filters produce consistent results. T12 implementer flagged this as out-of-scope; addressed here as a small follow-up so the Reconciliation page works correctly end-to-end. --- backend/src/cyclone/reconcile.py | 4 ++++ 1 file changed, 4 insertions(+) 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,