Commit Graph

3 Commits

Author SHA1 Message Date
Peter Steinberger
80449f9a8f refactor(scripts): retire the STALE-CANCELLED watcher verdict (#113242)
Run-identity supersession (#113230) resolves the scenario this heuristic
softened: superseded runs and rerun-attempt leftovers are filtered before
classification, so aggregate-FAILURE-with-green-duplicates now classifies
as GREEN or PENDING on evidence. The only remaining reachable case —
identity-less app check runs posting duplicate same-name results — is
genuinely ambiguous and now honestly exits FAILING (15) instead of the
special verify-manually exit 17.
2026-07-23 23:11:41 -07:00
Peter Steinberger
169dad6224 fix: watch-pr-ci exits with false FAILURE when draft-to-ready cancels superseded runs (#113230)
* fix(scripts): ignore superseded workflow runs in watch-pr-ci rollup classification

Draft->ready re-triggers leave cancelled superseded runs on the head SHA
forever, and GitHub's aggregate rollup state counts them, so the watcher
emitted terminal FAILURE while the replacement run was still in progress
and could never reach GREEN (observed on PR #113150, head bd1b9a0e).

- fetch run identity per check and resolve same-name checks to the newest
  run/check id (GitHub latest-name-wins); drop cancelled checks from
  replaced runs; keep older runs' unique jobs visible
- paginate statusCheckRollup contexts (bounded, 10 pages) so >100-context
  rollups are not truncation-blind; changed or lost snapshots throw into
  the bounded retry
- classify GREEN when aggregate FAILURE is explained solely by superseded
  contexts with full visibility; truncation still fails conservatively

* ci: scope GitHub App token permissions in stale, labeler, auto-response, and pr-ci-sweeper

Fixes red main: #112963 bumped zizmor v1.22.0 -> v1.28.0, whose github-app
audit flags create-github-app-token mints without permission-* inputs (14
high findings, Workflow Sanity red on main since 3b7b2a2a1f). Most
workflows already migrated to scoped tokens; these four were stragglers.

Scopes follow each consumer's actual API surface: stale needs issues/PR
write plus actions read for its state-cache check; labeler needs label
CRUD (issues write), PR write, members read for maintainer gates, and
contents read where actions/labeler reads its config; auto-response needs
issues/PR write plus members read; pr-ci-sweeper needs actions write to
re-fire runs, checks read, and PR write. Verified locally with the exact
CI invocation (zizmor 1.28.0, repo config, regular persona, medium
severity/confidence): no findings, ignore/suppress counts match CI.
2026-07-23 22:46:04 -07:00
Peter Steinberger
4c5e8f3b85 feat(scripts): add watch-pr-ci CI watcher with mergeable and attach prechecks (#112821)
* feat(scripts): add watch-pr-ci CI watcher with mergeable and attach prechecks

* fix(scripts): require successful attached PR CI run

* fix(scripts): harden watch-pr-ci verdicts against foreign runs and truncated rollups

* fix(scripts): add fresh-run gating to watch-pr-ci attachment

* fix(scripts): guard stale-cancelled verdict against truncated context pages

* fix(scripts): declare rollup context total count

* fix(scripts): sanitize check names and close the final polling interval

* test(scripts): type deadline wait samples
2026-07-22 23:33:45 -04:00