Skip to content

Commit 365a0f5

Browse files
thymikeeclaude
andcommitted
ci: cache fallow, fold compat into repo guards and lint into typecheck with parallel steps
A cold fallow run re-resolves every import against the root tsconfig's 28 project references (~760 statx per import), which takes minutes on a hosted runner; the persisted parse cache skips unchanged files. Main pushes save the cache, every run restores it. Parallel steps let the CI workflow drop from six jobs to four without lengthening any lane: freerange runs in the background beside the other guards, and lint/format/DI-seams run beside typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1d8f508 commit 365a0f5

1 file changed

Lines changed: 102 additions & 92 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 102 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ concurrency:
3030
cancel-in-progress: true
3131

3232
jobs:
33+
# Lint, typecheck, and package verification share one checkout and install. The lint gates
34+
# and typecheck are independent reads of the tree, so they run as one parallel group.
35+
#
3336
# The Swift trailing-comma assertion is text-only and runs before the toolchain setup, so a
3437
# grep failure does not wait on an install. The DI-seams check below needs a real TypeScript
3538
# runtime (#1976 / PR #2006), so it runs after Setup toolchain instead.
36-
lint:
37-
name: Lint & Format
39+
lint-typecheck-package:
40+
name: Lint, Typecheck & Package
3841
runs-on: ubuntu-latest
39-
timeout-minutes: 10
42+
timeout-minutes: 20
4043
steps:
4144
- name: Checkout
4245
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -69,51 +72,98 @@ jobs:
6972
- name: Setup toolchain
7073
uses: ./.github/actions/setup-node-pnpm
7174

72-
# Same false-green shape as the Swift check above (#1976). An earlier revision of this
73-
# gate (PR #2006, first review pass) fixed the exit-code handling but kept the ban/allow
74-
# decision as a regex that exempted matches by the *spelling* of the typeof target
75-
# (`typeof fetch` always passed, SCREAMING_SNAKE_CASE targets always passed) — a name-based
76-
# semantic allowlist that would silently pass a new, genuinely test-only `typeof fetch` seam
77-
# anywhere in the tree while banning an equally legitimate seam under any other name.
78-
# scripts/di-seams instead checks each match against an explicit, typed, per-site allowlist
79-
# (scripts/di-seams/approved.ts) keyed by (file, field, typeof-target): a triple is exempt
80-
# only because it was individually reviewed and named, never because of how it is spelled.
81-
# The gate fails just as hard on a stale approval (one whose triple no longer matches
82-
# anything) as on an unapproved seam, so the allowlist can't drift out of sync with the code
83-
# it describes. See scripts/di-seams/model.ts and its tests.
84-
- name: Fail if test-only DI seams reappear in production code
85-
uses: ./.github/actions/run-gate
86-
with: { gate: di-seams }
75+
- parallel:
76+
# Same false-green shape as the Swift check above (#1976). An earlier revision of this
77+
# gate (PR #2006, first review pass) fixed the exit-code handling but kept the ban/allow
78+
# decision as a regex that exempted matches by the *spelling* of the typeof target
79+
# (`typeof fetch` always passed, SCREAMING_SNAKE_CASE targets always passed) — a name-based
80+
# semantic allowlist that would silently pass a new, genuinely test-only `typeof fetch` seam
81+
# anywhere in the tree while banning an equally legitimate seam under any other name.
82+
# scripts/di-seams instead checks each match against an explicit, typed, per-site allowlist
83+
# (scripts/di-seams/approved.ts) keyed by (file, field, typeof-target): a triple is exempt
84+
# only because it was individually reviewed and named, never because of how it is spelled.
85+
# The gate fails just as hard on a stale approval (one whose triple no longer matches
86+
# anything) as on an unapproved seam, so the allowlist can't drift out of sync with the code
87+
# it describes. See scripts/di-seams/model.ts and its tests.
88+
- name: Fail if test-only DI seams reappear in production code
89+
uses: ./.github/actions/run-gate
90+
with: { gate: di-seams }
91+
92+
- name: Run oxlint
93+
uses: ./.github/actions/run-gate
94+
with: { gate: lint }
95+
96+
- name: Check formatting
97+
uses: ./.github/actions/run-gate
98+
with: { gate: format }
99+
100+
- name: Run typecheck
101+
uses: ./.github/actions/run-gate
102+
with: { gate: typecheck }
87103

88-
- name: Run oxlint
104+
- name: Build CLI
89105
uses: ./.github/actions/run-gate
90-
with: { gate: lint }
106+
with: { gate: build }
91107

92-
- name: Check formatting
108+
- name: Verify emitted chunk ownership
93109
uses: ./.github/actions/run-gate
94-
with: { gate: format }
110+
with: { gate: bundle-owner-files }
95111

96-
# Structural guards share one checkout and install. Every gate stays an
97-
# independently named step with its own failure message; the gate manifest
98-
# derives lane ownership from these declarations, so merging jobs changes
99-
# nothing it asserts.
112+
# The build runs on the default toolchain Node and the package is verified on the minimum
113+
# supported Node, so this job covers what a user on `engines.node` floor actually installs.
114+
- name: Setup Node.js 22.12
115+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
116+
with:
117+
node-version: '22.12'
118+
119+
# Packs, lints the tarball with publint/attw, installs it outside the workspace, and imports
120+
# every published entry point before running the CLI. See scripts/check-package.ts.
121+
#
122+
# Runs the script directly rather than through `pnpm check:package`: the repo's pinned pnpm
123+
# requires Node >= 22.13 and refuses to start on the 22.12 floor this job exists to cover. The
124+
# gate itself only needs `node` and `npm`, so it is the package.json script minus the launcher.
125+
- name: Verify the published package on Node.js 22.12
126+
run: node --experimental-strip-types scripts/check-package.ts
127+
128+
# Structural guards and the history-backed compatibility gates share one deep checkout and
129+
# install. Every gate stays an independently named step with its own failure message; the gate
130+
# manifest derives lane ownership from these declarations, so merging jobs changes nothing it
131+
# asserts.
100132
repo-guards:
101-
name: Repo Guards
133+
name: Repo Guards & Compatibility
102134
runs-on: ubuntu-latest
103-
timeout-minutes: 15
135+
timeout-minutes: 20
104136
steps:
105137
# The layering ratchets (R6/R9/R10) measure the merge-base with origin/main, which a
106-
# shallow checkout cannot reach.
138+
# shallow checkout cannot reach. Fallow, replay-compat, and daemon-wire-compat need full
139+
# history or tags.
107140
- name: Checkout
108141
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
109142
with:
110143
fetch-depth: 0
144+
fetch-tags: true
111145

112146
# The layering gate parses production sources with `oxc-parser`, so
113147
# dependencies are required; keep install-deps enabled.
114148
- name: Setup toolchain
115149
uses: ./.github/actions/setup-node-pnpm
116150

151+
# Slowest guard (~4.5 min) and independent of the others, so it runs beside them.
152+
- name: Check numeric ranges
153+
id: freerange
154+
background: true
155+
uses: ./.github/actions/run-gate
156+
with: { gate: freerange }
157+
158+
# A cold fallow run re-resolves every import against the root tsconfig's project
159+
# references, which costs minutes on a hosted runner; the parse cache skips unchanged files.
160+
- name: Restore fallow cache
161+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
162+
with:
163+
path: .fallow
164+
key: fallow-${{ github.job }}-${{ github.sha }}
165+
restore-keys: fallow-${{ github.job }}-
166+
117167
- name: Check import-direction DAG
118168
# Structured import-direction lint over the resolved graph. See
119169
# scripts/layering/check.ts and CONTEXT.md (Architecture: folder DAG +
@@ -186,29 +236,6 @@ jobs:
186236
uses: ./.github/actions/run-gate
187237
with: { gate: mcp-metadata }
188238

189-
# Slowest guard (~3 min), so it runs last and structural failures surface
190-
# before it. Runs on plain Node via the shared install above.
191-
- name: Check numeric ranges
192-
uses: ./.github/actions/run-gate
193-
with: { gate: freerange }
194-
195-
# History-backed compatibility gates share one deep checkout: fallow,
196-
# replay-compat, and daemon-wire-compat all need either full history or tags,
197-
# which no shallow unit lane can read.
198-
compat-provenance:
199-
name: Compatibility & Provenance
200-
runs-on: ubuntu-latest
201-
timeout-minutes: 15
202-
steps:
203-
- name: Checkout
204-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
205-
with:
206-
fetch-depth: 0
207-
fetch-tags: true
208-
209-
- name: Setup toolchain
210-
uses: ./.github/actions/setup-node-pnpm
211-
212239
- name: Run Fallow audit
213240
env:
214241
FALLOW_BASE: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
@@ -235,52 +262,20 @@ jobs:
235262

236263
# The daemon RPC wire ledger (#1432) is compared against the ledger as it
237264
# stood at the last RELEASED tag, which only a tagged checkout can read.
238-
# The shallow Repo Guards lane holds the ledger to its source; this step
239-
# holds it to the last release.
240265
- name: Compare the daemon RPC wire surface against the last released tag
241266
uses: ./.github/actions/run-gate
242267
with: { gate: daemon-wire-compat }
243268

244-
# Typecheck and package verification share one checkout and install; both
245-
# need the default toolchain only, and the package step re-pins Node itself.
246-
typecheck-package:
247-
name: Typecheck & Package
248-
runs-on: ubuntu-latest
249-
timeout-minutes: 20
250-
steps:
251-
- name: Checkout
252-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
253-
254-
- name: Setup toolchain
255-
uses: ./.github/actions/setup-node-pnpm
256-
257-
- name: Run typecheck
258-
uses: ./.github/actions/run-gate
259-
with: { gate: typecheck }
260-
261-
- name: Build CLI
262-
uses: ./.github/actions/run-gate
263-
with: { gate: build }
264-
265-
- name: Verify emitted chunk ownership
266-
uses: ./.github/actions/run-gate
267-
with: { gate: bundle-owner-files }
268-
269-
# The build runs on the default toolchain Node and the package is verified on the minimum
270-
# supported Node, so this job covers what a user on `engines.node` floor actually installs.
271-
- name: Setup Node.js 22.12
272-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
269+
# Main pushes refresh the cache PR runs restore; PR runs only read it.
270+
- name: Save fallow cache
271+
if: ${{ github.event_name == 'push' }}
272+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
273273
with:
274-
node-version: '22.12'
274+
path: .fallow
275+
key: fallow-${{ github.job }}-${{ github.sha }}
275276

276-
# Packs, lints the tarball with publint/attw, installs it outside the workspace, and imports
277-
# every published entry point before running the CLI. See scripts/check-package.ts.
278-
#
279-
# Runs the script directly rather than through `pnpm check:package`: the repo's pinned pnpm
280-
# requires Node >= 22.13 and refuses to start on the 22.12 floor this job exists to cover. The
281-
# gate itself only needs `node` and `npm`, so it is the package.json script minus the launcher.
282-
- name: Verify the published package on Node.js 22.12
283-
run: node --experimental-strip-types scripts/check-package.ts
277+
- name: Wait for numeric ranges
278+
wait: freerange
284279

285280
# Runs the full unit + provider-integration suites under coverage with
286281
# thresholds, so a separate unit-tests job would rerun the same tests.
@@ -297,6 +292,14 @@ jobs:
297292
- name: Setup toolchain
298293
uses: ./.github/actions/setup-node-pnpm
299294

295+
# The CRAP steps score through `fallow health`; see Repo Guards for why its cache matters.
296+
- name: Restore fallow cache
297+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
298+
with:
299+
path: .fallow
300+
key: fallow-${{ github.job }}-${{ github.sha }}
301+
restore-keys: fallow-${{ github.job }}-
302+
300303
- name: Test changed-line coverage gate
301304
uses: ./.github/actions/run-gate
302305
with: { gate: coverage-model }
@@ -366,6 +369,13 @@ jobs:
366369
gate: coverage-crap
367370
args: --all
368371

372+
- name: Save fallow cache
373+
if: ${{ !cancelled() && github.event_name == 'push' }}
374+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
375+
with:
376+
path: .fallow
377+
key: fallow-${{ github.job }}-${{ github.sha }}
378+
369379
integration:
370380
name: Integration Tests
371381
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)