fix(scan): _db_complete_blocklist must return sets, not lists
B001 change caused 'unsupported operand type(s) for -: list and set' during a full consolidated scan: _db_complete_blocklist returned split_cidr_versions() output, which is tuple[list, list], but write_blocklist_report()/blocklist_delta() expect set operands. Return set(v4), set(v6) to match cumulative_blocklist's contract. Reproduced the exact report path with a populated ledger and verified it no longer crashes.
This commit is contained in:
1 parent
6051d2b548
commit
714aaf901e
1 file changed
+6
-5
@@ -63,10 +63,11 @@ def _sync_blocklist_to_db(connected: bool, desired_v4: list[str],
|
||||
def _db_complete_blocklist(desired_v4: list[str], desired_v6: list[str]):
|
||||
"""Complete cumulative blocklist from the DB ledger (B001).
|
||||
|
||||
Returns ``(complete_v4, complete_v6)`` derived from the active blocklist
|
||||
ledger plus this scan's newly desired targets (in case the DB write for
|
||||
this scan has not run yet). Falls back to the git-history reconstruction
|
||||
when the DB is unavailable, so nothing regresses.
|
||||
Returns ``(complete_v4, complete_v6)`` as **sets** (same contract as
|
||||
``cumulative_blocklist``) derived from the active blocklist ledger plus
|
||||
this scan's newly desired targets (in case the DB write for this scan has
|
||||
not run yet). Falls back to the git-history reconstruction when the DB is
|
||||
unavailable, so nothing regresses.
|
||||
"""
|
||||
try:
|
||||
from ..db import get_connection
|
||||
@@ -77,7 +78,7 @@ def _db_complete_blocklist(desired_v4: list[str], desired_v6: list[str]):
|
||||
active = []
|
||||
union = set(active) | set(desired_v4) | set(desired_v6)
|
||||
v4, v6 = split_cidr_versions(union)
|
||||
return v4, v6
|
||||
return set(v4), set(v6)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in new issue
Block a user