Health route#242
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a health check endpoint for the Qualibrate application to monitor system health and version compatibility between frontend, backend, and runner components.
- Adds a new
/healthendpoint that returns version information and runner status validation - Creates utility functions for validating runner version compatibility against the app version
- Restructures the root ping endpoint by moving it to a dedicated "other" routes module
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/qualibrate_app/api/routes/other.py | New module containing ping and health endpoints with version validation logic |
| backend/qualibrate_app/api/routes/init.py | Exports the new other_router and updates all list |
| backend/qualibrate_app/api/core/utils/runner.py | New utility module for runner version validation and status checking |
| backend/qualibrate_app/api/core/schemas/state_updates.py | Adds Pydantic models for health check response and runner status |
| backend/qualibrate_app/api/main.py | Moves ping endpoint to other_router and includes the new router |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| APP2RUNNER_VERSIONS: dict[Version, tuple[Version, Version]] = { | ||
| Version("0.3.6"): (Version("0.3.6"), Version("0.4.0")), | ||
| } | ||
|
|
There was a problem hiding this comment.
Why add it here? Let's at least add it somewhere top-level. I don't want to have to change it here every time
There was a problem hiding this comment.
Or are there smarter ways to do this automatically?
There was a problem hiding this comment.
I described you this way. And you approved.
There is no way to do it automatically. You must define dependency matching manually.
What do you mean with Let's at least add it somewhere top-level. What is top-level in your meaning?
There was a problem hiding this comment.
As in, currently, whenever I release a new version, I have to navigate to backend/qualibrate_app/api/core/utils/runner.py just to change the versions. We should think about any improved ways of doing this
There was a problem hiding this comment.
For example, we can add custom fields to pyproject.toml
There was a problem hiding this comment.
Got you. We can't use pyproject.toml because distribution versions won't have it.
But we can add top-level python (or other type if we want) file that defines ranges. Preferences?
There was a problem hiding this comment.
Moved to backend/qualibrate_app/versions_matching.py
| class HealthCheck(BaseModel): | ||
| frontend_version: str | ||
| backend_version: str | ||
| runners_status: list[RunnerVersionValid] |
There was a problem hiding this comment.
why multiple runners?
There was a problem hiding this comment.
because you described possibility in future
There was a problem hiding this comment.
I should clarify: QUAlibrate-app can connect to multiple runners, but this is w.r.t. different projects. For a given project, there will be a single runner
|
@maxim Dobrokhvalov can you add schema to the top description? |
Added response schema and example. |
QUAL-1507
Response:
Schema
Example:
{ "frontend_version": "0.4.0", "backend_version": "0.4.0", "is_valid": true, "runners_status": { "url": "http://localhost:8001/execution/", "version": "0.4.0", "is_valid": true } }