From 75a2800a9d0d4a45ea255f2ef36db30322ed0961 Mon Sep 17 00:00:00 2001 From: Nora Date: Thu, 2 Jul 2026 14:59:49 -0600 Subject: [PATCH] refactor(sp31): rename Match strategy 'auto' to 'pcn-exact' for audit clarity --- backend/src/cyclone/reconcile.py | 2 +- backend/tests/test_db_models.py | 6 +++--- backend/tests/test_reconcile.py | 6 +++--- src/types/index.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/cyclone/reconcile.py b/backend/src/cyclone/reconcile.py index bc9f52c..5a629bb 100644 --- a/backend/src/cyclone/reconcile.py +++ b/backend/src/cyclone/reconcile.py @@ -84,7 +84,7 @@ def match( matches.append(Match( claim=chosen, remittance=r, - strategy="auto", + strategy="pcn-exact", is_reversal=r.is_reversal, )) used_claim_ids.add(chosen.id) diff --git a/backend/tests/test_db_models.py b/backend/tests/test_db_models.py index be3a4dc..437d587 100644 --- a/backend/tests/test_db_models.py +++ b/backend/tests/test_db_models.py @@ -320,7 +320,7 @@ def test_create_match_and_activity_event(): )) m = Match( claim_id="CLM-1", remittance_id="CLP-1", - strategy="auto", is_reversal=False, + strategy="pcn-exact", is_reversal=False, matched_at=datetime(2026, 6, 19, 13, 0, tzinfo=timezone.utc), ) s.add(m) @@ -335,7 +335,7 @@ def test_create_match_and_activity_event(): with db.SessionLocal()() as s: loaded = s.get(Match, 1) # autoincrement id assert loaded is not None - assert loaded.strategy == "auto" + assert loaded.strategy == "pcn-exact" assert loaded.is_reversal is False events = s.query(ActivityEvent).all() @@ -361,7 +361,7 @@ def test_match_multiple_rows_per_claim(): status_code="1", received_at=datetime.now(timezone.utc))) s.add(Remittance(id="CLP-2", batch_id="b1", payer_claim_control_number="y", status_code="1", received_at=datetime.now(timezone.utc))) - s.add(Match(claim_id="CLM-1", remittance_id="CLP-1", strategy="auto", + s.add(Match(claim_id="CLM-1", remittance_id="CLP-1", strategy="pcn-exact", matched_at=datetime.now(timezone.utc))) s.add(Match(claim_id="CLM-1", remittance_id="CLP-2", strategy="manual", matched_at=datetime.now(timezone.utc), diff --git a/backend/tests/test_reconcile.py b/backend/tests/test_reconcile.py index 02445a9..7963cd8 100644 --- a/backend/tests/test_reconcile.py +++ b/backend/tests/test_reconcile.py @@ -55,7 +55,7 @@ def test_match_same_pcn_within_window_matches(): assert len(matches) == 1 assert matches[0].claim.id == "CLM-1" assert matches[0].remittance.id == "CLP-1" - assert matches[0].strategy == "auto" + assert matches[0].strategy == "pcn-exact" def test_match_dates_outside_window_unmatched(): @@ -203,7 +203,7 @@ def test_apply_reversal_of_already_reversed_is_noop(): def test_split_unmatched_partitions_by_match_set(): claims = [FakeClaim("CLM-1", "A", None), FakeClaim("CLM-2", "B", None)] remits = [FakeRemit("CLP-1", "A", None), FakeRemit("CLP-2", "C", None)] - matches = [ReconcileMatch(claim=claims[0], remittance=remits[0], strategy="auto", is_reversal=False)] + matches = [ReconcileMatch(claim=claims[0], remittance=remits[0], strategy="pcn-exact", is_reversal=False)] unmatched_claims, unmatched_remits = reconcile.split_unmatched(claims, remits, matches) assert [c.id for c in unmatched_claims] == ["CLM-2"] assert [r.id for r in unmatched_remits] == ["CLP-2"] @@ -306,7 +306,7 @@ def test_run_reversal_flips_paid_to_reversed(fixture_835): # Match row already exists from prior reconcile. s.add(Match( claim_id="CLM-1", remittance_id="CLP-OLD:b1xxxxxx", - strategy="auto", matched_at=datetime.now(timezone.utc), + strategy="pcn-exact", matched_at=datetime.now(timezone.utc), is_reversal=False, )) s.flush() diff --git a/src/types/index.ts b/src/types/index.ts index 7afc37a..936e7fb 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -455,7 +455,7 @@ export interface Match { id: number; claim_id: string; remittance_id: string; - strategy: "auto" | "manual"; + strategy: "pcn-exact" | "score-auto" | "manual"; matched_at: string; prior_claim_state?: ClaimState | null; is_reversal: boolean; @@ -507,7 +507,7 @@ export interface UnmatchedResponse { export interface MatchResponse { claim: UnmatchedClaim; - match: { id: number; strategy: "auto" | "manual" }; + match: { id: number; strategy: "pcn-exact" | "score-auto" | "manual" }; } // ---------------------------------------------------------------------------