Bump FastAPI to 0.131.0 and add explicit API response models#13
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae73a01458
ℹ️ 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".
|
|
||
|
|
||
| class IndexVersionResponse(BaseModel): | ||
| version: int |
There was a problem hiding this comment.
Align index version type with persisted string IDs
IndexVersionResponse.version is declared as int, but IndexBuild.version is persisted as str in shared/models/orm.py and generated as non-numeric IDs like v20260223-... in activities/indexing/faiss_manager.py; when /jobs/indexes/versions builds IndexVersionResponse(version=b.version, ...), Pydantic validation will fail as soon as any index build exists, turning this endpoint into a 500 instead of returning version data.
Useful? React with 👍 / 👎.
ae73a01 to
4415d22
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4415d223a7
ℹ️ 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".
| embed_model: str | ||
| index_type: str | ||
| num_vectors: int | ||
| dimension: int |
There was a problem hiding this comment.
Permit nullable index metadata in versions response
IndexVersionResponse now requires embed_model, index_type, num_vectors, and dimension, but IndexBuild persists all four as nullable columns (shared/models/orm.py), so /jobs/indexes/versions will raise a Pydantic validation error and return 500 whenever a historical or partially populated index_builds row has any NULL in those fields. The previous untyped dict response handled these values, so this change introduces a data-dependent regression for valid persisted records.
Useful? React with 👍 / 👎.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
0afd93d to
13a39a2
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Motivation
0.131.0to pick up improved JSON response performance and align with the custom-response guidance.response_modeland concrete return types on endpoints to make serialization behavior explicit and take advantage of FastAPI optimizations.Description
fastapi[standard]floor inbackend-api/pyproject.tomlto>=0.131.0.api.models.healthwithHealthResponse,IndexVersionResponse, andIndexVersionsResponsePydantic models and exported them fromapi.models.__init__.@router.get("/live", response_model=HealthResponse)and to return a concreteHealthResponsewhile setting the dynamic HTTP status via theResponseobject.GET /jobs/indexes/versionsto declareresponse_model=IndexVersionsResponse, return typedIndexVersionResponseobjects, and use a concrete return type instead of an untypeddict.Testing
backend-api/.venv/bin/ruff check src/api/main.py src/api/routers/health.py src/api/routers/jobs.py src/api/models/health.py src/api/models/__init__.pyand it passed.backend-api/.venv/bin/pytest tests/api/test_jobs_api.py tests/api/test_search_api.py -qand all tests passed (10 passed).uv lock --upgrade-package fastapibut it failed due to external package index connectivity/tunnel errors in this environment.Codex Task