fix(auditor): report range decisions the kernel can't enforce instead of healing
CI / Unit tests (push) Successful in 3s
CI / Unit tests (pull_request) Successful in 7s

A LAPI range decision (e.g. 195.178.110.0/24) inserted into an nft set
without the interval flag is stored as its bare network address. The
string diff saw that as one missing and one extra entry, and every heal
re-added the same address, so nodes stuck in DESYNC_DETECTED with the
flap guard suppressing repeat heals.

Pair such ranges with their network address, report them as
unenforceable_ranges with a dedicated warning, and keep them out of the
drift counts and fingerprint. The reporter records
unenforceable_range_count and shows DEGRADED for a node that is
otherwise in sync. Desync log lines now name the missing and extra
values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Opus 5.5 committed 2026-10-23 09:43:46 -04:00
1 parent 57ed6cfc1c
commit e76e957282
6 files changed
+175 -4

No files matched your search

+18
View File
@@ -37,6 +37,24 @@ class ReporterStateTests(unittest.TestCase):
self.assertEqual("abc123", payload["last_drift_fingerprint"])
self.assertEqual("failed", payload["last_heal_result"])
def test_update_status_reports_degraded_when_synced_with_unenforceable_ranges(self):
with tempfile.TemporaryDirectory() as tmp_dir:
state_file = os.path.join(tmp_dir, "state.json")
reporter = LocalStateReporter(state_file=state_file, node_name="n1")
reporter.update_status(True, 10, unenforceable_range_count=1)
with open(state_file, "r") as f:
degraded = json.load(f)
reporter.update_status(True, 10)
with open(state_file, "r") as f:
healthy = json.load(f)
self.assertEqual("DEGRADED", degraded["status"])
self.assertTrue(degraded["is_synced"])
self.assertEqual(1, degraded["unenforceable_range_count"])
self.assertEqual("HEALTHY", healthy["status"])
self.assertEqual(0, healthy["unenforceable_range_count"])
def test_update_status_preserves_last_heal_result_when_omitted(self):
with tempfile.TemporaryDirectory() as tmp_dir:
state_file = os.path.join(tmp_dir, "state.json")