Skip to content

ci: diff desktop matrix locally - #13024

Closed
NB3025 wants to merge 2 commits into
kirodotdev:mainfrom
NB3025:ci/desktop-matrix-local-diff-12920
Closed

NB3025 wants to merge 2 commits into
kirodotdev:mainfrom
NB3025:ci/desktop-matrix-local-diff-12920

Conversation

@NB3025

@NB3025 NB3025 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Pull-request builds choose the affected desktop platforms without spending pull-request-files REST quota or needing pull-requests: read.

The desktop matrix uses dorny/paths-filter with its GitHub token on pull requests, so deciding whether to include macOS consumes the pull-request-files REST API and requires pull-requests: read.

Why it matters

The repository's installation REST budget is shared by every workflow. This avoidable read contributes to rate-limit exhaustion that can prevent fork review lanes from starting even though the matrix decision is available from git history already checked out by the job.

Not a goal

What changed (motivation → approach → change)

Pull-request builds now keep the same affected-platform desktop matrix without spending pull-request-files API quota or granting pull-requests: read. To achieve that, the desktop matrix in .github/workflows/build.yml checks out full history only for pull-request events and passes an empty token to dorny/paths-filter, selecting its local-git diff mode instead of the pull-request-files API. The job no longer requests pull-requests: read. Push and other non-PR runs skip the checkout and retain the existing all-platform matrix behavior. Contract tests pin the PR-only checkout, credential handling, local-diff mode, permission floor, and existing platform routing; the CI documentation records the new source of the matrix decision.

Backwards compatibility

Compatible: the same path patterns and matrix outputs are preserved; only the read source changes from GitHub's PR-files API to the checked-out git diff.

Tests

  • Targeted build/publish workflow, permission, credential, and runner-routing contracts: 683 passed.
  • Change-scoped local gate: backend 952 passed; frontend 8,515 passed.
  • Black, isort, flake8, mypy, docs lint, and git diff --check passed.

Manual verification

N/A — workflow shape and event routing are fully pinned by executable YAML contract tests.

Related Issues

Related to #12920. This PR reduces request volume but intentionally does not close the incident before post-deployment telemetry.

Pattern harvest

Rule candidate: review-prompt
Pattern: prefer a checked-out local git diff over the pull-request-files API when the workflow needs only path classification.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|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

@NB3025
NB3025 requested review from a team and pepmach September 23, 2026 06:58
@NB3025

NB3025 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Intent: Remove the desktop matrix’s avoidable pull-request-files API read while preserving its platform-routing behavior.
Not a goal: Change desktop build coverage, artifact production, or any fork-review lane.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 7040619449a6b084f99df077713b843344b6df13 via the fork AI-review pipeline — 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.

Not justified as shipped

What this change ships

Inventory (6 items) — 5 justified

Intent: make the PR desktop-platform decision without spending the shared installation REST quota (#12920). This is a FIX.

  1. The PR desktop matrix now comes from a local git diff instead of the PR-files API. This reuses the existing token: '' pattern from ci.yml:138 and macos-on-demand.yml:116, which is the last unfixed sibling (ci: Detect changed surface fails repo-wide with installation rate limit #10434) — justified
  2. The desktop-matrix job no longer has pull-requests: read — justified
  3. PR runs check out full history so the base commit is present for the diff — justified
  4. The job is capped at 15 minutes instead of the 6-hour default — undeclared
  5. Push and non-PR runs skip the checkout, which nothing there used — justified
  6. The ci-and-reviews.md paragraph and four contract tests pin the new source — justified

[FIRST-PRINCIPLES-REVIEWED] 7040619

Description read

[DESCRIPTION-READ] 5abc8638233f88e38252711098868d3136b5879a26a6557cd58366d555b7a679

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

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 7040619449a6b084f99df077713b843344b6df13 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that this PR's own desktop-matrix run went green on a pull request and resolved the expected os legs. That run is the end-to-end proof of the local-diff path.

[DESIGN-REVIEWED] 7040619

Description read

[DESCRIPTION-READ] c2d378370ac20e3b3775798893d7a4b22242514934d574a57beb5b6da9bbc047

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

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 2621156050c5317fa5af3b48e8f3461405e663ca via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2621156

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 7040619449a6b084f99df077713b843344b6df13 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7040619

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 30, 2026
@NB3025
NB3025 force-pushed the ci/desktop-matrix-local-diff-12920 branch from 2621156 to 18deea6 Compare October 1, 2026 06:17
@NB3025
NB3025 requested a review from a team as a code owner October 1, 2026 06:17
@NB3025
NB3025 requested a review from dodgeblaster October 1, 2026 06:17
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 2, 2026
@NB3025
NB3025 force-pushed the ci/desktop-matrix-local-diff-12920 branch from 18deea6 to d396f98 Compare October 3, 2026 08:11
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 3, 2026

Copy link
Copy Markdown
Contributor

PR triage (2026-10-05): DISTINCT — needs a rebase

I compared the diff from merge base d8d052f4 to head d396f98d against origin/main (5edf2fee, 605 commits ahead).

Recommendation: REBASE, then keep it.

NB3025 added 2 commits October 6, 2026 09:31
The PR-only fetch-depth: 0 checkout in desktop-matrix had no timeout,
so a hung full-history fetch could hold every desktop leg for the
6-hour default. Use the same 15-minute budget as ci.yml's changes job
and pin it with a contract test.
@NB3025
NB3025 force-pushed the ci/desktop-matrix-local-diff-12920 branch from d396f98 to 7040619 Compare October 6, 2026 09:53
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 6, 2026
@NB3025

NB3025 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@bolichen97 Thanks for the triage. Rebased onto current main (5edf2feec); new head is 7040619449.

  • Doc conflict resolved as suggested: the resolver note now lives in the existing desktop-matrix bullet in docs/ci/ci-and-reviews.md (full-history checkout only on pull requests, empty token to dorny/paths-filter, no pull-requests: read needed; non-PR runs skip that checkout). The build-desktop and smoke-install-macos text from main is unchanged.
  • No other changes: git range-diff against the previous head shows .github/workflows/build.yml and test/test_publish_feed_contract.py are identical to the pre-rebase commits.
  • Local checks: test/test_publish_feed_contract.py (36 passed), the 4 test files that reference ci-and-reviews.md (1,381 passed), git diff --check clean. I did not run the full suite or actionlint locally.

The pull_request workflows on the new head are waiting for maintainer approval to run, since this is a fork PR.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 7, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

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

bolichen97 pushed a commit that referenced this pull request Oct 18, 2026
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.

Co-authored-by: NB3025 <NB3025@users.noreply.github.com>
@bolichen97

Copy link
Copy Markdown
Contributor

Closing as replaced by #21927, which landed the same change to the desktop matrix job. Thank you for the original work here. If something in this PR is not covered by #21927, please reopen or open a new PR with just that part.

@bolichen97 bolichen97 closed this Oct 18, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks @NB3025 for this work. Main has since moved to local-diff mode for the desktop matrix in a different shape (an empty dorny/paths-filter token plus a depth-1 base fetch), so the full-history checkout and its timeout no longer apply.

The one piece main still lacked was dropping the unused pull-requests: read grant. That is carried in #21927, with you kept as the commit author. Closing this one in favor of it. Your branch is untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: installation API rate limit repeatedly kills fork review lanes mid-run (GPT/Opus/Content Scan/Security Scope "could not run")

3 participants