Repository navigation
Frontend bug fixes - #396
Conversation
…g IME composition
|
@claude pr-review |
|
Claude finished @leekahung's task in 2m 3s —— View job PR review
The PR is in good shape. Every fix has a clear cause, and the fixes are small. The redaction rewrite is the biggest change and it is correct: it matches once on the raw text and escapes only the text around each match. That removes the problems where a term matched inside an HTML entity or inside a black box added for an earlier term. Sorting terms longest first, so a longer term wins over a shorter term it contains, is a good detail. I found no blocking issues. A few small points are below. Worth addressing1. "Feedback Sent!" can still show when nothing was sent. (
Note that the Minor / non-blocking2. The 3. Closing the modal while a send is in flight. ( 4. The error message has no room in the layout. ( 5. Overlapping matches next to each other. The opening delimiter is consumed by the match rather than checked with lookbehind, which is the deliberate trade-off for Safari support. As a result, a term that ends in a non-word character, placed directly before another match (e.g. 6. Looks good
NoteI couldn't run |
…before redacting the feedback transcript
What type of PR is this? (check all applicable)
Description
Fixes several frontend bugs found in a review of the chat, feedback, and letter flows. Each bug was reproduced first, either in the running app or with a test that fails on
main.Chat input
/chatand coming back, the box looked empty, but "Start Chat" still sent the old text. The box now shows the saved text.<and&reached the backend as<and&. The text is now stored as typed. Rendering was already safe: react-markdown shows HTML as plain text, and follow-up messages never went through DOMPurify.keyCode229).Feedback
Empty feedback was still submitted: the empty check closed the dialog but didn't stop the send.
Double-clicking Send submitted twice.
"Feedback Sent!" appeared before the request, and failures were silently lost. The dialog now waits for the request:
Redaction rewritten. It previously ran a separate regex for each term over the already-escaped transcript. That caused four problems:
C++or(503threw an error, and the feedback was never sent.(503) 555-1234or$1000silently didn't match.ampor039, or a second term matching the first term's black box, corrupted the transcript HTML.Josleft theéofJosévisible.Redaction now runs one pass over the raw text with Unicode-aware word boundaries, then escapes the text around the redactions. It doesn't use lookbehind, which Safari below 16.4 can't handle (Vite's default target is
safari14).Letter
/letterpath, which no longer exists.Letternow decides it from the sanitizedorgvalue, using a newsanitizeOrg()helper shared with the prompt builder. The notice shows only for real partner links, not for?org=with an empty or invalid value.Cleanup
dompurifydependency and itsArchitecture.mdentries.Letter.test.tsxthat targeted a path that doesn't exist.Related Tickets & Documents
None.
QA Instructions, Screenshots, Recordings
Tested in Chromium (Playwright against
vite devwith/api/*mocked) and in jsdom unit tests. Safari IME behavior is covered by a unit test only./chat/or, type a description, go to Home, then come back to Chat. The text should still be in the box, and "Start Chat" sends what's shown.rent < $1000 & deposit. The request body should contain it exactly as typed./letter/orand/letter/or?org=%21%21show no "redirected" text;/letter/or?org=legal-aiddoes./api/feedbackreturning 500, Send shows an error and keeps the typed text, and retrying works.(503) 555-1234, C++in a chat containing those strings. The transcript shows black boxes and the HTML isn't broken.Added/updated tests?
main. New files:FeedbackModal.test.tsxandLetterGenerationDialog.test.tsx. New cases in theInitializationForm,InputField,LetterandfeedbackHelpertests. 173 tests pass.Documentation
Architecture.mdhas been updated (removed the DOMPurify entries)[optional] Are there any post deployment tasks we need to perform?
None.