Skip to content

[FIX] Align run status enums in OpenAPI spec with the API - #1241

Closed
kaihere14 wants to merge 1 commit into
CCExtractor:masterfrom
kaihere14:fix/runs-status-spec
Closed

kaihere14 wants to merge 1 commit into
CCExtractor:masterfrom
kaihere14:fix/runs-status-spec

Conversation

@kaihere14

@kaihere14 kaihere14 commented Oct 23, 2026 •

Copy link
Copy Markdown

Problem

The RunStatus query parameter on GET /runs advertised
[queued, running, pass, fail, canceled, incomplete] with example: pass,
but list_runs() (mod_api/routes/runs.py) only accepts queued, running
and canceled. Any client following the spec, including the spec's own
example, got a 400 for status=pass, fail or incomplete.

Separately, Run.status and RunSummary.status did not list error, even
though the API returns it (_check_completed_run_status in
mod_api/services/status.py) and RunSchema already allows it.

Why the spec, not the code

pass, fail, error and incomplete are not stored in the database by
design. They are computed per request from every sample's TestResult rows
once a run has completed, so they cannot be expressed as a SQL filter without
deriving status for every run before pagination. Only the statuses that map
directly to the latest TestProgress row can be filtered on.

Changes (openapi-ci-api.yaml only)

  • components/parameters/RunStatus: enum narrowed to [queued, running, canceled],
    example changed to running, and the description explains why outcome
    statuses cannot be filtered on.
  • components/schemas/Run.status: added error, with a note on when it is returned.
  • components/schemas/RunSummary.status: added error.

No code changes. The spec still validates with openapi-spec-validator.

GET /runs only filters on statuses that map directly to the latest
TestProgress row (queued, running, canceled). pass, fail, error and
incomplete are not stored in the database: they are computed per
request from every sample's TestResult rows once a run completes, so
they cannot be used as a query filter. The RunStatus parameter
advertised all six values (with example: pass), so spec-conforming
clients got a 400. Narrow the enum and document why.

Run.status and RunSummary.status were missing "error", which the API
already returns when a completed run reported no results or fewer
samples than configured. Add it to both enums.
@kaihere14
kaihere14 force-pushed the fix/runs-status-spec branch from bd0e2b6 to 5fb003b Compare October 23, 2026 19:37
@sonarqubecloud

Copy link
Copy Markdown

@kaihere14 kaihere14 closed this Oct 23, 2026
@kaihere14
kaihere14 deleted the fix/runs-status-spec branch October 23, 2026 19:38
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.

1 participant