Repository navigation
Conversation
|
@claude pr-review |
|
Claude finished @leekahung's task in 1m 20s —— View job PR review
Verdict: This looks good to merge. I didn't find any blocking issues. Each fix targets a real bug, and each one comes with a test that would catch it coming back. CI (PR Checks and CodeQL) is green. I didn't run the suite locally. The checkout had no What works well
Non-blocking suggestions and observations
Repo checklist (
|
What type of PR is this? (check all applicable)
Description
Follow-up to #396: more fixes from a review of the chat and letter streaming code, plus some cleanup. Each bug fix has a test that fails on
main.Fixes
/api/queryresponses were read as a stream even when they failed. A 500, or the proxy's 502/504 HTML page, ended up in Brainy's bubble. Failed responses now show the usual "Sorry, I encountered an error" message.addMessageread the message list from the last render, so the new message was included only because React happened to re-render before react-query called the fetch. Callers now pass the history explicitly. That also removed thestartStreaminghandoffLetterused to work around this.Date.now(), so a request that failed within the same millisecond gave the user message and the error notice the same id (a duplicate React key). A smallcreateId()helper adds a counter. I didn't usecrypto.randomUUID()because it's undefined over plain HTTP on a LAN address, which would break phone testing withvite --host.Cleanup
ChatandLetterduplicated about 40 lines of layout, nowlayouts/ChatPageLayout.tsx. A duplicate wrapper div inside it is also gone. Before/after layout measurements match exactly at 1440px and 390px.MessageWindowtakes ahiddenMessageCountprop instead of checking whether the URL starts with/letter.InputFieldtakessetValueinstead of building a fakeChangeEvent.src/tests/testUtils.tsxholdsrenderWithProviders,LocationProbe, fake stream readers andmessagesAddedBy. ThescrollTo/showModal/closestubs moved tovitest.setup.ts. About a dozen test files use them instead of their own copies.Left for a follow-up: the chat scrolls and refocuses the input on every streamed line, and in-flight requests are never cancelled. Cancelling needs
Letter's run-once effect restructured to work under StrictMode.Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Tested in Chromium (Playwright against
vite dev, with/api/queryeither mocked or left with no backend) and in jsdom unit tests./letter/or/portlandshould show "Unable to generate letter"./chatand/letterat desktop and phone widths, before and after the first message and with the letter panel showing. It should look the same asmain.Added/updated tests?
MessageWindow,InputField,useMessages,Letter), and the Frequent Inquiries tests were updated for the collapsed default. 180 tests pass.Documentation
Architecture.mdhas been updated (addedChatPageLayout.tsxandtestUtils.tsx)[optional] Are there any post deployment tasks we need to perform?
None.