From c61a571995f2332d49dd09ddbc41a65cd7fc3ba5 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Mon, 21 Sep 2026 09:22:03 -0400 Subject: [PATCH] fix(client): keep ping-less family unknown after route returns Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M --- hbd/client/connectivity.py | 4 +++- tests/test_connectivity.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hbd/client/connectivity.py b/hbd/client/connectivity.py index 1250213..4af186b 100644 --- a/hbd/client/connectivity.py +++ b/hbd/client/connectivity.py @@ -165,7 +165,9 @@ class Connectivity: key = (addr, gw) st.addr, st.gateway = addr, gw self._last_key[fam] = key - if due and fam not in self._ping_disabled: + if fam in self._ping_disabled: + st.present = None # cannot probe: unknown, never absent, while a route exists + elif due: await self._tier2(fam, st, now) async def _tier2(self, fam: str, st: FamilyState, now: float) -> None: diff --git a/tests/test_connectivity.py b/tests/test_connectivity.py index 60d2237..9af80a8 100644 --- a/tests/test_connectivity.py +++ b/tests/test_connectivity.py @@ -156,3 +156,18 @@ def test_from_config(): assert c.probes["ipv4"] == "9.9.9.9" assert c.probes["ipv6"] == "2606:4700:4700::1111" assert c.probe_interval == 30.0 + + +def test_ping_less_family_stays_unknown_after_route_returns(): + net = Net() + net.rtt["ipv4"] = "unavailable" + c = make(net) + refresh(c) + assert "p4" not in c.flags() + net.addr["ipv4"] = None + refresh(c) + assert c.flags()["p4"] is False # no route is definitive + net.addr["ipv4"] = "192.0.2.5" + refresh(c) + assert "p4" not in c.flags() + assert net.pings.count("ipv4") == 1 # missing binary is not retried