Conversation
Contributor
Greptile OverviewGreptile SummaryThis PR introduces REST APIs for managing OpenSearch migration settings. It adds three database helper functions in Key changes:
The implementation is clean, follows existing code patterns, uses proper authentication, and includes thorough test coverage. All endpoints are admin-protected via Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Admin as Admin User
participant API as FastAPI Router
participant DB as Database Layer
participant PG as PostgreSQL
Note over Admin,PG: GET /admin/opensearch-migration/status
Admin->>API: GET /status (with auth)
API->>API: Verify current_admin_user
API->>DB: get_opensearch_migration_state(db_session)
DB->>PG: Query OpenSearchTenantMigrationRecord
PG-->>DB: Return record or None
DB-->>API: (total_chunks, created_at, completed_at)
API-->>Admin: OpenSearchMigrationStatusResponse
Note over Admin,PG: GET /admin/opensearch-migration/retrieval
Admin->>API: GET /retrieval (with auth)
API->>API: Verify current_admin_user
API->>DB: get_opensearch_retrieval_state(db_session)
DB->>PG: Query OpenSearchTenantMigrationRecord
PG-->>DB: Return record or None
DB-->>API: enable_opensearch_retrieval (bool)
API-->>Admin: OpenSearchRetrievalStatusResponse
Note over Admin,PG: PUT /admin/opensearch-migration/retrieval
Admin->>API: PUT /retrieval (with auth + payload)
API->>API: Verify current_admin_user
API->>DB: set_enable_opensearch_retrieval_with_commit()
DB->>DB: try_insert_opensearch_tenant_migration_record_with_commit()
DB->>PG: INSERT record if not exists
PG-->>DB: Record exists
DB->>PG: UPDATE enable_opensearch_retrieval
DB->>PG: COMMIT
PG-->>DB: Success
DB-->>API: void
API-->>Admin: OpenSearchRetrievalStatusResponse
|
evan-onyx
approved these changes
Feb 12, 2026
|
|
||
| def get_opensearch_migration_state( | ||
| db_session: Session, | ||
| ) -> tuple[int, datetime | None, datetime | None]: |
Contributor
|
Preview Deployment
|
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.
Description
This PR introduces REST APIs for getting migration and retrieval settings, and for setting retrieval settings.
How Has This Been Tested?
Approve this PR now and I'll throw in an integration test file for free.
Additional Options
Summary by cubic
Adds admin REST APIs to read OpenSearch migration status and toggle OpenSearch retrieval. Router is wired into the app; integration tests cover defaults, persistence, and admin auth.
Written for commit 2da70b0. Summary will update on new commits.