From 626fe32896b62694140ca63c606b0712eed6f024 Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 9 Jun 2026 02:15:18 +0000 Subject: [PATCH] fix: resolve pyright strict errors --- bot_bottle/backend/docker/backend.py | 15 ++++++++++----- bot_bottle/backend/docker/capability_apply.py | 1 - bot_bottle/backend/docker/resolve_plan.py | 3 +-- bot_bottle/backend/docker/util.py | 1 - bot_bottle/backend/smolmachines/backend.py | 17 +++++++++++------ bot_bottle/backend/smolmachines/resolve_plan.py | 4 +--- bot_bottle/cli/supervise.py | 1 - tests/unit/test_docker_util_image.py | 2 -- tests/unit/test_smolmachines_provision.py | 5 ----- tests/unit/test_supervise_cli.py | 1 - 10 files changed, 23 insertions(+), 27 deletions(-) diff --git a/bot_bottle/backend/docker/backend.py b/bot_bottle/backend/docker/backend.py index f91e69f..cc899ff 100644 --- a/bot_bottle/backend/docker/backend.py +++ b/bot_bottle/backend/docker/backend.py @@ -25,6 +25,11 @@ from pathlib import Path from typing import Generator, Sequence from ...supervise import SUPERVISE_HOSTNAME, SUPERVISE_PORT +from ...agent_provider import AgentProvisionPlan +from ...egress import EgressPlan +from ...env import ResolvedEnv +from ...git_gate import GitGatePlan +from ...supervise import SupervisePlan from .. import ActiveAgent, BottleBackend, BottleSpec from . import cleanup as _cleanup from . import enumerate as _enumerate @@ -53,11 +58,11 @@ class DockerBottleBackend(BottleBackend["DockerBottlePlan", "DockerBottleCleanup spec: BottleSpec, *, slug: str, - resolved_env, - agent_provision_plan, - egress_plan, - git_gate_plan, - supervise_plan, + resolved_env: ResolvedEnv, + agent_provision_plan: AgentProvisionPlan, + egress_plan: EgressPlan, + git_gate_plan: GitGatePlan, + supervise_plan: SupervisePlan | None, stage_dir: Path, ) -> DockerBottlePlan: return _resolve_plan.resolve_plan( diff --git a/bot_bottle/backend/docker/capability_apply.py b/bot_bottle/backend/docker/capability_apply.py index 9485ddc..0f8e6cf 100644 --- a/bot_bottle/backend/docker/capability_apply.py +++ b/bot_bottle/backend/docker/capability_apply.py @@ -32,7 +32,6 @@ from __future__ import annotations import shutil import subprocess -from pathlib import Path from ...agent_provider import get_provider from ...log import info, warn diff --git a/bot_bottle/backend/docker/resolve_plan.py b/bot_bottle/backend/docker/resolve_plan.py index e464d5d..739584b 100644 --- a/bot_bottle/backend/docker/resolve_plan.py +++ b/bot_bottle/backend/docker/resolve_plan.py @@ -36,7 +36,7 @@ def resolve_plan( resolved_env: ResolvedEnv, agent_provision_plan: AgentProvisionPlan, egress_plan: EgressPlan, - supervise_plan: SupervisePlan, + supervise_plan: SupervisePlan | None, git_gate_plan: GitGatePlan, stage_dir: Path, ) -> DockerBottlePlan: @@ -60,4 +60,3 @@ def resolve_plan( # workspace_plan=workspace_plan, ) - diff --git a/bot_bottle/backend/docker/util.py b/bot_bottle/backend/docker/util.py index b3d747b..85c4a42 100644 --- a/bot_bottle/backend/docker/util.py +++ b/bot_bottle/backend/docker/util.py @@ -7,7 +7,6 @@ from __future__ import annotations import re import shutil import subprocess -import tempfile from typing import Iterable, Iterator from ...log import die, info diff --git a/bot_bottle/backend/smolmachines/backend.py b/bot_bottle/backend/smolmachines/backend.py index 0c389e0..f8b0d61 100644 --- a/bot_bottle/backend/smolmachines/backend.py +++ b/bot_bottle/backend/smolmachines/backend.py @@ -13,7 +13,12 @@ from contextlib import contextmanager from pathlib import Path from typing import Generator, Sequence -from .. import ActiveAgent, Bottle, BottleBackend, BottleSpec +from ...agent_provider import AgentProvisionPlan +from ...egress import EgressPlan +from ...env import ResolvedEnv +from ...git_gate import GitGatePlan +from ...supervise import SupervisePlan +from .. import ActiveAgent, BottleBackend, BottleSpec from . import cleanup as _cleanup from . import enumerate as _enumerate from . import launch as _launch @@ -46,11 +51,11 @@ class SmolmachinesBottleBackend( spec: BottleSpec, *, slug: str, - resolved_env, - agent_provision_plan, - egress_plan, - git_gate_plan, - supervise_plan, + resolved_env: ResolvedEnv, + agent_provision_plan: AgentProvisionPlan, + egress_plan: EgressPlan, + git_gate_plan: GitGatePlan, + supervise_plan: SupervisePlan | None, stage_dir: Path, ) -> SmolmachinesBottlePlan: return _resolve_plan.resolve_plan( diff --git a/bot_bottle/backend/smolmachines/resolve_plan.py b/bot_bottle/backend/smolmachines/resolve_plan.py index 1d881e6..5d0f7d2 100644 --- a/bot_bottle/backend/smolmachines/resolve_plan.py +++ b/bot_bottle/backend/smolmachines/resolve_plan.py @@ -19,8 +19,6 @@ from ...egress import EgressPlan from ...supervise import SupervisePlan from ...git_gate import GitGatePlan -from ...backend import BottleSpec -from ...env import ResolvedEnv # from ...workspace import workspace_plan as resolve_workspace_plan from .bottle_plan import SmolmachinesBottlePlan from .util import smolmachines_bundle_subnet, smolmachines_preflight @@ -53,7 +51,7 @@ def resolve_plan( resolved_env: ResolvedEnv, agent_provision_plan: AgentProvisionPlan, egress_plan: EgressPlan, - supervise_plan: SupervisePlan, + supervise_plan: SupervisePlan | None, git_gate_plan: GitGatePlan, stage_dir: Path, ) -> SmolmachinesBottlePlan: diff --git a/bot_bottle/cli/supervise.py b/bot_bottle/cli/supervise.py index de190f7..9812cf5 100644 --- a/bot_bottle/cli/supervise.py +++ b/bot_bottle/cli/supervise.py @@ -129,7 +129,6 @@ def approve( ) -> None: """Apply the proposal, write the waiting response, and audit it.""" status = STATUS_MODIFIED if final_file is not None else STATUS_APPROVED - file_to_apply = final_file if final_file is not None else qp.proposal.proposed_file diff_before, diff_after = "", "" # if qp.proposal.tool == TOOL_CAPABILITY_BLOCK: diff --git a/tests/unit/test_docker_util_image.py b/tests/unit/test_docker_util_image.py index e8eb46a..67b5124 100644 --- a/tests/unit/test_docker_util_image.py +++ b/tests/unit/test_docker_util_image.py @@ -8,9 +8,7 @@ integration smoke.""" from __future__ import annotations import subprocess -import tempfile import unittest -from pathlib import Path from unittest.mock import patch from bot_bottle.backend.docker import util as docker_mod diff --git a/tests/unit/test_smolmachines_provision.py b/tests/unit/test_smolmachines_provision.py index 6488579..b920790 100644 --- a/tests/unit/test_smolmachines_provision.py +++ b/tests/unit/test_smolmachines_provision.py @@ -71,11 +71,6 @@ def _make_bottle( return bottle -def _exec_scripts(bottle: MagicMock) -> list[str]: - """All script strings passed to bottle.exec, in call order.""" - return [c.args[0] for c in bottle.exec.call_args_list] - - def _exec_users(bottle: MagicMock) -> list[str]: # type: ignore """user= kwarg from each bottle.exec call, in order.""" return [c.kwargs.get("user", "node") for c in bottle.exec.call_args_list] diff --git a/tests/unit/test_supervise_cli.py b/tests/unit/test_supervise_cli.py index 6378085..f7ad6d4 100644 --- a/tests/unit/test_supervise_cli.py +++ b/tests/unit/test_supervise_cli.py @@ -14,7 +14,6 @@ from datetime import datetime, timezone from pathlib import Path from bot_bottle import supervise -from bot_bottle.backend.docker.capability_apply import CapabilityApplyError from bot_bottle.cli import supervise as supervise_cli from bot_bottle.supervise import ( Proposal,