Repository navigation
fix: guard the usage total and stop a PDF test flaking under load - #148
Merged
Merged
Conversation
The text-limit test and workerErrorExit allowed 5 s. Under a loaded parallel suite the 180-page extraction ran past that and returned "PDF extraction timed out", or tripped the helper's own timer, so the test failed although the text limit worked. Both now allow 30 s, and the test 60 s.
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two follow-ups to #146, which merged before the first could be pushed:
ChatUsage(apps/web/features/bot-chat/chat-usage.tsx) renders the total withtotal !== null &&instead oftotal &&. This addresses React Doctor'srendering-conditional-renderwarning on feat(web): show each bot chat's model and tool usage #146.totalis a string or null, so no0could have shown; this makes the condition explicit.extractPdfText > worker text limit fails without a timeoutnow allows 30 s for each oversized PDF extraction instead of 5 s, and 60 s for the whole test instead of 15 s.workerErrorExit, which has its own guard timer, uses the sameSLOW_WORKER_MSconstant. The other tests' 5 s limits are unchanged; they extract small fixtures.Replaces #147.
Why
The PDF test checks that the text limit stops a 180-page PDF before any timeout. Under a loaded parallel suite the extraction itself took longer than 5 s, so the test failed although the text limit worked:
runPdfExtractionreturned"PDF extraction timed out"instead of"PDF extraction failed"(line 136).workerErrorExit's 5 s guard fired instead (expect(timedOut).toBe(false), line 67).Locally it failed in most pre-push runs and blocked pushing the usage fix. CI on
mainpassed.Evidence
bun run checkpasses on the branch: lint, format, typecheck,openapi:check, and 1323 tests, 0 failing. The pre-push suite passed on push.bun run doctorinapps/web) reports nothing inchat-usage.tsx.bun test apps/server/src/files/pdf-text.test.ts -t "worker text limit fails without a timeout"), on the same machine:main(5 s / 5 s)"PDF extraction timed out"workerErrorExit5 sworkerErrorExitAlone, the test still takes about 3.5 s.
Risk and rollback
Reversibility: Reversible.
Blast radius: The web bot details Usage section (no visible change) and one server test file; no production server code changes.
If extraction ever really hangs, the PDF test now takes up to 60 s to fail instead of 15 s.