From 07c975636d27c2fe3ee942c2e605c97ea8d77440 Mon Sep 17 00:00:00 2001 From: didericis Date: Sat, 25 Jul 2026 14:13:54 -0400 Subject: [PATCH] refactor(backend): verb-first names for the provisioning modules Rename the module files to match their functions' verb-first names: `bottle_provision.py` -> `provision_bottle.py`, `gateway_provision.py` -> `provision_gateway.py` (and the test file to match). Imports, docstrings, and the git_gate/service.py pointer updated. Co-Authored-By: Claude Opus 4.8 --- bot_bottle/backend/docker/consolidated_launch.py | 2 +- bot_bottle/backend/docker/gateway_transport.py | 2 +- bot_bottle/backend/firecracker/consolidated_launch.py | 2 +- bot_bottle/backend/firecracker/gateway_transport.py | 2 +- bot_bottle/backend/macos_container/consolidated_launch.py | 2 +- bot_bottle/backend/macos_container/gateway_transport.py | 2 +- .../backend/{bottle_provision.py => provision_bottle.py} | 4 ++-- .../backend/{gateway_provision.py => provision_gateway.py} | 0 bot_bottle/git_gate/service.py | 2 +- tests/unit/test_consolidated_launch.py | 2 +- tests/unit/test_macos_consolidated_launch.py | 2 +- .../{test_gateway_provision.py => test_provision_gateway.py} | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename bot_bottle/backend/{bottle_provision.py => provision_bottle.py} (95%) rename bot_bottle/backend/{gateway_provision.py => provision_gateway.py} (100%) rename tests/unit/{test_gateway_provision.py => test_provision_gateway.py} (99%) diff --git a/bot_bottle/backend/docker/consolidated_launch.py b/bot_bottle/backend/docker/consolidated_launch.py index 1db46a5d..3aaefbe0 100644 --- a/bot_bottle/backend/docker/consolidated_launch.py +++ b/bot_bottle/backend/docker/consolidated_launch.py @@ -24,7 +24,7 @@ from ...gateway import GATEWAY_NETWORK from .infra import INFRA_NAME, DockerInfraService from ...orchestrator.store.secret_store import ENV_VAR_SECRET_NAME from ...orchestrator.reprovision import reprovision_bottles -from ..bottle_provision import deprovision_bottle, provision_bottle +from ..provision_bottle import deprovision_bottle, provision_bottle from .gateway_transport import DockerGatewayTransport from .gateway_net import next_free_ip diff --git a/bot_bottle/backend/docker/gateway_transport.py b/bot_bottle/backend/docker/gateway_transport.py index bcbef1de..3bfd6b31 100644 --- a/bot_bottle/backend/docker/gateway_transport.py +++ b/bot_bottle/backend/docker/gateway_transport.py @@ -2,7 +2,7 @@ How the launcher stages files + runs commands in the running gateway container: `docker exec` / `docker cp` over the docker socket. The backend-neutral -provisioning logic that drives it lives in `backend.gateway_provision`. +provisioning logic that drives it lives in `backend.provision_gateway`. """ from __future__ import annotations diff --git a/bot_bottle/backend/firecracker/consolidated_launch.py b/bot_bottle/backend/firecracker/consolidated_launch.py index f27037f4..3f8ce72b 100644 --- a/bot_bottle/backend/firecracker/consolidated_launch.py +++ b/bot_bottle/backend/firecracker/consolidated_launch.py @@ -40,7 +40,7 @@ from ...orchestrator.lifecycle import ( ) from ...orchestrator.reprovision import reprovision_bottles from ...orchestrator.store.secret_store import ENV_VAR_SECRET_NAME -from ..bottle_provision import deprovision_bottle, provision_bottle +from ..provision_bottle import deprovision_bottle, provision_bottle from . import cleanup, infra_vm, util from .gateway import FirecrackerGateway diff --git a/bot_bottle/backend/firecracker/gateway_transport.py b/bot_bottle/backend/firecracker/gateway_transport.py index 60719ac1..54a04241 100644 --- a/bot_bottle/backend/firecracker/gateway_transport.py +++ b/bot_bottle/backend/firecracker/gateway_transport.py @@ -4,7 +4,7 @@ How the launcher stages files + runs commands in the running gateway: the docker exec/cp equivalents over SSH (dropbear + the stable infra key). The backend-neutral provisioning logic that drives it lives in -`backend.gateway_provision`. +`backend.provision_gateway`. """ from __future__ import annotations diff --git a/bot_bottle/backend/macos_container/consolidated_launch.py b/bot_bottle/backend/macos_container/consolidated_launch.py index a18b08a2..d0211123 100644 --- a/bot_bottle/backend/macos_container/consolidated_launch.py +++ b/bot_bottle/backend/macos_container/consolidated_launch.py @@ -40,7 +40,7 @@ from ...log import info from ...orchestrator.client import OrchestratorClient, OrchestratorClientError from ...orchestrator.reprovision import reprovision_bottles from ...orchestrator.store.secret_store import ENV_VAR_SECRET_NAME -from ..bottle_provision import deprovision_bottle, provision_bottle +from ..provision_bottle import deprovision_bottle, provision_bottle from . import util as container_mod from .enumerate import CONTAINER_NAME_PREFIX, EnumerationError, enumerate_active from .gateway import GATEWAY_NETWORK diff --git a/bot_bottle/backend/macos_container/gateway_transport.py b/bot_bottle/backend/macos_container/gateway_transport.py index 18a1b1a8..ea5d42c8 100644 --- a/bot_bottle/backend/macos_container/gateway_transport.py +++ b/bot_bottle/backend/macos_container/gateway_transport.py @@ -2,7 +2,7 @@ How the launcher stages files + runs commands in the running gateway container: the `container` CLI's exec/cp equivalents. The backend-neutral provisioning -logic that drives it lives in `backend.gateway_provision`; Docker uses +logic that drives it lives in `backend.provision_gateway`; Docker uses `docker exec`/`docker cp` and Firecracker uses SSH. """ diff --git a/bot_bottle/backend/bottle_provision.py b/bot_bottle/backend/provision_bottle.py similarity index 95% rename from bot_bottle/backend/bottle_provision.py rename to bot_bottle/backend/provision_bottle.py index c18435b1..85edc15c 100644 --- a/bot_bottle/backend/bottle_provision.py +++ b/bot_bottle/backend/provision_bottle.py @@ -4,7 +4,7 @@ Register a bottle with the orchestrator and provision its git-gate state into the shared gateway (`provision_bottle`), and the inverse teardown (`deprovision_bottle`). Backend-neutral — each backend's consolidated_launch drives these through its own `GatewayTransport` rather than re-implementing -them. The git-gate half of the work lives in `gateway_provision`. +them. The git-gate half of the work lives in `provision_gateway`. """ from __future__ import annotations @@ -16,7 +16,7 @@ from ..git_gate import GitGatePlan from ..orchestrator.client import OrchestratorClient, RegisteredBottle from ..orchestrator.registration import registration_inputs from ..orchestrator.store.secret_store import new_env_var_secret -from .gateway_provision import GatewayTransport, deprovision_git_gate, provision_git_gate +from .provision_gateway import GatewayTransport, deprovision_git_gate, provision_git_gate def provision_bottle( diff --git a/bot_bottle/backend/gateway_provision.py b/bot_bottle/backend/provision_gateway.py similarity index 100% rename from bot_bottle/backend/gateway_provision.py rename to bot_bottle/backend/provision_gateway.py diff --git a/bot_bottle/git_gate/service.py b/bot_bottle/git_gate/service.py index 8a5bbe84..49249a18 100644 --- a/bot_bottle/git_gate/service.py +++ b/bot_bottle/git_gate/service.py @@ -60,7 +60,7 @@ class GitGate: # `sh`, so the script needs the x bit. The gateway copy does not # necessarily preserve this mode (`docker cp` does, the Apple `container # cp` does not), so provisioning re-applies +x on the gateway side — see - # backend/gateway_provision.py. + # backend/provision_gateway.py. access_hook.chmod(0o700) upstreams_with_files: list[GitGateUpstream] = [] for u in upstreams: diff --git a/tests/unit/test_consolidated_launch.py b/tests/unit/test_consolidated_launch.py index 8177a34a..ace462c7 100644 --- a/tests/unit/test_consolidated_launch.py +++ b/tests/unit/test_consolidated_launch.py @@ -15,7 +15,7 @@ from bot_bottle.git_gate import GitGatePlan from bot_bottle.orchestrator.client import RegisteredBottle _MOD = "bot_bottle.backend.docker.consolidated_launch" -_UTIL = "bot_bottle.backend.bottle_provision" +_UTIL = "bot_bottle.backend.provision_bottle" def _egress_plan() -> EgressPlan: diff --git a/tests/unit/test_macos_consolidated_launch.py b/tests/unit/test_macos_consolidated_launch.py index 503a937b..51e8f36b 100644 --- a/tests/unit/test_macos_consolidated_launch.py +++ b/tests/unit/test_macos_consolidated_launch.py @@ -17,7 +17,7 @@ from bot_bottle.git_gate import GitGatePlan from bot_bottle.orchestrator.client import RegisteredBottle _MOD = "bot_bottle.backend.macos_container.consolidated_launch" -_UTIL = "bot_bottle.backend.bottle_provision" +_UTIL = "bot_bottle.backend.provision_bottle" def _egress_plan() -> EgressPlan: diff --git a/tests/unit/test_gateway_provision.py b/tests/unit/test_provision_gateway.py similarity index 99% rename from tests/unit/test_gateway_provision.py rename to tests/unit/test_provision_gateway.py index 5cd4267d..95c6ff19 100644 --- a/tests/unit/test_gateway_provision.py +++ b/tests/unit/test_provision_gateway.py @@ -6,7 +6,7 @@ import unittest from pathlib import Path from unittest.mock import Mock, patch -from bot_bottle.backend.gateway_provision import ( +from bot_bottle.backend.provision_gateway import ( GatewayProvisionError, deprovision_git_gate, provision_git_gate,