Skip to content

ci: drop pull-requests: read from the desktop matrix - #21927

Merged
bolichen97 merged 1 commit into
mainfrom
replace/13024
Oct 18, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
replace/13024

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The desktop-matrix job in .github/workflows/build.yml holds only the permission it uses.

The job already picks the PR desktop matrix from a local git diff: dorny/paths-filter runs with token: '' after a depth-1 fetch of the PR base commit. It never calls the pull-request files API, yet it still requests pull-requests: read.

Why it matters

An unused pull-requests: read grant widens the job token's scope for no gain. Least privilege says the job should hold contents: read only.

Not a goal

  • Does not change the matrix decision, its path filters, or any other job's permissions.
  • Does not port the full-history checkout or 15-minute timeout from ci: diff desktop matrix locally #13024; main reached local-diff mode another way, so they no longer apply.

What changed (motivation → approach → change)

Main already switched this job to local-diff mode (empty dorny token plus a depth-1 base fetch), so the PR-files API read and the permission it needed are gone in practice. The grant itself was left behind. This PR:

  • .github/workflows/build.yml: drops pull-requests: read from desktop-matrix; the job keeps contents: read.
  • test/test_publish_feed_contract.py: a contract test pins the job's permissions to {"contents": "read"}.
  • docs/ci/ci-and-reviews.md: one sentence notes where the PR decision comes from and the permission floor.

#13024 (by @NB3025) also switched the job to local diff with a fetch-depth: 0 PR-only checkout and a timeout. That part is already on main in a different shape. The one piece main still lacks is dropping the unused permission. The commit keeps NB3025 as author.

Backwards compatibility

Compatible: same filters, same matrix outputs; only the job token's scope gets smaller.

Reader: .github/workflows/build.yml:desktop-matrix dorny/paths-filter step -- release -- runs with token: '' (local git diff), so it needs no pull-requests scope; test_desktop_matrix_does_not_request_pull_request_api_permission
Reader: .github/workflows/build.yml:desktop-matrix compute/runner/checkout/base-fetch steps -- release -- read only the checked-out repo and event payload, covered by contents: read

Tests

  • New test_desktop_matrix_does_not_request_pull_request_api_permission pins the job's permissions to contents: read.
  • All 18 test files that read build.yml: 562 passed. git diff --check clean.

Manual verification

N/A — the change is a permission removal pinned by a YAML contract test; this PR's own Resolve desktop matrix run exercises it.

Related Issues

Replaces #13024. Related to #12920.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

The desktop-matrix job already decides its matrix from a local git
diff (dorny/paths-filter with an empty token), so it no longer reads
the pull-request files API. Drop the now-unused pull-requests: read
permission, pin the contents: read floor with a contract test, and
note it in the CI docs.

Ported from #13024 (commit f198ced); the rest of that change
(local-diff mode, PR-only base fetch) is already on main.
@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 18, 2026 16:25
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision d9faf04239635a087be8c8d7c13194e91c4f2bca touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d9faf04239635a087be8c8d7c13194e91c4f2bca — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] d9faf04

Description read

[DESCRIPTION-READ] ea783e68e2c7ac7854b29e5d4185990a78a19806a3c8f3ac57f338e0f642d21b

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d9faf04239635a087be8c8d7c13194e91c4f2bca — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (3 items) — 3 justified

Intent: give the desktop-matrix CI job only the token permission it actually uses. This is a FIX (least privilege).

  1. The desktop-matrix job's token no longer gets pull-requests: read. The paths-filter step runs with token: '', a local diff, and no step calls the PR API. — justified
  2. A contract test now holds that job's permissions to {"contents": "read"}. — justified
  3. The CI doc now has one sentence saying the PR decision comes from a local diff and naming the permission floor. — justified

[FIRST-PRINCIPLES-REVIEWED] d9faf04

Description read

[DESCRIPTION-READ] 1e75b09d65351af084b872a1edd311340983b808d24375546c9c0a15b794ea1d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed d9faf04239635a087be8c8d7c13194e91c4f2bca — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d9faf04

Verdict parsed from the review's SHA-scoped output markers for commit d9faf04239635a087be8c8d7c13194e91c4f2bca.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d9faf04239635a087be8c8d7c13194e91c4f2bca: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of d9faf04239635a087be8c8d7c13194e91c4f2bca and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d9faf04

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d9faf04239635a087be8c8d7c13194e91c4f2bca: <one-sentence reason>

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Head reviewed: d9faf04.

What I checked:

  • Every step of desktop-matrix at this head: the runner pick, actions/checkout with persist-credentials: false, the depth-1 base fetch, dorny/paths-filter with token: '', and compute. None of them calls the pull request REST API, so contents: read is enough.
  • Push and merge_group runs skip the filter and the base fetch, so they never needed the removed scope.
  • No other test or doc on main pins pull-requests: read for this job.
  • The new contract test asserts the exact permissions map, so a re-added scope turns it red.

Bots on this head: Design PASS, First Principles PASS, Opus and GPT no blocking findings, UX skipped (no website change).

Remaining before merge: PR Readiness is still checking on this head (Coverage Combine was running). After this merges, #13024 can be closed as replaced.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 18, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readiness passed on this head and no findings. Approving.

@bolichen97
bolichen97 merged commit af65bf4 into main Oct 18, 2026
113 of 114 checks passed
@bolichen97
bolichen97 deleted the replace/13024 branch October 18, 2026 17:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants