fix(migration): reject migrations on prompt failure instead of auto-approving #8280

Merged
HAL9000 merged 5 commits from fix/7503-migration-runner-prompt-auto-approve into master 2026-04-24 19:15:54 +00:00

5 Commits

Author SHA1 Message Date
HAL9000 e3212b5f8a fix: reject migrations when prompt fails unexpectedly
CI / build (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 1m30s
CI / quality (pull_request) Successful in 1m35s
CI / typecheck (pull_request) Successful in 1m44s
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 28s
CI / integration_tests (pull_request) Successful in 3m45s
CI / e2e_tests (pull_request) Successful in 3m43s
CI / unit_tests (pull_request) Successful in 4m54s
CI / docker (pull_request) Successful in 1m49s
CI / coverage (pull_request) Successful in 11m27s
CI / benchmark-regression (push) Has been skipped
CI / status-check (pull_request) Successful in 4s
CI / lint (push) Successful in 56s
CI / build (push) Successful in 52s
CI / helm (push) Successful in 40s
CI / quality (push) Successful in 1m14s
CI / push-validation (push) Successful in 33s
CI / security (push) Successful in 1m24s
CI / typecheck (push) Successful in 1m28s
CI / e2e_tests (push) Successful in 5m2s
CI / integration_tests (push) Successful in 5m3s
CI / unit_tests (push) Successful in 6m1s
CI / docker (push) Successful in 1m30s
CI / coverage (push) Successful in 10m52s
CI / benchmark-regression (pull_request) Failing after 27m23s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Successful in 1h16m42s
Handle unexpected exceptions from the interactive migration prompt by
logging the failure and rejecting instead of proceeding.
ISSUES CLOSED: #7503
2026-04-24 19:01:56 +00:00
HAL9000 4beeb747d0 test: add regression for unexpected migration prompt failure
ISSUES CLOSED: #7503
2026-04-24 19:01:56 +00:00
HAL9000 122a9e70a1 chore(ci): remove build artifacts from tracking and add test_reports to .gitignore
Remove test_reports/summary.txt and test_reports/test_results.json from git
tracking as they are build artifacts that should not be committed to the
repository. Add test_reports/ to .gitignore to prevent future accidental
commits of these files.

ISSUES CLOSED: #7503
2026-04-24 19:01:56 +00:00
HAL9000 36dc29b3ec docs(contributors): add HAL 9000 contribution details for migration safety fix 2026-04-24 19:01:56 +00:00
HAL9000 49ed394d11 fix(migration): reject migrations on prompt failure instead of auto-approving
Fixed MigrationRunner._default_prompt_for_migration silently auto-approving
destructive database migrations when the interactive prompt raised any exception.

The bare 'except Exception' handler was swallowing all errors and returning True
(auto-approve), which could apply destructive schema migrations to production
databases without user consent when stdin is broken, typer is unavailable, or
any other prompt failure occurs.

Changes:
- Narrow exception handler from 'except Exception' to 'except (OSError, EOFError)'
  to only catch genuine non-interactive environment signals
- Re-raise KeyboardInterrupt so Ctrl-C always works
- Return False (reject) instead of True (auto-approve) on prompt failure
- Log at WARNING level instead of DEBUG so the rejection is visible
- Non-interactive environments (stdin not a TTY) now also return False by default
- Updated docstring to document the new safe-default behavior
- Added BDD regression tests for all new code paths
- Added TDD feature file tdd_migration_prompt_auto_approve_7503.feature

ISSUES CLOSED: #7503
2026-04-24 19:01:56 +00:00