From 1b75d24980e2773320be210dde10e65d705ae71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 17 Nov 2026 22:57:19 +0100 Subject: [PATCH 1/3] perf(ci): start the fixture producer only when its fingerprint can change The producer ran on every pull request and resolved a fingerprint that @expo/fingerprint hashes with examples/test-app/ as the project root, so a diff outside that tree cannot change the artifact name it publishes or the trust rules a consumer applies. Over the last 120 merged PRs it started 117 runs and 12 had a path that can change what that job reads. Each run cost 0.57 minutes: one checkout, one install, and two artifact lookups that always found main's binary. Give the pull_request trigger the paths that job's own steps read, and add the workflow-level concurrency it never had: a consumer trusts an artifact only from its own exact head or from a main push, so a producer that finishes for a superseded head is never downloaded. Main pushes keep a per-sha group so a build that feeds every later PR's cache always finishes. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test-app-build-cache.yml | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-app-build-cache.yml b/.github/workflows/test-app-build-cache.yml index 500c6a7bbe..775bf67e1f 100644 --- a/.github/workflows/test-app-build-cache.yml +++ b/.github/workflows/test-app-build-cache.yml @@ -11,14 +11,35 @@ name: Test App Build Cache # expo-build-disk-cache provider in app.config.js. # # Only builds when the fingerprint has no trusted artifact yet. Runs on every -# push to main and every PR so a same-head consumer can wait for a scheduled -# producer (workflow_dispatch cannot reach a workflow that is not yet on main). +# push to main so a fingerprint is cached as soon as it lands on main, and on a +# PR whose own diff can change that fingerprint so a same-head consumer can wait +# for a scheduled producer (workflow_dispatch cannot reach a workflow that is not +# yet on main). Any other PR reuses main's artifact for the same fingerprint name, +# so a producer run there publishes a binary no consumer needs. on: push: branches: - main pull_request: + paths: + # @expo/fingerprint hashes the Expo project with examples/test-app/ as the + # project root, so nothing above it enters the fingerprint the artifact is + # named by. The rest of the list is what this job's own steps read: the root + # manifests (the pinned pnpm version, and the second lockfile the release + # job installs), the name resolver and trust rules (setup-fixture-app), the + # dependency graph's cache key (setup-test-app-dependencies), and the + # toolchain that builds the binary (setup-node-pnpm, setup-android-sdk). + # A producer a PR needs but does not get costs that PR an inline native + # build, so this list errs toward the side that builds. + - 'examples/test-app/**' + - 'package.json' + - 'pnpm-lock.yaml' + - '.github/actions/setup-fixture-app/**' + - '.github/actions/setup-test-app-dependencies/**' + - '.github/actions/setup-node-pnpm/**' + - '.github/actions/setup-android-sdk/**' + - '.github/workflows/test-app-build-cache.yml' workflow_dispatch: permissions: @@ -26,6 +47,15 @@ permissions: # Look up whether this fingerprint's artifact already exists across runs. actions: read +# A new push to the same PR supersedes this producer: a consumer trusts an artifact only from +# its own exact head or from a main push, so a binary finished for a commit no PR check still +# runs at is never downloaded. Each main commit keeps its own group, so a main build that feeds +# every later PR's cache always finishes. +concurrency: + group: >- + ci-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: true + jobs: fingerprint: name: Resolve native fingerprint From 9fafe693a4ee89c7bafd6bd11db8c5e1d7d41931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 17 Nov 2026 22:57:24 +0100 Subject: [PATCH 2/3] perf(ci): run the docs gates from one checkout The command-reference gate started its own runner, checked out the tree, and installed the same dependency graph the docs lane had just installed, to run one Vitest file over the Markdown the lane's other gates already read. Measured on recent runs, that job spent 23.6 seconds on checkout and install to spend 3.2 seconds on the gate. Declare it in the docs lane's existing job and drop the second one. The lane now carries all five docs gates from one install, which is also what the manifest's path reachability reads, so the witness for #1420 stops the whole lane instead of narrowing one filter. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docs.yml | 27 +++++++++------------------ scripts/gate/audit-coverage.test.ts | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ed96edfe73..13d1139bcb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -54,6 +54,8 @@ concurrency: cancel-in-progress: true jobs: + # One job, one checkout and install: every gate below is an independent read of the tree, and + # the command-reference gate used to start its own runner and install the same graph again. check: name: Prose, internal links, and heading anchors runs-on: blacksmith-4vcpu-ubuntu-2404 @@ -65,6 +67,13 @@ jobs: - name: Setup Node and pnpm uses: ./.github/actions/setup-node-pnpm + # ci.yml ignores docs paths, so a docs-only PR never reaches the unit lane that carries the + # command-reference coverage gate. Documenting a retired command, or dropping a public + # command's docs, fails here instead. + - name: Check command reference doc coverage + uses: ./.github/actions/run-gate + with: { gate: command-docs } + # Reads the Markdown sources only, so it fails before the site build. - name: Check docs prose uses: ./.github/actions/run-gate @@ -85,21 +94,3 @@ jobs: - name: Check docs links uses: ./.github/actions/run-gate with: { gate: docs-links } - - # ci.yml ignores docs paths, so a docs-only PR never reaches the unit lane that carries the - # command-reference coverage gate. Documenting a retired command, or dropping a public - # command's docs, fails here instead. - command-docs: - name: Command reference doc coverage - runs-on: blacksmith-4vcpu-ubuntu-2404 - timeout-minutes: 5 - steps: - - name: Checkout - uses: useblacksmith/checkout@2b9fe87d796feea153b455ec2f3125b471a7b0e7 # v1.8.2 - - - name: Setup Node and pnpm - uses: ./.github/actions/setup-node-pnpm - - - name: Check command reference doc coverage - uses: ./.github/actions/run-gate - with: { gate: command-docs } diff --git a/scripts/gate/audit-coverage.test.ts b/scripts/gate/audit-coverage.test.ts index efc976c771..0c73b3ab3a 100644 --- a/scripts/gate/audit-coverage.test.ts +++ b/scripts/gate/audit-coverage.test.ts @@ -58,17 +58,26 @@ test('deleting the lane that runs a gate reports exactly that gate, naming the r }); test('a docs-only change still reaches the command-reference gate (#1420)', () => { + // The docs lane declares every docs gate from one checkout, so the witness stops the whole + // lane instead of narrowing it: naming one path would also hide the lane's other gates. What + // must hold is that no other lane a docs-only PR starts runs this gate — ci.yml ignores the + // docs paths, so this lane is the gate's only path to a PR. + const category = categories(base).find((entry) => entry.rule === 'own:command-docs'); + assert.ok(category, 'the command reference must still be a category'); const model = mutate((m) => ({ lanes: mapLane( m, - (lane) => lane.workflow === 'docs.yml' && lane.gates.includes('command-docs'), - (lane) => ({ ...lane, paths: ['website/assets/**'] }), + (lane) => lane.workflow === 'docs.yml', + (lane) => ({ ...lane, pathsIgnore: ['**'] }), ), })); const found = messages(model); - assert.equal(found.length, 1); - assert.match(found[0] ?? '', /website\/docs\/docs\/commands\.md/); - assert.match(found[0] ?? '', /selects "command-docs"/); + assert.ok( + found.some( + (message) => message.includes(category.path) && /selects "command-docs"/.test(message), + ), + `stopping the docs lane must report command-docs for ${category.path}`, + ); }); test('a path filter that excludes a category fails, though the check still runs somewhere', () => { From 967f029ea2bc7d35c88be797fb204da41c23c105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 17 Nov 2026 22:57:28 +0100 Subject: [PATCH 3/3] perf(ci): run the three graph readers at once The layering, depgraph, and affected-selector gates each parse the whole production source tree, and the job waited for all three in sequence: 62.5 + 18.8 + 24.8 seconds averaged over recent runs, against a 2.7-minute job. They read the same tree and write nothing one another reads, so the order between them carries no meaning. Run them as one parallel group, the shape the lint, typecheck, and format gates already use in this workflow, so the job pays the slowest reader instead of the sum. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 809d22b3ed..87f1b43202 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,19 +177,29 @@ jobs: path: .tmp/native-dupes/jscpd-report.json if-no-files-found: ignore - - name: Check import-direction DAG - # Structured import-direction lint over the resolved graph. See - # scripts/layering/check.ts and CONTEXT.md (Architecture: folder DAG + - # layering lint). - uses: ./.github/actions/run-gate - with: { gate: layering } + # The three graph readers each parse the whole production source tree, so each one's wait + # was the sum of the others. They read the same tree and write nothing the other reads, so + # they run as one parallel group and the job pays the slowest instead of all three. + - parallel: + # Structured import-direction lint over the resolved graph. See + # scripts/layering/check.ts and CONTEXT.md (Architecture: folder DAG + + # layering lint). + - name: Check import-direction DAG + uses: ./.github/actions/run-gate + with: { gate: layering } - # Model tests for the dependency-graph report and its blast-radius query. The report - # reads the gate's model (scripts/layering/model.ts) and applies the gate's own R6 - # counting rule, so it is not a second measurement of the R6 ratchet. - - name: Check the depgraph report model - uses: ./.github/actions/run-gate - with: { gate: depgraph } + # Model tests for the dependency-graph report and its blast-radius query. The report + # reads the gate's model (scripts/layering/model.ts) and applies the gate's own R6 + # counting rule, so it is not a second measurement of the R6 ratchet. + - name: Check the depgraph report model + uses: ./.github/actions/run-gate + with: { gate: depgraph } + + # The selector is fail-open and advisory (GitHub CI stays authoritative), + # so the gate only guards the derivation model. + - name: Check affected-selector model + uses: ./.github/actions/run-gate + with: { gate: affected-selector } # Tests for the TMPDIR redirection itself. # @@ -203,12 +213,6 @@ jobs: uses: ./.github/actions/run-gate with: { gate: tmpdir-leaks-model } - # The selector is fail-open and advisory (GitHub CI stays authoritative), - # so the gate only guards the derivation model. - - name: Check affected-selector model - uses: ./.github/actions/run-gate - with: { gate: affected-selector } - # The gate-of-gates (#1429). It shares this job because it validates the # same artifact the selector is built on — CHECK_CATALOG's `ciJobs` — and # because a gate that proves the other gates are wired must not be the one