service@1 DB migration capability (Team Deployments Phase 2A) [draft] - #1083
service@1 DB migration capability (Team Deployments Phase 2A) [draft]#1083Koh0920 wants to merge 1 commit into
Conversation
… grammar) Add an optional `[contracts."service@1".migrations]` capability to `ContractSpec` (ato#1071 §4 `state_migration_capability`; phase2a RFC §1.2). A provider advertises `enabled`/`format`/`tracking_table`; the field is `Option<_>` with serde defaults so every existing manifest deserializes unchanged. The dependency orchestrator (`start_one`) now, when a provider's contract advertises the capability AND the plan supplies a migrations source for the dep, injects `ATO_MIGRATIONS_DIR` / `ATO_MIGRATIONS_TRACKING_TABLE` / `ATO_MIGRATIONS_FORMAT` into the provider process. The provider owns the SQL; no psql/postgres logic lives in the CLI. Migrations apply in the provider's pre-readiness window, so a failure keeps the provider from becoming ready and the dependent app never starts (fail-closed). Providers without the capability get no extra env and are unaffected. `migration_sources` is threaded through `OrchestratorInput`; the run pipeline populates it from the consumer capsule's conventional `migrations/` directory (convention over new `[dependencies.*]` grammar — ato#1071 §4). Tests: grammar serde-default parsing (present/absent/explicit) and `migration_provider_env` gating (none without capability, none when disabled, none without source, present when advertised + sourced).
Automated review (Claude Code)Verdict: changes-requested (direction is sound; base branch + two correctness gaps must be settled before it leaves draft) What it does Findings
Checked and clean (worth stating, since these are the usual suspects here): adding the block does not move any recorded digest. Staleness/mergeability |
DB migration capability (service@1)
Scope: Add an app-schema migration capability to the
service@1dependency contract (ato#1071 §4state_migration_capability) — NOT new[dependencies.*]manifest grammar. The orchestrator drives migrations via the provider; the CLI bakes no SQL logic.Base branch:
mainDependent PR: pairs with the ato-postgres migration-runner hook PR.
Changed migrations: n/a (Rust).
Security boundary: fail-closed — a migration failure makes
wait_for_readyfail, sostart_onereturns Err and the dependent app never starts.Test commands and results:
cargo build -p capsule -p clifinished;cargo test -p capsule --lib migration3/3,--lib contract226/226 (existing manifests parse unchanged);cargo test -p cli --lib migration6/6;cargo clippy -p capsule -p cli --all-targets -- -D warningsclean. Fullcargo test --workspace+cargo clippy --workspaceis a pre-merge gate (running/CI).Staging verification: n/a (runner-side; validated with the ato-postgres provider).
Known limitations: single consumer
migrations/dir maps to every db-capable provider (fine for single-DB Phase 2A); a migration failure surfaces as a readiness timeout (specific error in redacted provider logs).Not yet proven: end-to-end migration apply against a live ato-postgres deployment on a runner.
Production deployment status: n/a (client/runner binary).
Common status (Phase 2A, ato#1073)
8caf3e940109–0115(applied toato-store-db-stg)tsccleanDraft — do not merge until full
cargo test --workspaceCI and the live-runner durable-volume E2E pass. ato-api/ato-pwamainmerges auto-deploy production; hold until explicit production approval.Phase 2A PR set (9 PRs)
ato app latest#2 — migration runner + __ato_migrations hook