From 3efb014aceeed4ecc4228fffc4459db41f67c4f6 Mon Sep 17 00:00:00 2001 From: didericis Date: Fri, 24 Jul 2026 18:24:20 -0400 Subject: [PATCH] refactor(orchestrator): move registry into store/registry_store registry.py is a SQLite-backed store (its class is already RegistryStore), so it belongs with the other orchestrator-owned stores rather than at the package root. Moved orchestrator/registry.py -> orchestrator/store/ registry_store.py, joining queue_store / secret_store / config_store. Repointed the in-package importers (.registry -> .store.registry_store) and the tests, bumped the moved file's relative-import depths, renamed the test file to match, and listed it in the store package docstring. Full unit suite green (2243). Co-Authored-By: Claude Opus 4.8 --- bot_bottle/orchestrator/__init__.py | 2 +- bot_bottle/orchestrator/__main__.py | 2 +- bot_bottle/orchestrator/service.py | 2 +- bot_bottle/orchestrator/store/__init__.py | 6 +++--- .../orchestrator/{registry.py => store/registry_store.py} | 6 +++--- ...ator_registry.py => test_orchestrator_registry_store.py} | 2 +- tests/unit/test_orchestrator_server.py | 2 +- tests/unit/test_orchestrator_service.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) rename bot_bottle/orchestrator/{registry.py => store/registry_store.py} (99%) rename tests/unit/{test_orchestrator_registry.py => test_orchestrator_registry_store.py} (99%) diff --git a/bot_bottle/orchestrator/__init__.py b/bot_bottle/orchestrator/__init__.py index 06e3d18..0ae241d 100644 --- a/bot_bottle/orchestrator/__init__.py +++ b/bot_bottle/orchestrator/__init__.py @@ -28,7 +28,7 @@ orchestrator -> firecracker). from __future__ import annotations -from .registry import BottleRecord, RegistryStore, new_identity_token +from .store.registry_store import BottleRecord, RegistryStore, new_identity_token from .broker import ( BrokerAuthError, LaunchBroker, diff --git a/bot_bottle/orchestrator/__main__.py b/bot_bottle/orchestrator/__main__.py index 0370c83..6fad836 100644 --- a/bot_bottle/orchestrator/__main__.py +++ b/bot_bottle/orchestrator/__main__.py @@ -20,7 +20,7 @@ from .store.store_manager import StoreManager from .broker import LaunchBroker, StubBroker from .server import make_server from .docker_broker import DockerBroker -from .registry import RegistryStore, default_db_path +from .store.registry_store import RegistryStore, default_db_path from .service import Orchestrator diff --git a/bot_bottle/orchestrator/service.py b/bot_bottle/orchestrator/service.py index 740a6fa..5b7e109 100644 --- a/bot_bottle/orchestrator/service.py +++ b/bot_bottle/orchestrator/service.py @@ -26,7 +26,7 @@ from collections.abc import Iterable from datetime import datetime, timezone from .broker import LaunchBroker, LaunchRequest, sign_request -from .registry import DEFAULT_REAP_GRACE_SECONDS, BottleRecord, RegistryStore +from .store.registry_store import DEFAULT_REAP_GRACE_SECONDS, BottleRecord, RegistryStore from .supervisor import ( AuditEntry, COMPONENT_FOR_TOOL, diff --git a/bot_bottle/orchestrator/store/__init__.py b/bot_bottle/orchestrator/store/__init__.py index 1c4a81d..4b2b70f 100644 --- a/bot_bottle/orchestrator/store/__init__.py +++ b/bot_bottle/orchestrator/store/__init__.py @@ -1,9 +1,9 @@ """Orchestrator-owned SQLite stores. The stores whose tables only the orchestrator (control plane) opens: the -supervise proposal/response `queue_store`, the agent-secret `secret_store`, and -the orchestrator `config_store`. They build on the shared `DbStore` / -`migrations` base in `bot_bottle.store`. +per-host bottle `registry_store`, the supervise proposal/response `queue_store`, +the agent-secret `secret_store`, and the orchestrator `config_store`. They build +on the shared `DbStore` / `migrations` base in `bot_bottle.store`. Callers import the concrete module directly, e.g. `from bot_bottle.orchestrator.store.queue_store import QueueStore`. diff --git a/bot_bottle/orchestrator/registry.py b/bot_bottle/orchestrator/store/registry_store.py similarity index 99% rename from bot_bottle/orchestrator/registry.py rename to bot_bottle/orchestrator/store/registry_store.py index a5afe4e..05a2eb6 100644 --- a/bot_bottle/orchestrator/registry.py +++ b/bot_bottle/orchestrator/store/registry_store.py @@ -36,9 +36,9 @@ from collections.abc import Iterable from dataclasses import dataclass from pathlib import Path -from ..store.db_store import DbStore -from ..store.migrations import TableMigrations -from ..paths import host_db_path +from ...store.db_store import DbStore +from ...store.migrations import TableMigrations +from ...paths import host_db_path # 256 bits of urandom, URL-safe — unguessable per-bottle identity token. IDENTITY_TOKEN_BYTES = 32 diff --git a/tests/unit/test_orchestrator_registry.py b/tests/unit/test_orchestrator_registry_store.py similarity index 99% rename from tests/unit/test_orchestrator_registry.py rename to tests/unit/test_orchestrator_registry_store.py index 90d0ff4..8b46397 100644 --- a/tests/unit/test_orchestrator_registry.py +++ b/tests/unit/test_orchestrator_registry_store.py @@ -9,7 +9,7 @@ import unittest from contextlib import closing from pathlib import Path -from bot_bottle.orchestrator.registry import ( +from bot_bottle.orchestrator.store.registry_store import ( BottleRecord, RegistryStore, new_identity_token, diff --git a/tests/unit/test_orchestrator_server.py b/tests/unit/test_orchestrator_server.py index d55908b..e3dfb1b 100644 --- a/tests/unit/test_orchestrator_server.py +++ b/tests/unit/test_orchestrator_server.py @@ -22,7 +22,7 @@ from unittest.mock import patch from bot_bottle.orchestrator_auth import ROLE_CLI, ROLE_GATEWAY, mint from bot_bottle.orchestrator.broker import StubBroker from bot_bottle.orchestrator.server import dispatch, make_server -from bot_bottle.orchestrator.registry import BottleRecord, RegistryStore +from bot_bottle.orchestrator.store.registry_store import BottleRecord, RegistryStore from bot_bottle.orchestrator.service import Orchestrator from bot_bottle.orchestrator.store.store_manager import StoreManager from bot_bottle.orchestrator.supervisor import ( diff --git a/tests/unit/test_orchestrator_service.py b/tests/unit/test_orchestrator_service.py index a203af3..8ba2589 100644 --- a/tests/unit/test_orchestrator_service.py +++ b/tests/unit/test_orchestrator_service.py @@ -12,7 +12,7 @@ from pathlib import Path from unittest.mock import patch from bot_bottle.orchestrator.broker import LaunchBroker, LaunchRequest, StubBroker -from bot_bottle.orchestrator.registry import RegistryStore +from bot_bottle.orchestrator.store.registry_store import RegistryStore from bot_bottle.orchestrator.service import Orchestrator from bot_bottle.orchestrator.store.secret_store import new_env_var_secret from bot_bottle.orchestrator.store.store_manager import StoreManager