You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR enrichment uses gh pr list --json number,headRefName,isCrossRepository,statusCheckRollup
(ghFetchPRChecks in checks.go). That canned JSON shape can't express:
which checks are required (branch-protection required status checks) — the
per-check entries carry only name/status/conclusion/state/workflowName,
no required flag.
statusCheckRollup.contexts nodes expose isRequired(pullRequestNumber: N) on
both CheckRun and StatusContext; the same query also yields reviewDecision
and number.
Proposed
Replace the gh pr list --json call in ghFetchPRChecks with a gh api graphql
query returning, per open PR: number, headRefName, isCrossRepository, reviewDecision, and the rollup contexts with isRequired. Carry the new fields
through prStatus / Worktree:
Check grows a Required bool.
prStatus (and Worktree) gain Number int and ReviewDecision string.
This is foundational — it unblocks three things at once:
Required-check marker in --checks (this issue's headline).
How to mark a required check in the --checks rows — pick one, keep it lean; the
rollup glyph stays as-is:
bold the required rows, or
a * suffix / req tag, or
a --required-only filter that hides optional checks.
Design notes
Repo resolution is the main wrinkle.gh pr list resolves the repo from cmd.Dir (the worktree path). gh api graphql does not substitute {owner}/{repo}, so we need owner/name explicitly — e.g. one cached gh repo view --json owner,name per repo dir, or parse the remote.
Keep all gating/caching/cap unchanged: filter-gated, 5-project cap, 15s cache, hardenedGitEnv, 4s timeout. Still one subprocess per repo.
isRequired takes the PR number, which the query has in scope per node.
Preserve current normalisation: checkStateOf, cross-repo skip,
empty-rollup → neutral.
Tests mirror checks_test.go: unmarshal a sample GraphQL payload into the same prStatus/Check shapes; add a required-flag case.
Cut-line / slicing
Could split into: (a) an afk-able fetch migration that exposes the fields with no display change (output stays byte-identical), then (b) the required-check
display and (c) PR number as small follow-ups.
Note
The PR number is already in today's JSON and merely discarded, so it can ship
as a tiny standalone change independent of this migration — this issue just also
surfaces it through the new path.
Problem
PR enrichment uses
gh pr list --json number,headRefName,isCrossRepository,statusCheckRollup(
ghFetchPRChecksinchecks.go). That canned JSON shape can't express:per-check entries carry only
name/status/conclusion/state/workflowName,no required flag.
APPROVED/CHANGES_REQUESTED/REVIEW_REQUIRED) —needed by the notifications work (feat: desktop notifications for PR review + CI state changes (watch mode) #55).
What's possible
A custom
gh api graphqlquery returns all of it in one call. Confirmed againstPR #56:
statusCheckRollup.contextsnodes exposeisRequired(pullRequestNumber: N)onboth
CheckRunandStatusContext; the same query also yieldsreviewDecisionand
number.Proposed
Replace the
gh pr list --jsoncall inghFetchPRCheckswith agh api graphqlquery returning, per open PR:
number,headRefName,isCrossRepository,reviewDecision, and the rollup contexts withisRequired. Carry the new fieldsthrough
prStatus/Worktree:Checkgrows aRequired bool.prStatus(andWorktree) gainNumber intandReviewDecision string.This is foundational — it unblocks three things at once:
--checks(this issue's headline).reviewDecisionfor the feat: desktop notifications for PR review + CI state changes (watch mode) #55 notification tiers.Display (the design fork — why
hitl)How to mark a required check in the
--checksrows — pick one, keep it lean; therollup glyph stays as-is:
*suffix /reqtag, or--required-onlyfilter that hides optional checks.Design notes
gh pr listresolves the repo fromcmd.Dir(the worktree path).gh api graphqldoes not substitute{owner}/{repo}, so we need owner/name explicitly — e.g. one cachedgh repo view --json owner,nameper repo dir, or parse the remote.hardenedGitEnv, 4s timeout. Still one subprocess per repo.isRequiredtakes the PR number, which the query has in scope per node.checkStateOf, cross-repo skip,empty-rollup → neutral.
checks_test.go: unmarshal a sample GraphQL payload into the sameprStatus/Checkshapes; add a required-flag case.Cut-line / slicing
Could split into: (a) an afk-able fetch migration that exposes the fields with
no display change (output stays byte-identical), then (b) the required-check
display and (c) PR number as small follow-ups.
Note
The PR
numberis already in today's JSON and merely discarded, so it can shipas a tiny standalone change independent of this migration — this issue just also
surfaces it through the new path.