Repository navigation
test(ai-sandbox-vercel): stop the large-file write test timing out in CI - #2323
Conversation
toHaveBeenCalledWith compared the 1 MiB Uint8Array one byte at a time. That took about 1 s locally and more than the 5 s test timeout on a busy CI runner, so @tanstack/ai-sandbox-vercel:test:coverage was red on main. Fixes #2322
|
|
View your CI Pipeline Execution ↗ for commit 14dbfc9
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
Coverage✅ Coverage held across 1 compared package(s). Each package is measured twice in this job — on this PR and on its merge-base with
|
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-cartesia
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-computer-local
@tanstack/ai-computer-playwright
@tanstack/ai-computer-sandbox
@tanstack/ai-computer-use
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-effect
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-harness
@tanstack/ai-harness-cli
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-e2b
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-mcp-sandbox
@tanstack/ai-memory
@tanstack/ai-meshy
@tanstack/ai-mistral
@tanstack/ai-muse
@tanstack/ai-neon
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-optimize
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-railway
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-svelte
@tanstack/ai-tripo
@tanstack/ai-typesafe
@tanstack/ai-uthana
@tanstack/ai-utils
@tanstack/ai-vercel-compat
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-worldlabs
@tanstack/ai-zai
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
@tanstack/ai-sandbox-vercel:test:coverageis red onmainbecause one test times out on a busy CI runner. The test compared a 1 MiBUint8Arrayone byte at a time. This PR compares that payload by reference, so the test takes 2 ms.🎯 Changes
packages/ai-sandbox-vercel/tests/fs-write.test.ts: the large-file test readswriteFiles.mock.calls[0]and usestoBefor the payload. It still checks one call, the path, and the options.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Root cause
Issue. The
Coverageworkflow onmainfails at@tanstack/ai-sandbox-vercel:test:coverage. The failed test isVercelHandle.fs.write > uploads a large file in one writeFiles call, with no exec, withError: Test timed out in 5000ms. The failure is intermittent: 3 of the last 12 runs onmainpassed.Cause.
expect(writeFiles).toHaveBeenCalledWith([{ path, content: payload }], ...)does a deep comparison. For aUint8Array, Vitest compares each element, here 1,048,576 of them. That takes about 0.9 s on a fast laptop and 1.6 s with v8 coverage. On a 4-core runner that runs 106 tasks, it takes more than the 5 s test timeout. The test arrived in #2256.Fix. The handle passes the caller's array to
writeFileswithout a copy, so the test compares the payload withtoBe. That is one reference comparison.Possible alternatives
it. The test stays slow, and a slower runner can still exceed the new limit.Testing
Commands run.
pnpm exec nx run-many --targets=test:types,test:oxlint,test:lib,test:coverage --projects=@tanstack/ai-sandbox-vercel: 11 tasks passed.pnpm exec oxfmt --check packages/ai-sandbox-vercel/tests/fs-write.test.ts: passed.pnpm test:pr. The diff is one test file in one package. CI runs the rest.Repro. A local machine is too fast to reach 5 s, so the repro uses a 300 ms timeout. The same command ran against the test file from
main(f18a309f1) and the test file from this branch.main:This branch:
Manual test.
main, go topackages/ai-sandbox-verceland runpnpm exec vitest run tests/fs-write.test.ts --testTimeout=300. The first test times out.pnpm exec vitest run tests/fs-write.test.ts --reporter=verbose. The first test takes about 2 ms.How this PR makes testing easy. The changed test is the artifact. No new test or script is necessary.
Linked issues
Fixes #2322
Risk / rollback
Low. Only a test changed. If the handle starts to copy the payload, the
toBeassertion fails, which is the correct signal for this test. To undo, revert the PR.Fixes #2322
Summary by CodeRabbit