-
Couldn't load subscription status.
- Fork 11
[Persistence]: Backend implementation #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Persistence]: Backend implementation #1211
Conversation
701a415 to
bcb6c6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The endpoints needed for the management modal are there, but they appear to be outdated, so you might have been looking at the wrong branch
Correct branch here
backend_py/primary/primary/persistence/cosmosdb/cosmos_database.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/cosmosdb/query_collation_options.py
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the backend persistence layer for sessions, snapshots, and snapshot access logs using Azure Cosmos DB. It establishes database infrastructure, data stores with CRUD operations, and REST API endpoints supporting pagination, sorting, and filtering. The implementation includes CosmosDB emulator configuration for local development and proper error handling throughout the persistence layer.
Key changes:
- Added Cosmos DB emulator as a Docker container with health checks and automatic database setup
- Implemented data stores for sessions, snapshots, and snapshot access logs with comprehensive query capabilities
- Created REST API routers exposing persistence operations with proper authentication and background task support
Reviewed Changes
Copilot reviewed 29 out of 35 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| docker-compose.yml | Added CosmosDB emulator service with health checks and startup dependencies |
| backend_py/primary/pyproject.toml | Added azure-cosmos, aiohttp, and nanoid dependencies |
| backend_py/primary/primary/config.py | Added Cosmos DB connection configuration |
| backend_py/primary/primary/main.py | Integrated persistence router and database setup |
| backend_py/primary/primary/services/service_exceptions.py | Added DATABASE service type |
| backend_py/primary/primary/persistence/setup_local_database.py | Implemented local database initialization |
| backend_py/primary/primary/persistence/cosmosdb/*.py | Core database abstraction layer |
| backend_py/primary/primary/persistence/_store/.py | Store implementations for sessions, snapshots, and access logs |
| backend_py/primary/primary/routers/persistence/*.py | REST API endpoints for persistence operations |
| frontend/src/api/autogen/*.ts | Auto-generated API client code |
| frontend/src/modules/ModuleSerializedStateMap.ts | File deleted (auto-generated) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
backend_py/primary/primary/persistence/cosmosdb/cosmos_container.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/tasks/mark_logs_deleted_task.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 29 out of 35 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More or less good to go.
Approved with a few questions/suggestions
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/session_store/session_store.py
Outdated
Show resolved
Hide resolved
backend_py/primary/primary/persistence/snapshot_store/snapshot_access_log_store.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Noted one very tiny thing, but I'll approve regardles
Adding:
Changing: