fleet-status: compute the lanes for fork PRs - #102
Conversation
Fork PRs could never get fleet/verify or fleet/review, both required checks: the job skipped a fork head on every event and the script refused one. Redline now reviews fork PRs, so an outside contributor's PR that Redline approved and whose required CI passed stayed blocked. - fleet/review on a fork is Redline's verdict at the head (approved is success, changes requested is failure, none is pending), not held for verification. - fleet/verify on a fork is the base branch's required checks passing at the head. Where none are required it stays pending: the operator verifies and merges. The label and verification comment never verify a fork. - The job runs for a fork only on issue_comment and workflow_run, which run the default branch's workflow with a write token. A fork's pull_request and pull_request_review events run the PR merge ref's workflow with a read-only token, so they stay excluded. The new Fleet review relay workflow turns a fork review into a workflow_run. A fork's workflow_run lists no PRs, so the script finds them by head repo and branch. - No step checks out or runs PR head code; the script only calls the REST API.
sprayberry-redline
left a comment
There was a problem hiding this comment.
Approve.
The change lets a fork PR earn both fleet lanes without any step touching fork code: the status job runs for a fork only on issue_comment and on workflow_run completions (a fork's CI, or the new no-permission relay that turns a pull_request_review into a workflow_run), the script resolves the PR from HEAD_REPO/HEAD_BRANCH because a fork's workflow_run lists no pull requests, and laneStatuses treats a fork as verified only by required CI at the head while letting Redline's verdict stand ungated. I traced the if: against each event shape (fork pull_request and pull_request_review excluded, same-repo relay completion excluded so it does not double-run, fork CI and relay completions included) and the laneStatuses branches against the base version; the same-repo paths are unchanged and the new tests fail on the base (prsFromHead is not exported there and the fork verify description falls through to the Breaker text).
Minor, non-blocking: a workflow_run from a deleted fork carries head_repository: null, so null != github.repository runs the job with empty HEAD_REPO and PR, and the script exits 2. That is a failed run on the default branch only, attached to no PR, so it is noise rather than a wrong status; a github.event.workflow_run.head_repository != null term in the fork clause would silence it.
Problem
fleet/verify and fleet/review are required checks, and a fork PR could never get either one. The status job skipped a fork head on every event, and the script refused a fork ("the fleet does not review it"). Redline now reviews fork PRs, so an outside contributor's PR that Redline approved and whose required CI passed stayed blocked with no way through.
Rule for a fork PR
Which events run for a fork, and the safety invariant
Tests
The fleet-status test covers a fork approved at head with required CI green (both success), changes requested (review failure), no required checks (verify pending with the operator description), CLI runs against a stubbed GitHub (PR number and head-branch lookup), the job's
if:evaluated per event (a fork's pull_request and pull_request_review do not run it; a fork's workflow_run and a PR comment do), and same-repo behavior unchanged. The new cases fail against the default branch's script and workflows. actionlint is clean.