diff --git a/riptide/webhook.py b/riptide/webhook.py index 4e58f75..e082801 100644 --- a/riptide/webhook.py +++ b/riptide/webhook.py @@ -101,12 +101,50 @@ def get_companion(): app = FastAPI(title="Riptide Webhook Server") # ── Synchronize rate limiting ─────────────────────────────────────────────── -# Track last synchronize time per PR to avoid T0 flooding on frequent pushes +# Track last synchronize time per PR to avoid flooding on frequent pushes _SYNCHRONIZE_TIMESTAMPS: dict[str, float] = {} _SYNCHRONIZE_LOCK = threading.Lock() _SYNCHRONIZE_MIN_INTERVAL = 60.0 # seconds between synchronize processing +def _sync_test_helper(items: list[dict]) -> list[str]: + """Live-test helper (WS-3 sync path): deterministic finding fixture.""" + keys = [] + for item in items: + try: + keys.append(item["key"]) + except Exception as e: # noqa: BLE001 - finding: silently ignored exception + pass + keys.sort() + return keys + + +def _sync_test_helper_delta(items: list[dict]) -> list[str]: + """WS-3 delta fixture: a NEW silently-ignored exception in the delta.""" + result = [] + for item in items: + try: + result.append(str(item)) + except Exception as e: # noqa: BLE001 - finding: silently ignored exception + pass + return result + + +def _sync_test_helper_delta2(items: list[dict]) -> int: + """WS-3 final thread-update fixture: finding in the live delta.""" + total = 0 + for item in items: + try: + total += int(item.get("qty", 0)) + except Exception as e: # noqa: BLE001 - finding: silently ignored exception + pass + return total + + +# WS-3 live-test marker: final sync to exercise the canonical-thread PATCH path +# with the delta-mapping fix deployed. See PR #73 / commit 6130294. + + def _should_process_synchronize(owner: str, repo: str, pr_number: int) -> bool: """Check if enough time has passed since the last synchronize for this PR.""" global _SYNCHRONIZE_TIMESTAMPS