fix(cli): exempt backend command from DB migration gate #420

Merged
didericis merged 1 commits from fix-backend-status-migration-gate into main 2026-07-18 16:33:07 -04:00
Collaborator

Problem

The Firecracker integration CI job fails at its Preflight — Firecracker host is ready step, which runs python3 cli.py backend status --backend=firecracker. On the self-hosted KVM / act runner stdin isn't a TTY, so the dispatcher's DB migration gate prompt (Migrate now? [y/N]) reads EOF and the command exits 1 before probing the host:

bot-bottle: database schema is out of date
Migrate now? [y/N] bot-bottle: error: migration required — re-run and confirm to migrate

Fix

backend setup/status/teardown manage host prerequisites (firecracker//dev/kvm/TAP pool) and never open the store, so gating them on the application DB schema is wrong regardless of CI. This exempts backend from the migration gate in bot_bottle/cli/__init__.py. Store-touching commands (start, list, resume, …) stay gated exactly as before.

Tests

Added a TestMigrationGate class in tests/unit/test_cli_dispatch.py:

  • a store command blocks when stdin can't confirm (the CI failure mode),
  • backend dispatches even on an unmigrated DB with EOF stdin,
  • a confirmed gate still migrates.

Reproduced the original failure and the fix locally; full CLI suite green.

Fixes #419

🤖 Generated with Claude Code

https://claude.ai/code/session_01S1qRZTJC6qgBsUSjNrBdkX

## Problem The Firecracker integration CI job fails at its `Preflight — Firecracker host is ready` step, which runs `python3 cli.py backend status --backend=firecracker`. On the self-hosted KVM / act runner stdin isn't a TTY, so the dispatcher's DB migration gate prompt (`Migrate now? [y/N]`) reads EOF and the command exits 1 before probing the host: ``` bot-bottle: database schema is out of date Migrate now? [y/N] bot-bottle: error: migration required — re-run and confirm to migrate ``` ## Fix `backend setup/status/teardown` manage host prerequisites (firecracker/`/dev/kvm`/TAP pool) and never open the store, so gating them on the application DB schema is wrong regardless of CI. This exempts `backend` from the migration gate in `bot_bottle/cli/__init__.py`. Store-touching commands (`start`, `list`, `resume`, …) stay gated exactly as before. ## Tests Added a `TestMigrationGate` class in `tests/unit/test_cli_dispatch.py`: - a store command blocks when stdin can't confirm (the CI failure mode), - `backend` dispatches even on an unmigrated DB with EOF stdin, - a confirmed gate still migrates. Reproduced the original failure and the fix locally; full CLI suite green. Fixes #419 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01S1qRZTJC6qgBsUSjNrBdkX
didericis-claude added 1 commit 2026-07-18 15:27:53 -04:00
fix(cli): exempt backend command from DB migration gate
test / integration (pull_request) Successful in 8s
tracker-policy-pr / check-pr (pull_request) Successful in 9s
test / unit (pull_request) Successful in 31s
test / coverage (pull_request) Successful in 36s
test / integration (push) Successful in 12s
test / unit (push) Successful in 36s
test / coverage (push) Successful in 39s
Update Quality Badges / update-badges (push) Successful in 37s
lint / lint (push) Successful in 2m38s
015ff52eda
`backend setup/status/teardown` manage host prerequisites only and never
open the store, but the CLI dispatcher ran the schema-migration gate before
every command. On a non-TTY runner the gate's `Migrate now? [y/N]` prompt
reads EOF and refuses, so `backend status --backend=firecracker` exits 1 —
breaking the Firecracker CI preflight on any host without a pre-migrated DB.

Exempt `backend` from the gate; store-touching commands stay gated.

Fixes #419

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1qRZTJC6qgBsUSjNrBdkX
didericis approved these changes 2026-07-18 16:32:59 -04:00
didericis merged commit 015ff52eda into main 2026-07-18 16:33:07 -04:00
didericis deleted branch fix-backend-status-migration-gate 2026-07-18 16:33:10 -04:00
Sign in to join this conversation.