Skip to content

perf(build): overlap type checking and the AI index with the site build - #974

Open
letstokenize wants to merge 5 commits into
mainfrom
uddhav/optimize-vercel-deploy-time-a9f1fa
Open

letstokenize wants to merge 5 commits into
mainfrom
uddhav/optimize-vercel-deploy-time-a9f1fa

Conversation

@letstokenize

@letstokenize letstokenize commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Docs deploys now take about 2.5–4 minutes. Close to a minute of that is waiting that doesn't need to happen: the type check runs alone before the site build starts, and the first build pass waits on the AI search index. This overlaps both with the build, which brought a preview build down to about 2 minutes.

Changes

  • Run type checking alongside the site build. pnpm build runs check:types and build:site concurrently through pnpm's script selector, and still fails if either one fails. On Vercel the type check currently takes 33–53s before the build starts.
  • Don't block the first RSC scan on the AI search index. During plugin-rsc's reference scans, the server manifest resolves to an empty stub, so the index keeps fetching the external llms.txt sources in the background. The scans discard module bodies anyway. The real RSC build still waits for the full manifest. On main, scan 1 finishes one second after the index in every recent build.

Testing

Vercel, from pnpm run build start to build completion (8-core Enhanced machines):

Step main, last 6 production builds This branch, preview
Type check before the site build starts 33–53s 5s (finishes during scan 2)
Scan 1 (analyze client references) 43–53s, ends 1s after the AI index 24s
Passes 2–5 60–95s 85s (pass 3 waits about 4s on the AI index)
Total 153–224s 128s

This is one preview run against six main builds, and Vercel build times vary between runs.

Local A/B on the same tree (10-core Mac, AI index inactive without CLOUDFLARE_API_TOKEN): median 89s with type checking in parallel against about 102s sequential. Local machines see less gain because the type check competes with the build for CPU.

  • pnpm build, pnpm check:types, and Biome pass on the merged branch.
  • The deferral relies on plugin-rsc marking its scan builds with build.write = false and on Vocs' virtual:vocs/ai-search-manifest module ID. Both hold on the current versions (plugin-rsc 0.5.37, Vocs 2.10.3). If either changes, the plugin stops matching and the build behaves as it does today.

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tempo-docs Ready Ready Preview Oct 16, 2026 5:39am UTC

Request Review

…l-deploy-time-a9f1fa

# Conflicts:
#	.github/workflows/verify.yml
#	vite.config.ts
@letstokenize letstokenize changed the title perf(build): skip Zyzz and AI index waits in RSC scan passes perf(build): overlap type checking and the AI index with the site build Oct 14, 2026
…l-deploy-time-a9f1fa

# Conflicts:
#	package.json
…l-deploy-time-a9f1fa

# Conflicts:
#	vite.config.ts

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. The new Vite plugin depends on internals of vocs and plugin-rsc that I couldn't check from this checkout, so a human look would still be worthwhile.

What was reviewed:

  • package.json: the regex selector in pnpm run matches only check:types and build:site, and it runs after the guard-vocs-config.mjs guard.
  • vite.config.ts: isRscScanBuild uses write === false to decide whether a build is a scan. The only other write: false builds in the repo are in src/test/zyzz-integration.test.ts. They use configFile: false, so this plugin doesn't apply to them.
  • Not verifiable here: the vocs virtual module ID, the getAiSearchManifest export name and the claim that the index keeps building in the background. vocs isn't installed in this checkout.
Extended reasoning...

The change is limited to the build: package.json now runs type checking alongside the site build, and vite.config.ts adds a build-only plugin. During plugin-rsc scan passes, that plugin replaces a vocs virtual module with a stub. It touches no security-sensitive code (no auth, input handling or data exposure). I deferred because the plugin relies on vocs internals that aren't in this checkout: the \0virtual:vocs/ai-search-manifest ID, the shape of the getAiSearchManifest export, and where the index build starts. It also assumes that only plugin-rsc's scan builds set write === false. A small change in either dependency could quietly stub the manifest out of the real build, or leave it unstubbed during the scans.

This branch was successfully deployed

1 active deployment
Preview — 9ec67348 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant