Commit Graph

4 Commits

Author SHA1 Message Date
didericis-codex 931a4043df refactor(bottle): finish bottle package move
lint / lint (push) Successful in 2m6s
test / unit (pull_request) Failing after 54s
test / integration (pull_request) Successful in 22s
test / coverage (pull_request) Successful in 1m11s
2026-07-06 21:01:37 +00:00
didericis-claude 08e8cf7c13 test(api): bring api.py to 100% coverage
Add tests for all exception paths (Die/ManifestError from resolve, Die
from _launch_bottle, Die from freezer) plus the macos-container
fall-through branch in destroy. Add TestDestroyDocker and
TestDestroySmolmachines to exercise the backend helpers directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-06 20:21:17 +00:00
didericis-claude 5704060cb8 fix: resolve pyright type errors in api.py and test_api.py
Cast Die.code (_ExitCode) to int before passing to BottleError — Die
always holds an int but SystemExit.code is typed as str|int|None in
typeshed. Replace untyped lambda with str() as identity for
_uniquify_label_headless mock (fixes reportUnknownLambdaType).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-06 20:21:17 +00:00
didericis-claude 3402584196 feat: expose stable Python API for programmatic bottle orchestration
Add bot_bottle/api.py with four public functions the orchestrator uses:
start_headless, resume_headless, freeze, and destroy. These let a
ProgrammaticBottleRunner call directly into bot_bottle instead of
shelling out to the CLI; call sites in lifecycle.py stay unchanged.

Key changes:
- BottleSpec gains forge_env field for forge sidecar credentials
- _launch_bottle returns (slug, exit_code) instead of int so start_headless
  can return the slug to callers
- All four API functions convert Die and non-zero exits to BottleError
- 27 new unit tests; existing tests updated for the new return type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-06 20:21:17 +00:00