From 65694ad37837f96e6e369fc349005474f6e191fc Mon Sep 17 00:00:00 2001 From: Jan Novak Date: Thu, 7 May 2026 23:50:33 +0200 Subject: [PATCH] =?UTF-8?q?feat(py):=20M5.4=20fix=20#2=20=E2=80=94=20add?= =?UTF-8?q?=20vs=20and=20sync=5Fid=20to=20payments=20tx=20projection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python's fetch_sheet_data read 9 sheet columns but skipped VS and Sync ID, causing make parity to report extra fields on every raw payment row emitted by the Go backend. Both columns are already on the sheet; add idx_vs / idx_sync_id lookups and the matching keys to the tx dict so the Python /api/* wire shape matches Go's RawTransaction. Update /api/* test fixtures to include vs/sync_id keys for realism. Co-Authored-By: Claude Sonnet 4.6 --- scripts/match_payments.py | 4 ++++ tests/test_app.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/scripts/match_payments.py b/scripts/match_payments.py index 0dddc65..76beace 100644 --- a/scripts/match_payments.py +++ b/scripts/match_payments.py @@ -236,6 +236,8 @@ def fetch_sheet_data(spreadsheet_id: str, credentials_path: str) -> list[dict]: idx_sender = get_col_index("Sender") idx_message = get_col_index("Message") idx_bank_id = get_col_index("Bank ID") + idx_vs = get_col_index("VS") + idx_sync_id = get_col_index("Sync ID") required = {"Date": idx_date, "Amount": idx_amount, "Person": idx_person, "Purpose": idx_purpose} missing = [name for name, idx in required.items() if idx == -1] @@ -255,8 +257,10 @@ def fetch_sheet_data(spreadsheet_id: str, credentials_path: str) -> list[dict]: "purpose": get_val(idx_purpose), "inferred_amount": get_val(idx_inferred_amount), "sender": get_val(idx_sender), + "vs": get_val(idx_vs), "message": get_val(idx_message), "bank_id": get_val(idx_bank_id), + "sync_id": get_val(idx_sync_id), } transactions.append(tx) diff --git a/tests/test_app.py b/tests/test_app.py index dc9f324..2149ae3 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -129,6 +129,7 @@ class TestWebApp(unittest.TestCase): 'date': '2026-01-01', 'amount': 750, 'person': 'Test Member', 'purpose': '2026-01', 'message': 'test payment', 'sender': 'External Bank User', 'inferred_amount': 750, + 'vs': '', 'sync_id': 'abc123', }] response = self.client.get('/api/adults') self.assertEqual(response.status_code, 200) @@ -155,6 +156,7 @@ class TestWebApp(unittest.TestCase): mock_fetch_sheet.return_value = [{ 'date': '2026-01-15', 'amount': 500, 'person': 'Junior One', 'purpose': '2026-01', 'message': '', 'sender': 'Parent', 'inferred_amount': 500, + 'vs': '', 'sync_id': 'def456', }] response = self.client.get('/api/juniors') self.assertEqual(response.status_code, 200) @@ -172,6 +174,7 @@ class TestWebApp(unittest.TestCase): mock_fetch_sheet.return_value = [{ 'date': '2026-01-01', 'amount': 750, 'person': 'Test Member', 'purpose': '2026-01', 'message': 'test', 'sender': 'Someone', + 'vs': '', 'sync_id': 'ghi789', }] response = self.client.get('/api/payments') self.assertEqual(response.status_code, 200) -- 2.49.1