Add status filtering to the runs endpoint#481
Open
Aryan95614 wants to merge 1 commit into
Open
Conversation
GET /flows/{flow_id}/runs now takes a status query parameter
(running/completed/failed), repeatable to match more than one.
Status is derived from the run's end-attempt metadata, reusing the
same definition the UI backend serves so the two agree. It is applied
as a WHERE predicate over the existing query path, so it composes with
limit/offset rather than replacing it; the join is only enabled when a
status filter is present, leaving the plain listing untouched. Unknown
status values are rejected with a 400.
b531509 to
dc6bf42
Compare
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.
Adds a
statusquery parameter toGET /flows/{flow_id}/runsso a run listing can be filtered to running / completed / failed without pulling every row and filtering client-side. The parameter is repeatable (?status=running&status=failed) to match more than one status; unknown values return 400.Status is derived from the run's end-attempt metadata using the same definition
ui_backend_servicealready serves, so the two agree. It is applied as aWHEREpredicate over the existing query path, and the joins are only enabled when a status filter is present, so the plain listing is unchanged. Because the predicate lives in theWHERE, it composes withlimit/offsetinstead of replacing them — a filtered page is the matching rows taken after filtering.Tested against real Postgres: status classification (completed wins over a live heartbeat, explicit
attempt_ok=false, stale heartbeat, running), repeated-param OR, the 400 path, and that the filter composes with a limited page.Known test-coverage gap: the failed-then-retrying -> running branch isn't covered yet (needs deterministic metadata timestamps in the test helper).