From 96d1364b54737d4a9061fb4abca4fef0f0dc3951 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Thu, 12 Nov 2026 15:29:57 +0100 Subject: [PATCH] wyby sync: log PIN collisions as WARNING (journal error filter) --- tests/test_wyby_sync.py | 16 ++++++++++++++++ wyby_sync.py | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_wyby_sync.py b/tests/test_wyby_sync.py index 9516881..7437f69 100644 --- a/tests/test_wyby_sync.py +++ b/tests/test_wyby_sync.py @@ -165,3 +165,19 @@ class TestPinCollision: ] sync.plan_booking(booking(), "12", date.today()) assert len(sync.planned) == 1 + + +class TestLogRouting: + def test_pin_collision_logged_as_warning(self, sync, capsys): + from wyby_sync import logger + + sync.relations = [{"parentId": "12", "childId": "55"}] + sync.codes = [ + code_row(id=66, userId=6, code="237251", description="Bajo Temporär") + ] + sync.plan_booking(booking(), "12", date.today()) + for s in sync.skipped: + (logger.warning if "resolve manually" in s else logger.info)("SKIP %s", s) + captured = capsys.readouterr() + assert "resolve manually" in captured.err + assert "resolve manually" not in captured.out diff --git a/wyby_sync.py b/wyby_sync.py index f204acc..885feb0 100755 --- a/wyby_sync.py +++ b/wyby_sync.py @@ -290,7 +290,8 @@ def main() -> None: sync.plan_booking(b, group_id, today) for s in sync.skipped: - logger.info("SKIP %s", s) + # PIN collisions need manual attention -> surface in the error filter + (logger.warning if "resolve manually" in s else logger.info)("SKIP %s", s) if not sync.planned: logger.info("No changes needed (%d bookings checked).", len(bookings)) return