internal(ci): Cut CircleCI critical path and skip tests on docs-only changes - #4112
Conversation
…changes - Build legacy TS types inside `setup` (only when esmodule-relevant) and drop the separate `setup-esmodule-types` job hop. - Build each legacy TS version concurrently (output is byte-identical), and drop topological ordering since each package only reads its own lib. - Halt lint/typecheck/unit_tests/node_matrix when only docs, website (except Playground) or tooling paths change; halt `setup` too when nothing downstream is relevant. - Treat root package.json and scripts/ as esmodule-relevant. - Use here-strings in relevance checks so pipefail+SIGPIPE can't flip them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PoENobJ7nEmcJd4ZB5LwC
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
ntucker
left a comment
There was a problem hiding this comment.
Staff review (tip 3f418100) — LGTM; no CHANGE_THIS_PR.
Critical path fold is sound: setup already persists project/packages (so ts* rides along without the old job’s extra persist), ci:build:types-and-legacy keeps types before downtype, and test-lib stays parallel with that chain. Fail-open on missing flags, here-strings under pipefail, Playground carve-out (tests otherwise skip only when every path is docs/website/tooling), and expanding the esmodule regex to root package.json + scripts/ are the right seams. Concurrent build-legacy-types.sh matches the old per-dir overlay order (earlier custom → downtype → own custom); rest’s g:runp split preserves the same overlays.
FOLLOW_UP (ops, not a code change): before merge, drop ci/circleci: setup-esmodule-types from branch protection if it is still required — same open question as in the PR body. Soft watch on first package PRs: -j unlimited legacy work now shares the large setup box with types + test-lib; if wall time or OOM erodes the hop savings, cap parallelism rather than bringing the hop back.
Hold merge until Bugbot success/waive and CircleCI green on this tip.
|
Size Change: 0 B Total Size: 103 kB ℹ️ View Unchanged
|
CircleCI parses `<<` as parameter syntax, so the here-strings likely kept the pipeline from compiling. Grep a temp file instead (still no pipes, so pipefail can't flip a check). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PoENobJ7nEmcJd4ZB5LwC
ntucker
left a comment
There was a problem hiding this comment.
Staff review (tip 58b9ecf7) — LGTM; no CHANGE_THIS_PR.
Delta since 3f418100: swap here-strings for printf → /tmp/ci-changed-files then grep. Correct under CircleCI YAML (<< is parameter syntax); still avoids pipefail/SIGPIPE flips. Prior fold/-j unlimited/fail-open/Playground carve-out/esmodule regex notes hold.
FOLLOW_UP (ops, unchanged): drop ci/circleci: setup-esmodule-types from branch protection if still required; soft-watch first package PRs for setup box contention under -j unlimited. Soft: PR body still says here-strings — update when convenient.
Hold merge until Bugbot success/waive and CircleCI green on this tip.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4112 +/- ##
=======================================
Coverage 97.84% 97.84%
=======================================
Files 156 156
Lines 3057 3057
Branches 612 612
=======================================
Hits 2991 2991
Misses 18 18
Partials 48 48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- CI builds legacy types only for TS >= 4.0 (endpoint, normalizr, rest); nothing in the esmodule-types matrix reads ts3.4. Release builds are unchanged (all 14 output dirs still byte-identical). - build-legacy-types.sh calls downlevel-dts and cp directly instead of a yarn boot per step, and uses set -e. - Relevance checks write git diff straight to the file and use grep exit status; setup's later steps read the flags from BASH_ENV. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PoENobJ7nEmcJd4ZB5LwC
ntucker
left a comment
There was a problem hiding this comment.
Staff · tip 16300da2 · LGTM + FOLLOW_UP (no CHANGE_THIS_PR)
Delta since 58b9ecf7: relevance checks write git diff straight to /tmp/ci-changed-files and invert grep; setup later steps read flags from BASH_ENV (cache files stay for downstream). ci:build:legacy-types narrows to --include endpoint/normalizr/rest with LEGACY_MIN_TS=4.0 (drops -R --from react/rest/graphql and -j unlimited). build-legacy-types.sh uses set -e, direct downlevel-dts/cp, and below_min — rest’s own legacy scripts are unchanged.
That trim matches the matrix: oldest tested TS is 4.0; react/graphql/core only emitted ts3.4 under the old recursive walk. Pipefail/here-string soft notes from the prior tip are addressed in code + body.
FOLLOW_UP (ops, not this PR): drop required check ci/circleci: setup-esmodule-types if branch protection still lists it.
Hold merge until Bugbot + CircleCI are green on 16300da2 (setup already passed; esmodule-types/unit matrix still running — good live check of the include/LEGACY_MIN_TS path).
|
Here's how I handled each Staff review item. All three reviews were LGTM with no CHANGE_THIS_PR.
CircleCI is green on Generated by Claude Code |
- Diff with --no-renames (and quotePath off) so moving a file out of packages/ into docs/website still runs tests. - Run every job on the default branch instead of diffing HEAD~1, which misses earlier commits of a multi-commit (rebase-merge) push. - Treat root tsconfig*.json, babel.config.js and .yarnrc.yml as esmodule-relevant. - Copy only .d.ts files from src-*-types into published ts* dirs, as copyfiles did (portable find/cp, no GNU --parents). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PoENobJ7nEmcJd4ZB5LwC
Requested by Nathaniel · project thread
Motivation
On package PRs, CircleCI takes about 3.75 min from push to the last green check. The critical path is
setup→setup-esmodule-types→esmodule-types-*, and the middle job is mostlyci:build:legacy-types(about 48s on 4 vCPU) plus job spin-up and workspace attach/persist. Website/docs-only PRs (for example #4104) still run the full unit, node, lint and typecheck matrix, which takes about 2.3 min even though none of it can be affected.Solution
scripts/build-legacy-types.shbuilds each TS version concurrently. It callsdownlevel-dtsdirectly instead of booting yarn for every step, and it copies only.d.tsfiles fromsrc-*-types.lib, then its own custom types.rest's inline script is split into tworun-phalves, using a newg:runphelper.ci:build:legacy-typesbuilds only the TS >= 4.0 outputs: endpoint, normalizr and rest, withLEGACY_MIN_TS=4.0. The oldest TS in the esmodule-types matrix is 4.0, so nothing in CI readsts3.4.ts*dirs are byte-identical to master's output, and the CI step went from 48s to about 15s locally.set -e. Before, a faileddownlevel-dtsor copy could letbuild:typesfinish with incompletets*dirs; now it fails.setup-esmodule-typesjob. When the esmodule flag is set,setuprunsci:build:setup:esmodule, which builds types and then legacy types, in parallel with the test lib build. That removes a job hop of about 75s, andesmodule-typesnow runs alongside the unit tests.testsrelevance flag.lint,typecheck,unit_testsandnode_matrixhalt when every changed path is docs, website or tooling:website/(exceptwebsite/src/components/Playground/, which has unit tests),docs/,.changeset/,.cursor/,.agents/,.claude/,.github/, or a root*.md.setupalso halts before install.setup's own later steps read the flags fromBASH_ENV.package.json, roottsconfig*.json,babel.config.js,.yarnrc.ymlandscripts/.--no-renames, so moving a file out ofpackages/still counts as a package change.grep -q. CircleCI runs bash withpipefail, where a SIGPIPE could flip a check. Here-strings aren't an option either, because CircleCI treats<<as its own parameter syntax..cursor/rules/ci-config.mdc.How I validated it
bash -eo pipefailfor docs-only, Playground, packages, scripts, rename, empty-diff and default-branch cases.Open questions
setup-esmodule-typesis not among the required status checks, so removing it doesn't block merging.🤖 Generated with Claude Code
https://claude.ai/code/session_019PoENobJ7nEmcJd4ZB5LwC