5 cli restore#9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an interactive backup/restore CLI and enhances the core backup/restore logic for Azure Table Storage snapshots (EDM-tagged serialization, pruning strategy updates, restore fidelity via table clearing). It also adds a manual HTTP-triggered backup route to the Azure Functions app and updates dev tooling configuration/dependencies.
Changes:
- Introduces
backup/cli.pyinteractive workflow for selecting/triggering backup and restore, including snapshot resolution/downloading. - Updates
backup/core.pyto write EDM-tagged snapshots, validate uploads, prune with daily+monthly retention, and restore by clearing the target table before upserting. - Adjusts tests and project tooling (ruff/pytest config, dev dependency additions, local snapshot gitignore).
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
backup/core.py |
Adds EDM-tagged serialization/deserialization, validation, pruning policy, and fidelity-focused restore. |
backup/cli.py |
New interactive CLI for backup/restore orchestration and snapshot download/selection. |
function_app.py |
Adds dev-backup HTTP route for manual triggering. |
tests/test_core.py |
Updates/extends unit tests for new tagging/pruning/restore behaviors. |
pyproject.toml |
Adds dev dependency and adjusts ruff/pytest configuration. |
uv.lock |
Locks new dev dependency transitive graph. |
.gitignore |
Ignores locally-downloaded snapshots/status artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…backup into 5-cli-restore
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hey Eirini @ai-mindset, Please advise, if you can, what I might need to do differently to make this work. |
…ses on Windows too This test failed on Windows. I believe the reason for it is a Windows/Linux/macOS difference in mocking. The dotted-string patch likely isn't finding the right reference on Windows.
…backup into 5-cli-restore
@francisbarton sorry for the lag, I wanted to find a bit of time to think about this. I believe the reason this specific test fails for you but not for me is a Windows/Linux/macOS difference in mocking. The dotted-string patch |
- Fix mock patching for Windows compatibility (use patch.object for imported functions in main()) - Add missing _confirm side_effect for restore confirmation prompt - Refactor nested test patch into decorator, fix signature mismatch - Add MODEL_RUNS_TABLE_NAME to env patches matching _get_restore_target() - Remove superseded EDM type roundtrip test (covered by end-to-end test) - Add requirements.txt, deployment docs, and status.json updates
Closes #5
Introduces an interactive backup and restore CLI, along with improvements to the backup/restore core logic. The changes enhance backup validation, snapshot pruning, type-safe serialization, and restore fidelity. The CLI allows users to select source/target tables and specific snapshots, and the backup system now supports tagged EDM types for reliable round-tripping. Additionally, the Azure Functions app gains a manual dev backup endpoint, and developer tooling is improved.
CLI test coverage has been added in
tests/test_cli.py(25 tests) covering_confirm,_find_snapshots,_resolve_snapshot,_download_snapshot, andmain()— including the confirm/abort flow, snapshot resolution paths, and safe filename generation.After starting the HTTP triggered Function locally with
func start:The Function completed successfully:
Due to insufficient rights, I'm not able to deploy the Function on Azure or create a clean Azure Function App with a separate resource group and storage account currently 🚧