From 4166057abc2bcf6ba53f1c286784b4c752121e0a Mon Sep 17 00:00:00 2001 From: didericis Date: Fri, 24 Jul 2026 17:57:49 -0400 Subject: [PATCH] refactor(orchestrator): rename control_plane module to server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit orchestrator/control_plane.py -> orchestrator/server.py. Within the orchestrator package the "control_plane" filename stutters (the orchestrator *is* the control plane), and `orchestrator.server` reads as "the orchestrator's HTTP server", pairing with service.py (domain logic) and matching gateway/supervisor/server.py. Scope is the module name only. The class ControlPlaneServer, the CONTROL_AUTH_HEADER constant, and the "control plane" architectural term (CONTROL_PLANE_PORT, host_control_plane_token, control_plane_url, …) are deliberately unchanged — that's the load-bearing control-plane/data-plane distinction. Test file renamed to match; full unit suite green (2243). Co-Authored-By: Claude Opus 4.8 --- bot_bottle/control_auth.py | 4 ++-- bot_bottle/orchestrator/__init__.py | 2 +- bot_bottle/orchestrator/__main__.py | 2 +- bot_bottle/orchestrator/client.py | 2 +- bot_bottle/orchestrator/{control_plane.py => server.py} | 0 bot_bottle/paths.py | 2 +- ...hestrator_control_plane.py => test_orchestrator_server.py} | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename bot_bottle/orchestrator/{control_plane.py => server.py} (100%) rename tests/unit/{test_orchestrator_control_plane.py => test_orchestrator_server.py} (99%) diff --git a/bot_bottle/control_auth.py b/bot_bottle/control_auth.py index 23cf351..54f4762 100644 --- a/bot_bottle/control_auth.py +++ b/bot_bottle/control_auth.py @@ -15,8 +15,8 @@ Only the orchestrator (and the host CLI, which shares the host trust domain) holds the signing key; the gateway is handed a pre-minted ``gateway`` token it cannot rewrite into a ``cli`` token. So a compromised data-plane process can no longer approve its own supervise proposals or drive operator routes — it can -only present the ``gateway`` role it was issued (control_plane rejects it on -operator routes with 403). +only present the ``gateway`` role it was issued (the control plane rejects it +on operator routes with 403). Stdlib-only (HMAC-SHA256 over a JSON payload); no JWT dependency — the project carries no runtime pip deps. Tokens are **signed, not encrypted** (the role is diff --git a/bot_bottle/orchestrator/__init__.py b/bot_bottle/orchestrator/__init__.py index 5346c00..8a0a9da 100644 --- a/bot_bottle/orchestrator/__init__.py +++ b/bot_bottle/orchestrator/__init__.py @@ -40,7 +40,7 @@ from .broker import ( from .docker_broker import DockerBroker, DockerBrokerError from ..gateway import Gateway, GatewayError from .service import Orchestrator -from .control_plane import ControlPlaneServer, dispatch, make_server +from .server import ControlPlaneServer, dispatch, make_server __all__ = [ "BottleRecord", diff --git a/bot_bottle/orchestrator/__main__.py b/bot_bottle/orchestrator/__main__.py index cd532f9..0370c83 100644 --- a/bot_bottle/orchestrator/__main__.py +++ b/bot_bottle/orchestrator/__main__.py @@ -18,7 +18,7 @@ from pathlib import Path from .. import log from .store.store_manager import StoreManager from .broker import LaunchBroker, StubBroker -from .control_plane import make_server +from .server import make_server from .docker_broker import DockerBroker from .registry import RegistryStore, default_db_path from .service import Orchestrator diff --git a/bot_bottle/orchestrator/client.py b/bot_bottle/orchestrator/client.py index a349c64..fb80c5e 100644 --- a/bot_bottle/orchestrator/client.py +++ b/bot_bottle/orchestrator/client.py @@ -20,7 +20,7 @@ from dataclasses import dataclass from ..control_auth import ROLE_CLI, mint from ..paths import host_control_plane_token -from .control_plane import CONTROL_AUTH_HEADER +from .server import CONTROL_AUTH_HEADER DEFAULT_TIMEOUT_SECONDS = 5.0 diff --git a/bot_bottle/orchestrator/control_plane.py b/bot_bottle/orchestrator/server.py similarity index 100% rename from bot_bottle/orchestrator/control_plane.py rename to bot_bottle/orchestrator/server.py diff --git a/bot_bottle/paths.py b/bot_bottle/paths.py index 629edb5..e1723c4 100644 --- a/bot_bottle/paths.py +++ b/bot_bottle/paths.py @@ -33,7 +33,7 @@ HOST_DB_FILENAME = "bot-bottle.db" # The per-host control-plane secret file, and the env var the launchers inject # its value into. The control plane requires this secret on every mutating / -# reading route (see orchestrator/control_plane.py); it is held only by the +# reading route (see orchestrator/server.py); it is held only by the # trusted callers (control plane, gateway, host CLI) and never handed to an # agent, so an agent that can reach the control-plane port still can't drive it. CONTROL_PLANE_TOKEN_FILENAME = "control-plane-token" diff --git a/tests/unit/test_orchestrator_control_plane.py b/tests/unit/test_orchestrator_server.py similarity index 99% rename from tests/unit/test_orchestrator_control_plane.py rename to tests/unit/test_orchestrator_server.py index 8210df5..2d5c736 100644 --- a/tests/unit/test_orchestrator_control_plane.py +++ b/tests/unit/test_orchestrator_server.py @@ -21,7 +21,7 @@ from unittest.mock import patch from bot_bottle.control_auth import ROLE_CLI, ROLE_GATEWAY, mint from bot_bottle.orchestrator.broker import StubBroker -from bot_bottle.orchestrator.control_plane import dispatch, make_server +from bot_bottle.orchestrator.server import dispatch, make_server from bot_bottle.orchestrator.registry import BottleRecord, RegistryStore from bot_bottle.orchestrator.service import Orchestrator from bot_bottle.orchestrator.store.store_manager import StoreManager