Repository navigation
ci: print failed coverage logs and cap vitest workers - #1920
Conversation
The Coverage job hid the failing test behind Nx Cloud's summary, and unbounded vitest workers timed out a random package on the 4-core runner.
The hidden test output and the worker cap belong on the PR Coverage job.
|
View your CI Pipeline Execution ↗ for commit ad356a1
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@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-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-memory
@tanstack/ai-mistral
@tanstack/ai-neon
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@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-typesafe
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-worldlabs
@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.
|
| Layer / File(s) | Summary |
|---|---|
Select and print failed-task logs scripts/print-failed-nx-logs.mjs, scripts/print-failed-nx-logs.test.ts, package.json |
The script selects terminal-output files whose hashes are not recorded as successful, labels them from task details when available, and prints their contents. Tests cover selection, output, and a missing terminal-output directory. The maintainer test command now includes these tests. |
Integrate diagnostics into coverage runs .github/workflows/pr.yml |
The coverage job sets VITEST_MAX_WORKERS to 1 and stages the log-printing script. Both coverage runs print selected logs after a nonzero Nx exit and then return the original exit status. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant CoverageJob
participant Nx
participant printFailedNxLogs
participant WorkspaceDataSQLite
participant terminalOutputs
CoverageJob->>Nx: Run coverage task
Nx-->>CoverageJob: Return nonzero status
CoverageJob->>printFailedNxLogs: Pass cache and data paths
printFailedNxLogs->>WorkspaceDataSQLite: Read successful task hashes and task details
printFailedNxLogs->>terminalOutputs: Select and read logs not matching successful hashes
printFailedNxLogs-->>CoverageJob: Print selected task logs
CoverageJob-->>CoverageJob: Exit with original Nx status
Suggested reviewers: alemtuzlak
Merge Risk: 
Minimal · up to ad356
-
The Coverage diagnostic change is mergeable after normal checks.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passed-
Full details: Description check
-
Explanation
The description is complete and follows the repository template. It explains the cause, fix, alternatives, testing, linked issue, release impact, and rollback risk. It also states that pnpm test:pr was not run.
Full details: Out of Scope Changes check
-
Explanation
The changed workflow, log-printer script, script tests, and
test:maintainerregistration support the CI failure described by issue#1909. The changes do not modify published package code or add unrelated documentation or release work.
-
Full details: Linked Issues check
-
Explanation
Issue
#1909requires failed Coverage task output and fixes for timing-sensitive tests inai-harnessandai-react. The workflow andprint-failed-nx-logs.mjsimplement the log-output requirement.scripts/print-failed-nx-logs.test.tsandtest:maintainerprovide coverage for that script. The diff contains no timing-sensitive test fixes.VITEST_MAX_WORKERS: "1"limits workers inside each Vitest process, but the workflow still runs Nx packages in parallel and does not set--parallel=N.Resolution
Update the timing-sensitive coverage tests identified by issue
#1909and add or update focused automated tests for those fixes. If failures remain under load, also cap Nx task parallelism with--parallel=Nwithout adding retries.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 2 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Coverage✅ Coverage held across 75 compared package(s). Each package is measured twice in this job — on this PR and on its merge-base with
|
The Coverage job on a pull request fails one package at random. The job log does not show the failed test. This change prints that log. It also limits each Vitest run to one worker.
🎯 Changes
The PR Coverage job calls
nx run-manywith no worker limit. Nx Cloud then hides the Vitest output. The job now setsVITEST_MAX_WORKERSto1and, after a non-zeronxstatus, prints the failed task log from.nx/cache/terminalOutputs.No docs change. Coverage behavior for readers of the docs is the same. No changeset. This pull request does not change a published package.
✅ 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. A pull request that touches many packages runs Coverage on about 76 packages. The job goes red. The log names the Nx task only.
Cause.
.github/workflows/pr.ymlrunsnx run-manywith noVITEST_MAX_WORKERS. Each Vitest process uses every CPU core. Nx runs 4 packages at the same time on a 4-core runner. A timeout then moves between packages. Nx Cloud does not print task output in CI. A success is acache_outputsrow with code 0. The failed log stays in.nx/cache/terminalOutputs/<hash>.Fix. The Coverage job sets
VITEST_MAX_WORKERSto 1. Ifnxexits non-zero, the job prints each terminal log whose hash is not a code-0 cache hit. Then the job exits with thenxstatus. The job copies the printer to$RUNNER_TEMPbefore the merge-base checkout.Possible alternatives
--parallel=1. Nx runs one package at a time. Not taken. One Vitest worker still lets Nx run 4 packages at once.NX_NO_CLOUD=true. The log is visible, and the merge-base run loses the remote cache. Not taken.waitFor. The failed package changes from run to run. Not taken. Short sleeps inreload.test.tsfail on a fast machine, not under CPU load.Testing
Commands run.
pnpm exec vitest run scripts/print-failed-nx-logs.test.tspassed (3 tests).pnpm test:prwas not run. The change is the Coverage job plus one script test. CI runs that test throughtest:maintainer.Manual test.
8731d75d5, runnode /tmp/repro-1909.mjs <clean-main-worktree>. The command exits 1:ad356a1f2), run the same command against a detached worktree. The command exits 0 and printsREPRO PASS.How this PR makes testing easy.
scripts/print-failed-nx-logs.test.tsbuilds a small Nx cache. It makes sure that the printer shows the failed task and skips a code-0 success.Linked issues
Closes #1909
Risk / rollback
Risk is low. Revert this pull request to restore the old job. The worker limit can make Coverage slower.
VITEST_MAX_WORKERSis not an Nx input, so the remote cache hash stays the same.Summary by CodeRabbit