Skip to content

fix: deflake the markdown react-parity lane and surface real batch timeout errors - #740

Merged
trueadm merged 1 commit into
mainfrom
fix/react-parity-markdown-lane-timeout
Aug 12, 2026
Merged

trueadm merged 1 commit into
mainfrom
fix/react-parity-markdown-lane-timeout

Conversation

@trueadm

@trueadm trueadm commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the intermittent failure of packages/markdown/tests/conformance/public-types.test.ts inside the parity-wide Vitest batch (node scripts/react-parity/check.mjs), which passed 100% standalone but failed ~2 of 3 full runs with an unreadable Error: STACK_TRACE_ERROR.
  • Makes future batch timeouts diagnosable: the real Test timed out in Nms… message now serializes into the batch report instead of the placeholder.

Why

  • The public-api probe is the only markdown lane test that does its compile-heavy await import('../../src/index') inside the test body (siblings import at module top level, which is collection-time and exempt from testTimeout). The markdown project had no timeout override, so vitest's 5s default applied; the import costs ~460ms standalone but pays the package's first Octane-plugin compile, which intermittently exceeds 5s under 136-lane batch contention. Forcing --testTimeout=50 through the same pipeline reproduces the reported failure byte-for-byte, confirming timeout (not a worker crash — a crash would trip the batch's coverage check instead of reporting a failed assertion).
  • The placeholder symptom is a vitest serialization gap: @vitest/runner's makeTimeoutError keeps the real message only on error.message and reuses the placeholder stack captured at it() registration (header Error: STACK_TRACE_ERROR), while the JSON reporter serializes error.stack || error.message — dropping the message.

Changes

  • vitest.config.js: markdown project gets testTimeout/hookTimeout: 30_000, matching the repo convention for compile-heavy projects (the sharded CI config derives from base, so it inherits). Placed in config rather than the test file because markdown's audit crosswalk pins the test files' identities.
  • scripts/react-parity/vitest-json-reporter.mjs (new): JsonReporter subclass that re-embeds each error's message into its stack before serialization, so failureMessages always carries the real failure. Replaces --reporter=json in the parity batch (check-lib.mjs), the harness single-lane vitest runners (harness-lib.mjs), and backs the unhandled reporter's formatting.
  • scripts/react-parity/check-lib.test.mjs: regression tests for the stack repair (timeout placeholder, already-embedded, headerless) and for end-to-end serialization through the real JsonReporter; argv expectations updated here and in harness-lib.test.mjs.
  • packages/octane-evals/datasets/train/user-apps-v1/manifest.jsonl: regenerated by pnpm sync — the eval grader digest hashes the root vitest.config.js, so every task's graderDigest moves with the config edit.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test (full local run: 20,917/20,921 passed; the 4 failures are pre-existing local flakes unrelated to this diff — doom-production browser matcher timeout and native-change checkbox ordering both pass standalone on rerun, and the swr focus/reconnect race predates this change and is tracked separately)
  • targeted tests: pnpm react-parity:test (464/464, includes the new regression tests); pnpm ci:workflow:test (87/87); markdown + markdown-differential projects under the root config (176/176); check.mjs --validate-only green after the config edit
  • determinism evidence: 5 consecutive parity-wide Vitest batches green on the markdown lane post-fix (pre-fix: 2 of 3 full check.mjs runs failed on it); forced --testTimeout=50 now reports Error: Test timed out in 50ms. with the registration-site frames instead of the placeholder
  • Full check.mjs cannot exit 0 on macOS regardless of this change: the drei pristine Playwright lane ships only a -linux.png snapshot baseline (pre-existing, unrelated). One batch run also surfaced a distinct swr focus/reconnect flake that fails ~1-in-3 standalone — readable in the report thanks to the new reporter; tracked separately.

Risk / follow-ups

  • The timeout raise only widens a budget; it cannot mask real hangs shorter than 30s that previously failed fast — acceptable for a lane whose failure mode is a compile racing CPU contention.
  • The reporter repair mutates only errors whose stack does not already contain their message, so ordinary assertion failures serialize unchanged (covered by the new tests).
  • Follow-up (separate): the swr focus/reconnect revalidation race in packages/swr/tests/upstream/root/root.test.ts.

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Changes are limited to test timeouts, CI reporter wiring, and eval digest metadata; the reporter only adjusts error stacks when the message is missing from the serialized stack.

Overview
Addresses intermittent markdown react-parity batch failures and unreadable Error: STACK_TRACE_ERROR reports when tests hit Vitest’s default timeout under heavy batch contention.

The markdown Vitest project now uses 30s testTimeout and hookTimeout so the compile-heavy in-test import in the public-types probe can finish during wide parity runs. Parity and harness Vitest invocations swap --reporter=json for a new vitest-json-reporter that rewrites timeout (and similar) errors so failureMessages include the real message, not only Vitest’s registration-time placeholder stack; the unhandled reporter reuses the same repair. user-apps-v1/manifest.jsonl is regenerated so each task’s graderDigest matches the updated root vitest.config.js.

Reviewed by Cursor Bugbot for commit 361df28. Bugbot is set up for automated code reviews on this repo. Configure here.

…meout errors

The markdown conformance public-api probe imports src/index inside the
test body, so the package's first Octane compile counted against
vitest's 5s default testTimeout and intermittently lost the race under
the 136-lane parity batch. The markdown project now carries the repo's
30s compile-heavy timeout convention.

The batch also reported such timeouts as 'Error: STACK_TRACE_ERROR'
because vitest's JSON reporter serializes error.stack alone while
makeTimeoutError keeps the real message only on error.message. A thin
JsonReporter subclass re-embeds the message into the stack before
serialization, wired into the parity batch, the harness single-lane
vitest runners, and the unhandled reporter.

Co-Authored-By: Claude Fable 5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 12, 2026
@trueadm
trueadm marked this pull request as ready for review August 12, 2026 19:17
@trueadm
trueadm merged commit 45d877c into main Aug 12, 2026
31 of 44 checks passed
@trueadm
trueadm deleted the fix/react-parity-markdown-lane-timeout branch August 12, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant