Repository navigation
fix(deploy): confirm fleet adoption before post-upload migrations - #217
Merged
Merged
Conversation
- After the upload publishes deploy/current.json, an awake fleet only adopts it on its pointer poll (~30 s), so cello d1 ran against the old generation (no __D1Database class) and failed with RestoreFailed. - For AfterUpload orders, POST /reload (synchronous; block up to 60 s) and require the reported version to match the uploaded one before running cello d1. Stale or refused generations fail the migrate step without applying; unreachable fleets fail only when a fleet manager exists, preserving the operator CLI first-deploy path. - The gate runs only when migrations will actually apply: all early skips return before any fleet contact. - Tests: fake fleet listener asserting reload-before-apply order, stale-version refusal with no apply, unreachable-fleet fallback, and reload timeout. Docs: agents/deploy/pipeline.md, agents/backend/database.md.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: a deploy that newly declares a D1 database failed. AfterUpload orders run cello_migrate right after the upload (pipeline.rs run_steps), but the fleet only adopts the new generation on its pointer poll (~30 s, cello generation.rs poll_interval; Outer nudges with POST /reload in fleet/supervisor.rs). So d1 migrations apply ran against the OLD generation, which has no __D1Database class, and failed with RestoreFailed.
Mechanism: cello's POST /reload adopts synchronously and reports the outcome (internal_reload in cello main.rs: 200 {ok, outcome: adopted|unchanged, generation, version}, 422 {ok:false, outcome:failed, error}). The new confirm_adoption gate runs after the wake inside migrate(), only for AfterUpload orders and only when migrations will actually apply (all early skips return before any fleet contact, so no-migration deploys are untouched). It POSTs /reload with min(step_timeout, 60 s) and requires the reported version to match the uploaded deployment version before cello d1 runs. A stale or refusing fleet fails the migrate step with 'fleet still serves version X, expected Y; migrations not applied' (apply never runs); an unreachable fleet fails only when a fleet manager exists, preserving the operator CLI first-deploy lease hint.
Timeout: 60 s bound (ADOPTION_TIMEOUT), effective timeout is min(step_timeout, 60 s). The POST blocks while the node builds the new generation.
Checks: cargo fmt --all --check, cargo clippy --all-targets --locked -- -D warnings, cargo test deploy:: fleet:: (168 passed), blume build --isolated + validate. New tests: migrate_waits_for_adoption_after_upload, migrate_refuses_a_stale_generation_after_upload, migrate_without_a_reachable_fleet_still_applies_after_upload, reload_report_times_out_against_a_hanging_fleet.