Repository navigation
Commit 3688e5c
ci(repo-gates): restore the build's turbo cache, save and prune on push only (#13360)
Closes #13348
Clause-②: no
## Governed surface
`.github/workflows/**` is on objectui's governed surface (`node
scripts/check-governed-queue-guard.mjs --test
.github/workflows/repo-gates.yml` → GOVERNED). This PR stays **draft**
until an approval from a governed approver (`os-zhuang` / `hotlong`) is
on record.
## What changed (3 files)
- **`.github/workflows/repo-gates.yml`**: the build step now has a Turbo
cache, set up the same way as `performance-budget.yml`'s
`bundle-analysis` cache (objectui#12276):
- **Restore Turbo Cache** runs before "Build every package the gates
below read". It uses `actions/cache/restore@v6` on `.turbo/cache`, with
the key `turbo-${{ runner.os }}-repo-gates-${{ github.sha }}` and one
restore key, `turbo-${{ runner.os }}-repo-gates-`. It runs on the same
condition as the build: `!cancelled() && steps.install.outcome ==
'success'`.
- The build step sets `TURBO_RUN_SUMMARY: 'true'`. The build command and
its filter set are unchanged, and it is still never an unfiltered `turbo
run build` (header, `repo-gates.yml:55`).
- Three bookkeeping steps run after the last gate, all bounded and
`continue-on-error`:
- **Report what the turbo cache replayed** runs on every run
(`!cancelled()`).
- **Prune the turbo cache to what this run used** runs on push only.
- **Save Turbo Cache** runs on push only, and only when `cache-hit !=
'true'`, with a 5 min bound. The existing save of the pinned
`@objectstack` build stays the last step.
- Pull-request and merge-group runs restore the cache and never save it.
- **`scripts/__tests__/check-action-ref-convention.test.ts`**: this test
pins the exact list of `uses:` refs in `repo-gates.yml`. The new restore
and save add two refs, so the list now has them, in file order.
- **`content/docs/guide/ci-cd-pipeline.md`**: the Repo Gates section now
names the cache and `scripts/report-turbo-cache.mjs`.
`ci-cd-pipeline-doc.test.ts` requires the page to name every first-party
command a workflow runs, and it has no exception list.
## `$SKILL_FILTER` / `$SNIPPET_FILTER`
On this PR's base, the two derived filters add no tasks to the build.
Checked with `turbo run build --dry=json`: `--filter='./packages/*'`
alone gives 40 tasks, and adding both derived filters gives the same 40.
That is also the task set `bundle-analysis` builds. The filters are
derived on every run, so they could change it later. If one ever names a
package outside `packages/`, that run gets fewer cache hits. It does not
break the cache.
## How acceptance will be measured
- **Baseline:** the latest `main` push run, 39921589107: the build step
took 247 s and the job took 419 s.
- **This PR's own run will miss the cache.** Pull requests restore from
`main`'s entry, and no `repo-gates-` entry exists yet. The ≤90 s build
step can only show up after a push to `main` has saved an entry. To read
it:
- check the `::notice` that "Report what the turbo cache replayed"
writes on the first PR run after that push;
- check that the push run's prune and save steps ran.
- **Caveat on push runs:** push runs share the ref's concurrency group
with `cancel-in-progress: true`, so a merge can cancel the previous
merge's run before it saves. Of the 20 newest `main` push runs, 18
succeeded and 2 were cancelled, so the save should land on most merges.
## Judgment calls
1. **The restore is gated on the install outcome**, the same condition
as the build it serves, so a run that will not build does not spend a
restore. `bundle-analysis`'s restore has no `if:`, and the turbo cache
policy test does not constrain this.
2. **The save's 5 min bound is not yet derived from this step's own
runs**, because no run of this job has saved this cache. The workflow
comment says so. The bound rests on the nearest measured save of the
same 40-task entry, `bundle-analysis`'s 1 s save (objectui#7048's
arithmetic), and the comment says to re-derive it from this step's own
runs. Including the pinned build's 2 min save, this job's save bounds
total 7 of its 30 minutes.
## Checks run
- All 90 `scripts/__tests__/*.test.ts` files that read workflows,
`repo-gates` or the CI/CD page pass. This includes
`report-turbo-cache.test.ts` (each job has its own prefix and only one
restore key, only push saves, the prune runs before the save, the report
reads the summary) and `workflow-cache-save-bound.test.ts` (saves use
the split form, run after the last command and stay within the job
ceiling). Before the 2 pin updates, those 2 tests failed.
- `check-governed-queue-guard --test` → GOVERNED.
- `repo-gates.yml` parses with the `yaml` package.
- These checks pass: `check-action-ref-convention`,
`check-pre-install-import-graph`, `check-control-bytes`,
`check-doc-links`, `check-new-cross-file-line-citations` (0 new) and
`check-changeset-presence` (no changeset owed: no released package
source changed).
- actionlint is not installed and the repo has no wrapper for it, so it
was not run.
## Checklist
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WJozybDmRH8z2c5SD7vJkj
Co-authored-by: Claude <noreply@anthropic.com>1 parent f3044f7 commit 3688e5c
3 files changed
Lines changed: 101 additions & 2 deletions
File tree
- .github/workflows
- content/docs/guide
- scripts/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
402 | 432 | | |
403 | 433 | | |
404 | 434 | | |
405 | 435 | | |
406 | 436 | | |
407 | 437 | | |
| 438 | + | |
408 | 439 | | |
409 | 440 | | |
410 | 441 | | |
| |||
481 | 512 | | |
482 | 513 | | |
483 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
484 | 575 | | |
485 | 576 | | |
486 | 577 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
640 | 644 | | |
641 | 645 | | |
642 | 646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
272 | 274 | | |
| 275 | + | |
| 276 | + | |
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
| |||
0 commit comments