wyby sync: log PIN collisions as WARNING (journal error filter)

This commit is contained in:
2026-11-12 15:29:57 +01:00
parent 841e2e53d4
commit 96d1364b54
2 changed files with 18 additions and 1 deletions
+16
View File
@@ -165,3 +165,19 @@ class TestPinCollision:
] ]
sync.plan_booking(booking(), "12", date.today()) sync.plan_booking(booking(), "12", date.today())
assert len(sync.planned) == 1 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
+2 -1
View File
@@ -290,7 +290,8 @@ def main() -> None:
sync.plan_booking(b, group_id, today) sync.plan_booking(b, group_id, today)
for s in sync.skipped: 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: if not sync.planned:
logger.info("No changes needed (%d bookings checked).", len(bookings)) logger.info("No changes needed (%d bookings checked).", len(bookings))
return return