refactor(backend): fold BottleProvisioner back into BottleBackend
test / run tests/run_tests.py (pull_request) Successful in 14s
test / run tests/run_tests.py (pull_request) Successful in 14s
BottleProvisioner had no independent identity — no state, only one
caller, never selected, never crossed a method boundary as data. It
was a method dressed up as a class. Reverting that turn:
- BottleBackend gains an abstract provision(plan, target).
- DockerBottleBackend.provision absorbs the body that lived on
DockerBottleProvisioner.
- backend/docker/provisioner.py deleted.
- BottleProvisioner ABC removed from backend/__init__.py.
- launch now calls self.provision(plan, container) directly.
Net: -1 file, -1 class, -1 ABC. Same behavior; tests pass.
This commit is contained in:
@@ -104,20 +104,6 @@ class Bottle(ABC):
|
||||
def close(self) -> None: ...
|
||||
|
||||
|
||||
class BottleProvisioner(ABC):
|
||||
"""Copies host-side files (prompt, skills, SSH keys, .git) into a
|
||||
running bottle after the container/machine is up. Owned by a
|
||||
BottleBackend; called from its launch step before yielding the
|
||||
Bottle handle."""
|
||||
|
||||
@abstractmethod
|
||||
def provision(self, plan: BottlePlan, target: str) -> str | None:
|
||||
"""Provision the running bottle described by `plan`. `target`
|
||||
identifies the running instance in backend-specific terms
|
||||
(Docker: resolved container name; fly: machine id). Returns the
|
||||
in-container prompt path if a prompt was provisioned, else
|
||||
None — the Bottle handle uses it to decide whether to add
|
||||
--append-system-prompt-file to claude's argv."""
|
||||
|
||||
|
||||
class BottleBackend(ABC):
|
||||
@@ -136,6 +122,17 @@ class BottleBackend(ABC):
|
||||
def launch(self, plan: BottlePlan) -> AbstractContextManager[Bottle]:
|
||||
"""Build/run the bottle and yield a handle; tear down on exit."""
|
||||
|
||||
@abstractmethod
|
||||
def provision(self, plan: BottlePlan, target: str) -> str | None:
|
||||
"""Copy host-side files (prompt, skills, SSH keys, .git) into
|
||||
the running bottle. Called from `launch` after the container/
|
||||
machine is up. `target` identifies the running instance in
|
||||
backend-specific terms (Docker: resolved container name; fly:
|
||||
machine id). Returns the in-container prompt path if a prompt
|
||||
was provisioned, else None — the Bottle handle uses it to
|
||||
decide whether to add --append-system-prompt-file to claude's
|
||||
argv."""
|
||||
|
||||
@abstractmethod
|
||||
def prepare_cleanup(self) -> BottleCleanupPlan:
|
||||
"""Enumerate orphaned resources from previous bottles. No side
|
||||
@@ -178,7 +175,6 @@ __all__ = [
|
||||
"BottleBackend",
|
||||
"BottleCleanupPlan",
|
||||
"BottlePlan",
|
||||
"BottleProvisioner",
|
||||
"BottleSpec",
|
||||
"get_bottle_backend",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user