Skip to content

feat: add health status route in backend for users#90

Merged
amandazhuyilan merged 3 commits into
mainfrom
SBP-406-health-check-status-for-users
Jun 26, 2026
Merged

feat: add health status route in backend for users#90
amandazhuyilan merged 3 commits into
mainfrom
SBP-406-health-check-status-for-users

Conversation

@amandazhuyilan

@amandazhuyilan amandazhuyilan commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

SBP-406: Surfaces a coarse health signal to SBP-bundle users on the job details page, so they know when job status/logs may be stale or submissions slow.

Changes

  • New route GET /api/health/components, gated to SBP-bundle approved users (same gate as workflow submission)
  • Returns a single overallStatus + generic message — does not identify which component is affected message is null when healthy, otherwise a generic "services unavailable, data may be stale" notice
  • Reuses the existing health service (probes seqera_api, seqera_compute_env, seqera_tower_agent); overallStatus = worst of the three
  • Added stale-while-revalidate caching: expired-cache reads return the last result instantly and refresh in the background, so users never block on the ~2s probes (only a cold start blocks)
  • Force-refresh is admin-only (/admin/api/system-status); the user-facing endpoint always serves from cache
  • Added ComponentsHealthResponse schema + to_components_health_dict() projection

Status meanings

  • healthy — all components reachable & operational (Seqera API 2xx, compute env AVAILABLE); no message shown
  • degraded — slow/provisioning but not failed (e.g. compute env CREATING, or unknown state); warning shown
  • unhealthy — a component is down/failing (Seqera API non-2xx/timeout/bad token, or compute env ERRORED/OFFLINE/INVALID); warning shown

How to Test

All CI tests shall pass!

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added or updated documentation where necessary
  • I have run linting and unit tests locally
  • The code follows the project's style guidelines

@marius-mather marius-mather left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good but I'm not sure if we want to allow the force-refresh on the user-facing API, seems safer to keep that admin only unless there's a definite need for it

Comment thread app/routes/health.py Outdated

@vtnphan vtnphan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@amandazhuyilan amandazhuyilan merged commit 5c2c50c into main Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants