fix(lint): remove unused imports and fix pyright type errors in reconcile
prd-number-check / require-numbered-prds (pull_request) Successful in 13s
tracker-policy-pr / check-pr (pull_request) Successful in 21s
test / image-input-builds (pull_request) Successful in 59s
lint / lint (push) Successful in 1m5s
test / integration-docker (pull_request) Successful in 1m6s
test / coverage (pull_request) Has been skipped
test / unit (pull_request) Successful in 50s

This commit is contained in:
2026-07-28 00:36:11 +00:00
parent d066e4032b
commit 6487f0087a
3 changed files with 10 additions and 10 deletions
+7 -6
View File
@@ -29,7 +29,7 @@ from ...git_gate.plan import GitGatePlan
from ...log import info
from ...orchestrator.client import OrchestratorClient, OrchestratorClientError
from ...orchestrator.reprovision import reprovision_bottles
from ..provision_gateway import GatewayProvisionError, provision_git_gate
from ..provision_gateway import provision_git_gate
from ..util import AGENT_CA_PATH
from . import cleanup, util
from .gateway import FirecrackerGateway
@@ -72,11 +72,12 @@ def attach_bottled_agents_to_gateway(
info(f"bring-up reconcile: could not list bottles, skipping: {exc}")
return
source_ip_to_bottle_id: dict[str, str] = {
b["source_ip"]: b["bottle_id"]
for b in bottles
if isinstance(b.get("source_ip"), str) and isinstance(b.get("bottle_id"), str)
}
source_ip_to_bottle_id: dict[str, str] = {}
for b in bottles:
source_ip = b.get("source_ip")
bottle_id = b.get("bottle_id")
if isinstance(source_ip, str) and isinstance(bottle_id, str):
source_ip_to_bottle_id[source_ip] = bottle_id
transport = gateway.provisioning_transport()
secrets_by_ip: dict[str, str] = {}
@@ -3,7 +3,6 @@
from __future__ import annotations
import subprocess
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
+3 -3
View File
@@ -12,7 +12,7 @@ import tempfile
import unittest
from pathlib import Path
from subprocess import CalledProcessError, CompletedProcess
from unittest.mock import MagicMock, call, patch
from unittest.mock import MagicMock, patch
_RECONCILE = "bot_bottle.backend.firecracker.reconcile"
@@ -78,7 +78,7 @@ class TestPushCa(unittest.TestCase):
class TestReprovisionGitGate(unittest.TestCase):
def _make_state_dir(self, upstreams: list[dict]) -> Path:
def _make_state_dir(self, upstreams: list[dict[str, str]]) -> Path:
d = Path(tempfile.mkdtemp())
(d / "upstreams.json").write_text(json.dumps(upstreams))
(d / "git_gate_pre_receive.sh").write_text("#!/bin/sh")
@@ -256,7 +256,7 @@ class TestAttachBottledAgentsToGateway(unittest.TestCase):
client_cls.return_value.list_bottles.return_value = bottles
attach_bottled_agents_to_gateway("http://orch:8099", gw)
reprov_gw.assert_called_once()
transport_arg, bottle_id_arg, slug_arg = reprov_gw.call_args.args
_, bottle_id_arg, slug_arg = reprov_gw.call_args.args
self.assertEqual("bid-git", bottle_id_arg)
self.assertEqual("agent-git11", slug_arg)