Repository navigation
ci: Add a type-check perf budget and path-type fuzz check - #4182
Conversation
scripts/typeperf generates stress fixtures and fails the typecheck job when a fixture's TypeScript instantiations rise more than 10% over budget.json, or when PathKeys/PathArgs/ShortenPath/PathArgsAndSearch/KeysToArgs disagree with the frozen pre-#4173 implementation on ~1500 fuzzed paths. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N84vEuMmAW2qsip7Nd8sGG
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4182 +/- ##
==========================================
+ Coverage 98.06% 98.08% +0.02%
==========================================
Files 163 165 +2
Lines 3098 3139 +41
Branches 617 625 +8
==========================================
+ Hits 3038 3079 +41
Misses 18 18
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Review of commit Independent impact: Medium. The change adds a gate to the CircleCI typecheck workflow and a local check for contributors changing public types; defects can block that workflow or weaken regression detection, while published runtime behavior remains unaffected.
|
fileURLToPath instead of URL.pathname, so the check runs on Windows and in paths with spaces. The patheq LCG lost precision past 2^53 and picked mostly even alphabet indices, so only 1 of 1500 fuzzed paths had a ':' param; mulberry32 gives 377. The richer corpus still matches orig.ts, and a one-character change to orig.ts now trips 782 assertions instead of 76. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N84vEuMmAW2qsip7Nd8sGG
|
Both fixed in this PR in 1f59d51:
Generated by Claude Code |
|
Staff engineer (Cursor agent): LGTM at 1f59d51. Both Codex fixes check out ( FOLLOW_UP (after merge, not blocking):
On #4179: its +18.9% on |
A new fixture without a budget.json entry used to pass unguarded. A full --update now also drops entries for removed fixtures. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N84vEuMmAW2qsip7Nd8sGG
|
Follow-up 2 is folded in here (3ae0010). A fixture with no budget entry now fails and asks for Follow-up 1 (moving to TS 7) is queued as its own change. Generated by Claude Code |
check.mjs now calls gen.mjs's generate(), so naming fixtures only generates those. Also: plain `import ts`, shared M/BIG constants, and unused imports dropped from the fixtures (instantiation counts unchanged). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N84vEuMmAW2qsip7Nd8sGG
Requested by Nathaniel · project thread
Follow-up to #4173 (endorsed in its Staff review).
Motivation
Type-check cost regressions in our public types only show up when someone measures by hand. #4133 made
set()updaters on a large Union 3x slower to check and nothing in CI noticed.Solution
yarn check:typeperf(run in CircleCI'stypecheckjob, ~20s) generates stress fixtures, type-checks each with TypeScript 6, and fails when:scripts/typeperf/budget.json(instantiations are deterministic per TS version; check time is printed for context only)patheqfixture comparesPathKeys/PathArgs/ShortenPath/PathArgsAndSearch/KeysToArgsagainst the frozen pre-enhance(rest): Faster type checking for RestEndpoint, resource() and extend() #4173 implementation on ~1500 fixed-seed fuzzed paths, so any behavior drift fails.Fixtures: 150 RestEndpoints with long paths +
extend+paginated, 40 resources × React hooks, 40 resources × Vue composables, a 30-member Union, a 300-field Entity, nested relations, Query/All/Invalidate schemas, a typical app, and #4133'sset()values/updaters. After an intended change,yarn check:typeperf --updatere-records the budget; it also says when a count drops >10% so wins get locked in. Verified the check fails on a lowered budget and on a one-character change toorig.ts.Relation to #4179
Against this budget, #4179's types measure: setValues −71%, setUpdaters −49%, bigEntity −25%, resources −9%, and union +18.9% (13,578 → 16,142). So whichever of the two merges second needs
yarn check:typeperf --update(and #4179 should confirm the union increase is acceptable). The budget is recorded from master, not from #4179, so the drops don't hide that increase.🤖 Generated with Claude Code
https://claude.ai/code/session_01N84vEuMmAW2qsip7Nd8sGG
Generated by Claude Code
Note
Low Risk
Additive CI and dev tooling only; no runtime or published API behavior changes, though future type edits may need budget or
orig.tsupdates.Overview
Adds
yarn check:typeperfand wires it into CircleCI’stypecheckjob so public.d.tschanges can’t silently blow up consumer type-check cost or drift REST path typings.The new
scripts/typeperfpipeline generates gitignored stress fixtures (resources/hooks, unions, long paths,ctrl.set()updaters, Vue, etc.), type-checks each with the repo’s TypeScript, and fails when a scenario’s instantiation count exceedsbudget.jsonby more than 10% or when checking reports errors.--updatere-records budgets (and flags >10% wins). Apatheqscenario assertsPathKeys/PathArgs/ShortenPath/PathArgsAndSearch/KeysToArgsstay equivalent to the frozen pre-#4173 types inpatheq/orig.tson ~1500 fixed-seed fuzzed paths.AGENTS.mdand.cursor/rules/ci-config.mdcdocument local usage (afteryarn ci:build:types) and the CI step.Reviewed by Cursor Bugbot for commit ebb2450. Bugbot is set up for automated code reviews on this repo. Configure here.