Skip to content

Name missing observations at migrate's verify steps instead of crashing (#183) - #184

Merged
shipmill-romamo[bot] merged 3 commits into
mainfrom
fix/183-migrate-observations-missing
Oct 30, 2026
Merged

shipmill-romamo[bot] merged 3 commits into
mainfrom
fix/183-migrate-observations-missing

Conversation

@shipmill-romamo

@shipmill-romamo shipmill-romamo Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

cloudfall migrate --yes that reached its audit step on a project with no server observations crashed with HANDLER_CRASHED: _verify_audit and _verify_routes call load_observations, which raises ConfigValidationError (observation_directory_missing) when the observed directory is absent, and the step loop catches only MigrateError and LifecycleError.

Both steps now check the observed directory first (one helper) and raise MigrateError code migrate_observations_missing, whose detail names the missing directory and the command that records observations (cloudfall observe). The run saves its plan and reports the step error like any other step error, so a rerun after observe resumes at that step. A malformed snapshot keeps its current behaviour, and an observed directory that exists but lacks a server's snapshot still reports drift (migrate_audit_drift). verify-routes checks before it probes any domain.

Plan

  • Serves: quality bar
  • Files: sdk/src/cloudfall/migrate.py, sdk/tests/test_migrate.py, sdk/tests/test_owned_postgresql_converge.py (S-006-6's test used the old crash at audit as its stop), changelog.d/183-migrate-observations-missing.md
  • Order: failing CLI test that resumes migrate --yes at audit (and at verify-routes) with no observed directory; then the migrate_observations_missing check in both verify steps; then the changelog fragment
  • Proof: the new tests in sdk/tests/test_migrate.py fail on main with HANDLER_CRASHED and pass with the fix; ruff, mypy, sdk/tests/test_migrate.py and engine/tests pass

Test plan

  • uv run ruff check .
  • uv run mypy
  • uv run pytest sdk/tests/test_migrate.py: the new test_cli_migrate_names_missing_observations_at_the_verify_step[audit|verify-routes] failed on main with HANDLER_CRASHED and passes now. The CLI answers ENGINE_STEP_FAILED (exit 87) with context.code = migrate_observations_missing, as every other step error does through _migration_failure
  • uv run pytest engine/tests
  • uv run pytest sdk/tests/test_owned_postgresql_converge.py: test_s006_6_migrate_records_the_hash_in_its_services_step now asserts the run stops at audit with migrate_observations_missing instead of expecting ConfigValidationError
  • The full suite is left to CI

Fixes #183

🤖 Generated with Claude Code

shipmill-romamo Bot and others added 3 commits October 30, 2026 18:42
cloudfall migrate --yes that reached audit or verify-routes on a project
with no server observations crashed with HANDLER_CRASHED: load_observations
raises ConfigValidationError for a missing directory, and the step loop
catches only MigrateError and LifecycleError. Both steps now check the
observed directory first and raise migrate_observations_missing, naming the
directory and cloudfall observe, so the plan is saved and a rerun after
observe resumes at that step. A malformed snapshot and a server without a
snapshot keep their current behaviour.

Fixes #183

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also put the new test's pending list on one line, as ruff format wants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test used the old ConfigValidationError crash at the audit step as
its stop; the run now returns an error envelope at audit instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shipmill-romamo
shipmill-romamo Bot force-pushed the fix/183-migrate-observations-missing branch from fb0f6d3 to fd85d2b Compare October 30, 2026 16:42
@shipmill-romamo
shipmill-romamo Bot merged commit e8f2121 into main Oct 30, 2026
1 check passed
@shipmill-romamo
shipmill-romamo Bot deleted the fix/183-migrate-observations-missing branch October 30, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate crashes at its audit step with HANDLER_CRASHED when no server observations exist

0 participants