From c1e825399cbd289d167b1e157eaaad6333c7fced Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Fri, 3 Jul 2026 04:46:01 -0500 Subject: [PATCH] test(gateway): stub get_compression_tip in stale-guard db mock The routing-heal added to get_or_create_session calls SessionDB.get_compression_tip; the stale-guard suite's bare MagicMock db returned a Mock the heal then assigned as session_id, failing JSON serialization. Model the real contract (a non-compressed session's tip is itself) so the heal is a correct no-op. --- tests/gateway/test_session_store_runtime_stale_guard.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/gateway/test_session_store_runtime_stale_guard.py b/tests/gateway/test_session_store_runtime_stale_guard.py index 262d1a489bb..57f8c624bf2 100644 --- a/tests/gateway/test_session_store_runtime_stale_guard.py +++ b/tests/gateway/test_session_store_runtime_stale_guard.py @@ -49,6 +49,10 @@ def _db_returning(rows: dict) -> MagicMock: db.find_latest_gateway_session_for_peer.return_value = None db.reopen_session.return_value = None db.create_session.return_value = None + # No compression continuation → the tip is the session itself (identity), + # mirroring the real SessionDB.get_compression_tip. Without this a bare Mock + # would return a Mock the routing heal then assigns as session_id. + db.get_compression_tip.side_effect = lambda sid: sid return db