fj run list: filter by --status/--branch/--event/--workflow #138

Closed
opened 2026-06-11 00:57:41 +00:00 by stephen · 0 comments
Owner

Task

Add filters to fj run list, which today takes only --limit:

  • Add --status <queued|in_progress|success|failure|cancelled|...>, --branch <name>, --event <name>, and --workflow <file>.
  • Apply them client-side over the fetched rows for consistent behavior across Forgejo schema variants; use server-side query params on actions/runs as an optimization where present, but do not depend on them for correctness.
  • Filters compose with --json and -L.

Source: rasterstate/fj#128.

Priority

p2. "Did the last run on this branch pass, and what was its number?" is the everyday automation query, and locating "the latest failed run on main" or "the most recent run of ci.yml" is how scripts feed fj run view --log-failed. One notch below the p1 CI primitives because over-fetching -L 50 + jq is a working (if wasteful and truncation-prone) fallback.

Reason

list_runs sends only page + limit (src/api/workflow_run.rs:57) and the CLI ListArgs exposes only -L/--limit and --json (src/cli/workflow_run.rs:37-47). The WorkflowRun struct already carries every field needed to filter (status, conclusion, head_branch, workflow_id, created_at) at src/api/workflow_run.rs:15-46, so the data is in hand; only the selection is missing. The 50-row clamp also means a busy repo can push the wanted run off the page entirely without server- or client-side filtering.

Acceptance

  • fj run list --status failure, --branch <name>, --event <name>, --workflow <file> each filter the listing.
  • Filters combine and compose with --json and -L.
  • Filtering is correct client-side regardless of whether the server honors the query params.
  • Wiremock coverage in src/client/integration_tests.rs for each filter and a combination.
  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all pass.

Dependencies

None. Independent of the truncation/pagination work (rasterstate/fj#107 / #111), which addressed how many rows, not which. Enables the run resolution in rasterstate/fj#129.

Size

M

## Task Add filters to `fj run list`, which today takes only `--limit`: - Add `--status <queued|in_progress|success|failure|cancelled|...>`, `--branch <name>`, `--event <name>`, and `--workflow <file>`. - Apply them client-side over the fetched rows for consistent behavior across Forgejo schema variants; use server-side query params on `actions/runs` as an optimization where present, but do not depend on them for correctness. - Filters compose with `--json` and `-L`. Source: rasterstate/fj#128. ## Priority p2. "Did the last run on this branch pass, and what was its number?" is the everyday automation query, and locating "the latest failed run on main" or "the most recent run of ci.yml" is how scripts feed `fj run view --log-failed`. One notch below the p1 CI primitives because over-fetching `-L 50` + `jq` is a working (if wasteful and truncation-prone) fallback. ## Reason `list_runs` sends only `page` + `limit` (`src/api/workflow_run.rs:57`) and the CLI `ListArgs` exposes only `-L/--limit` and `--json` (`src/cli/workflow_run.rs:37-47`). The `WorkflowRun` struct already carries every field needed to filter (`status`, `conclusion`, `head_branch`, `workflow_id`, `created_at`) at `src/api/workflow_run.rs:15-46`, so the data is in hand; only the selection is missing. The 50-row clamp also means a busy repo can push the wanted run off the page entirely without server- or client-side filtering. ## Acceptance - [ ] `fj run list --status failure`, `--branch <name>`, `--event <name>`, `--workflow <file>` each filter the listing. - [ ] Filters combine and compose with `--json` and `-L`. - [ ] Filtering is correct client-side regardless of whether the server honors the query params. - [ ] Wiremock coverage in `src/client/integration_tests.rs` for each filter and a combination. - [ ] `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all` pass. ## Dependencies None. Independent of the truncation/pagination work (rasterstate/fj#107 / #111), which addressed how many rows, not which. Enables the run resolution in rasterstate/fj#129. ## Size M
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#138
No description provided.