Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ic-sdk into feat/migrations-api
There was a problem hiding this comment.
Pull request overview
Adds first-class site migration support to the Atomic SDK by introducing migrations/response-ticket API clients, new migration-related models, wiring the clients into AtomicClient, and providing step-by-step migration example scripts and documentation.
Changes:
- Add
MigrationsClientandResponseTicketsClientAPI wrappers and register them onAtomicClient. - Introduce migration/response-ticket Pydantic models for parsing API responses.
- Add end-to-end migration example scripts and document the workflow in
examples/README.md.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
atomic_sdk/api/migrations.py |
New migrations API client (create/get/update/preflight/ready). |
atomic_sdk/api/response_tickets.py |
New response ticket client for monitoring async operations. |
atomic_sdk/client.py |
Registers migrations and response_tickets on AtomicClient. |
atomic_sdk/models.py |
Adds MigrationCreationResponse, ResponseTicket, and Migration models. |
examples/migrations/01_prepare_destination_site.py |
Creates a migration-ready destination site (example). |
examples/migrations/02_create_migration_with_new_key.py |
Creates migration + attempts SSH key install (example). |
examples/migrations/03_run_preflight_and_monitor.py |
Runs preflight and polls migration state (example). |
examples/migrations/04_start_migration_and_monitor.py |
Sets migration ready and polls migration state (example). |
examples/README.md |
Documents the new migration example workflow and prerequisites. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add bounded timeout + monotonic deadline to example poll loops - Fetch response_tickets.get_full() on failure/timeout for diagnostics (matches what the docstrings claimed) - Print the preflight response-ticket id (use the previously-unused ticket var) - Fix ticket_id annotation: int -> str to match ResponseTicket.response_ticket_id - Only log state transitions, not every poll tick - models: switch Migration/ResponseTicket/MigrationCreationResponse to pydantic v2 ConfigDict (consistency with Task model) - ex/02: pipe public key via stdin & drop shell=True to eliminate quoting / command-injection risk in the example - ex/03 & ex/04: print actionable error when ATOMIC_API_KEY/CLIENT_ID is missing instead of silently returning
|
@codex Please review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 124c12f62e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- sites.allow_ssh_migration(site_id|domain): one-way consent gate marking
a destination site as willing to accept an incoming SSH migration.
Destructive — the destination's files and DB are overwritten when the
migration runs. Returns {ready_for_migration: bool}.
- ssh.get_user(username): reverse lookup; given a username returns the
owning site_id plus created/last_updated timestamps. Inverse of
list_users(site).
Both wrap single documented endpoints. No Pydantic models (consistent
with edge_cache/ssh/cron/custom_certificates). No changes to client.py.
README's Supported resources updated. Examples added under sites/ and
ssh/ with a typed-confirmation gate on the destructive one.
There was a problem hiding this comment.
Pull request overview
Adds SDK support for WP.Cloud site migration workflows by introducing new API clients/models and providing end-to-end example scripts and documentation updates.
Changes:
- Introduces
MigrationsClientandResponseTicketsClientand wires them intoAtomicClient. - Adds Pydantic models to represent migration create responses, migrations, and response tickets.
- Adds/updates example scripts + docs to guide users through destination prep, migration creation, preflight, and execution/monitoring.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/ssh/06_lookup_ssh_user.py | New example for reverse-lookup of SSH/SFTP users by username. |
| examples/sites/08_allow_ssh_migration.py | New example for one-way migration consent gate on destination sites. |
| examples/migrations/01_prepare_destination_site.py | Creates a migration-ready destination site and polls the creation job. |
| examples/migrations/02_create_migration_with_new_key.py | Creates a migration, retrieves a public key, and attempts SSH auto-install; stores migration id. |
| examples/migrations/03_run_preflight_and_monitor.py | Runs migration preflight and monitors state until terminal outcome. |
| examples/migrations/04_start_migration_and_monitor.py | Marks migration ready and monitors state until terminal outcome. |
| examples/README.md | Documents the migration workflow examples and prerequisites. |
| atomic_sdk/models.py | Adds migration/response-ticket models. |
| atomic_sdk/client.py | Registers migrations and response_tickets on AtomicClient. |
| atomic_sdk/api/ssh.py | Adds SSHClient.get_user() reverse-lookup endpoint wrapper. |
| atomic_sdk/api/sites.py | Adds SitesClient.allow_ssh_migration() consent gate endpoint wrapper. |
| atomic_sdk/api/response_tickets.py | New client for retrieving response ticket summary/full details. |
| atomic_sdk/api/migrations.py | New client for create/get/update/preflight/ready migration operations. |
| README.md | Updates top-level README to mention new migration/SSH features. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ex/02: print explicit env-var error instead of silent return; matches ex/03 and ex/04 patterns. - models.Migration: type created/updated as datetime (was str). Brings Migration in line with Task and Backup; Pydantic v2 handles ISO 8601 parsing.
migration.mp4
This pull request introduces full support for site migration operations in the SDK, including new API clients, models, and example scripts for end-to-end migration workflows. The most significant changes are the addition of migration and response ticket functionality, integration into the main
AtomicClient, and comprehensive examples to guide users through migration steps.Migration and Response Ticket API Support:
MigrationsClientinatomic_sdk/api/migrations.pyto manage site migrations, including methods to create, get, update, run preflight checks, and set migrations as ready.ResponseTicketsClientinatomic_sdk/api/response_tickets.pyto monitor asynchronous operations like migrations, with methods to fetch summary and full details of response tickets.Model Additions for Migration Workflow:
atomic_sdk/models.pyfor migration operations:MigrationCreationResponse,ResponseTicket, andMigration, supporting response parsing and property access for migration details.SDK Integration:
migrationsandresponse_tickets) as properties ofAtomicClient, making them available for all SDK users. [1] [2]End-to-End Migration Examples:
examples/migrations/, demonstrating how to prepare a destination site, create a migration and install the SSH key, run preflight checks, and start/monitor the migration. [1] [2] [3]examples/README.mdto document the new migration workflow, prerequisites, and step-by-step instructions for users.