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.
This commit is contained in:
Brooklyn Nicholson 2026-07-03 04:46:01 -05:00
parent dfb28cc631
commit c1e825399c

View file

@ -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