feat: Add a Checks tab to pull requests

Merged
CH
9d ago
+1787-50

Summary

Pull requests get a fourth tab, Checks (4), after Code. It lists every check grouped by workflow, failing first, with durations. enter opens a GitHub Actions job the way GitHub's job page shows it: steps that open and close, the failed ones already open and scrolled to the last error, numbered lines with errors, warnings and commands marked and the log's own colors, and the runner's groups folded. r re-runs with GitHub's options: failed jobs, this job, or all jobs.

Summary    Timeline    Code    Checks                ✗ 1 of 16 failing

✗  integration-tests (macos-latest)
   Unit and Integration Tests · failed after 59s

  ▸ ✓  Set up job                                                   1s
  ▸ ✓  Check out code                                               2s
▌ ▾ ✗  Set up Go                                                   53s
    1  Warning: Failed to download action
         'https://codeload.github.com/actions/setup-go/tar.gz/b7ad1dad
         31e06c5925ef5d2fc7ad053ef454303e'. Error: nodename nor
         servname provided, or not known (codeload.github.com:443)
    …
    6  Error: Failed to download archive …
  ▸ –  Build executable
  ▸ ✓  Post Check out code                                          1s

↑↓ pick   e open all groups   r re-run   o on GitHub   esc back
  • Data (src/pr.rs): checks keep their workflow, start and end times, and Actions run and job ids, which are read from the details link. job_log reads repos/{repo}/actions/jobs/{id} for the steps and, once the job is done, …/logs. split_log assigns log lines to steps using the runner's step-start lines (##[group]Run …, Post job cleanup., Cleaning up orphan processes) and whole-second step times. A composite action's own groups stay in its step, and a step keeps its last 5,000 lines.
  • View (src/prview.rs): the tab, the job view with ANSI colors and wrapping that breaks at spaces with a hanging indent, the re-run picker, and polling. The PR is read again every 20 s while any check runs, and an open unfinished job every 5 s. After a push or a re-run, an open job follows the check to its new job id.
  • Code tab (src/diffview.rs): 4, → and tab go on to Checks.

Why

Finding out why CI failed meant leaving leaf for the browser, and gh run view --log-failed prints the whole job as one block (often labelled UNKNOWN STEP) that's hard to read in a terminal.

Evidence

  • cargo test: 355 passed, 2 ignored. The new regression tests cover: polling while a check runs and another failed; a group longer than the line limit keeping its end; failed log downloads being retried; composite-action groups staying in their step; a refresh following the check to its new job, or closing the log when the check is gone; a failed step opening the group that holds its last error; logs fitting a 12-column pane.
  • cargo clippy --all-targets: no warnings in the changed files.
  • Manual, in a terminal: cli/cli#15052 (one failed macOS job), crumble-project/android#17 (all passing). Checked the list, opening steps and groups, wrapping at 76 and 110 columns, tab navigation in both directions including from Code, the help screen, the footers, and the re-run picker and confirm prompt (with the write-access check removed temporarily, then cancelled).
  • The job log format was checked against a real …/jobs/{id}/logs response.
  • Not verified live: an actual gh run rerun (no write access to a repo with Actions); a running job's step updates (none was running); logs with ANSI colors.

Risk & Rollback

Reversibility: Reversible

Blast Radius: leaf pr only, plus the Code tab's keys in the diff reviewer.

  • Key changes: in Code, tab and → go to Checks (before, tab went back to Summary and → did nothing). On the Checks tab, r re-runs instead of marking the PR ready, and o opens the picked check instead of the PR.
  • Polling adds gh calls while checks run: one PR read every 20 s, and one job read every 5 s while an unfinished job is open.
  • A log line at a step boundary can still land in the neighbouring step when the runner prints no marker line there.