fleet-status: compute the lanes for fork PRs - #133
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.
Approved at 5bfdecd.
The change lets fleet-status.mjs compute both lanes for a fork PR instead of refusing it: fleet/verify becomes the base branch's required checks at the head (never the label and comment, per !fork in laneStatuses), and fleet/review is the reviewer verdict at the head without the verification hold. The job's if: admits a fork head only on issue_comment and workflow_run, which run the default branch's workflow with a write token, and the relay workflow turns a fork review into a workflow_run while carrying permissions: {} and no uses: or checkout. The fork branch name and repo reach the script as environment variables, not interpolated into the run: line, and the branch is encodeURIComponent-ed into the head=owner:branch query with the repository re-checked in prsFromHead since that filter matches only the owner. A deleted fork (head.repo null) still classifies as a fork.
The tests cover the cases that matter: fork approved at head with CI green, changes requested while CI runs, no required checks with the operator description, label plus comment not verifying a fork, the CLI's head-branch lookup rejecting a same-named branch in another of the owner's repos, and the job's if: evaluated per event against the workflow file, including that the relay's completion on a same-repo PR does not re-run the job. Each of those fails on the base script or workflow.
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.