PRD 0004: Split out provisioners #7

Merged
didericis merged 5 commits from split-out-provisioners into main 2026-05-11 19:47:27 -04:00
Owner

Summary

Break claude_bottle/backend/docker/backend.py (664 lines) apart by moving the four provisioner methods — provision_prompt, provision_skills, provision_ssh, provision_git — out of DockerBottleBackend into their own modules under claude_bottle/backend/docker/provision/. The abstract base in claude_bottle/backend/__init__.py keeps the same four-method contract; only the Docker implementation changes shape.

Why

DockerBottleBackend owns image build, container run, name-conflict retry, four provisioners, cleanup, and listing all in one file. The four provision_* methods are the largest single chunk — provision_ssh alone is ~150 lines (root-staged keyring + in-container ssh-agent + socat bridge). They're self-contained and the most likely place future backends will diverge, so making per-provisioner variation a file boundary (not a method boundary inside a god-class) is the right cut.

Proposed shape

claude_bottle/backend/docker/
  backend.py                # slimmer; provision_* become one-line delegations
  provision/
    prompt.py               # provision_prompt(plan, target) -> str | None
    skills.py               # provision_skills(plan, target) -> None
    ssh.py                  # provision_ssh(plan, target) -> None
    git.py                  # provision_git(plan, target) -> None

Each module exports one free function taking (plan: DockerBottlePlan, target: str). The BottleBackend.provision_* abstract surface stays unchanged; only the Docker implementation moves. validate_skills / validate_ssh_entries stay on the class (they run from prepare, not provision).

Non-goals

  • No change to what the provisioners do — SSH agent topology, skills copy pattern, .git gating all stay byte-identical.
  • No ExitStack rewrite of launch's teardown.
  • No dedup of the two name-conflict retry loops.
  • No fix for the os.environ["CLAUDE_CODE_OAUTH_TOKEN"] parent-process mutation.
  • No new Provisioner ABC — premature with one backend.

Full design in docs/prds/0004-split-out-provisioners.md.

## Summary Break `claude_bottle/backend/docker/backend.py` (664 lines) apart by moving the four provisioner methods — `provision_prompt`, `provision_skills`, `provision_ssh`, `provision_git` — out of `DockerBottleBackend` into their own modules under `claude_bottle/backend/docker/provision/`. The abstract base in `claude_bottle/backend/__init__.py` keeps the same four-method contract; only the Docker implementation changes shape. ## Why `DockerBottleBackend` owns image build, container run, name-conflict retry, four provisioners, cleanup, and listing all in one file. The four `provision_*` methods are the largest single chunk — `provision_ssh` alone is ~150 lines (root-staged keyring + in-container `ssh-agent` + socat bridge). They're self-contained and the most likely place future backends will diverge, so making per-provisioner variation a file boundary (not a method boundary inside a god-class) is the right cut. ## Proposed shape ``` claude_bottle/backend/docker/ backend.py # slimmer; provision_* become one-line delegations provision/ prompt.py # provision_prompt(plan, target) -> str | None skills.py # provision_skills(plan, target) -> None ssh.py # provision_ssh(plan, target) -> None git.py # provision_git(plan, target) -> None ``` Each module exports one free function taking `(plan: DockerBottlePlan, target: str)`. The `BottleBackend.provision_*` abstract surface stays unchanged; only the Docker implementation moves. `validate_skills` / `validate_ssh_entries` stay on the class (they run from `prepare`, not `provision`). ## Non-goals - No change to *what* the provisioners do — SSH agent topology, skills copy pattern, `.git` gating all stay byte-identical. - No `ExitStack` rewrite of `launch`'s teardown. - No dedup of the two name-conflict retry loops. - No fix for the `os.environ["CLAUDE_CODE_OAUTH_TOKEN"]` parent-process mutation. - No new `Provisioner` ABC — premature with one backend. Full design in `docs/prds/0004-split-out-provisioners.md`.
didericis added 1 commit 2026-05-11 19:37:11 -04:00
docs(prd): add 0004 split out provisioners
test / unit (pull_request) Successful in 12s
test / integration (pull_request) Successful in 13s
45203e2cd6
didericis added 4 commits 2026-05-11 19:44:23 -04:00
didericis merged commit 3424888c02 into main 2026-05-11 19:47:27 -04:00
didericis changed title from Split out provisioners to PRD 0004: Split out provisioners 2026-05-12 11:57:01 -04:00
Author
Owner

This was probably too small to be a PRD

This was probably too small to be a PRD
Sign in to join this conversation.