Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
|
Chat: Review posted | View chat Review historydeep-review v0.13.0 | Round 4 | Last posted: Round 4, 5 findings (3 P4, 2 Nit), APPROVE. Review Finding inventoryFindings
Contested and acknowledgedCRF-1 (P4, SmoothText.ts:288) - unreachable
|
| Reviewer | Focus |
|---|---|
| Bisky | tests |
| Chopper | ops/errors |
| Churn-guard | change verification |
| Ging | language modernization |
| Gon | naming |
| Hisoka | edge cases |
| Killua | perf |
| Kite | change integrity |
| Knov | contracts |
| Knuckle | SQL |
| Komugi | flake/determinism |
| Kurapika | security |
| Law | decomposition |
| Leorio | docs |
| Luffy | product |
| Mafu-san | process |
| Mafuuu | contracts |
| Melody | dispatch/pairing |
| Meruem | structural |
| Nami | frontend |
| Netero | mechanical checks |
| Pariston | premise testing |
| Pen-botter | product gaps |
| Razor | verification |
| Robin | duplication |
| Ryosuke | Go arch |
| Takumi | concurrency |
| Zoro | shape |
🤖 Managed by Coder Agents.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
This PR replaces the per-frame grapheme walk in sliceAtGraphemeBoundary with one Segments.containing() call and switches to the lib Intl.Segmenter types. 2 P4, 1 Nit.
Out of scope (needs a ticket or explicit acceptance by a human):
site/src/pages/AgentsPage/components/ChatConversation/SmoothText.ts:285: the unchanged comment ongraphemeSegmenterrestates the top-levelconstand repeats the fallback note from the doc comment at line 293, so the two must be kept in sync.site/src/pages/AgentsPage/components/ChatConversation/SmoothText.ts:293: the doc comment describes mechanism ("it is used for correct grapheme handling") instead of the contract, the largest boundary withinmaxCodeUnitLengthcode units.site/src/pages/AgentsPage/components/ChatConversation/SmoothText.ts:320: the fallback comment cites "the O(n) Array.from() cost" of an earlier implementation that no longer exists.site/src/pages/AgentsPage/components/ChatConversation/SmoothText.ts:341:sliceGraphemesbuilds an array of every cluster intextto keep the firstmaxGraphemes, the same full walk this PR removes, applied to the whole input.site/src/components/Avatar/Avatar.tsx:18: a second module-scoped segmenter uses locale"en"whileSmoothText.tsuses the default locale, so the two can segment the same text differently; it also keeps an unreachabletypeof Intl.Segmenterfallback.site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/RenameChatDialog.tsx:29: the same unreachableIntl.Segmenterguard and fallback.
Notes:
- Measured in Node 22 (V8, ICU) with the cut near the end: on 48k characters of mixed text the removed walk took 11.2 ms per call and
containing()0.049 ms. On runs of regional-indicator flagscontaining()grows with run length because ICU backs up to the run start, but it stayed below the walk at every size measured. SpiderMonkey was not measured.
🤖 This review was automatically generated with Coder Agents.
| } | ||
| return null; | ||
| })(); | ||
| const graphemeSegmenter = |
There was a problem hiding this comment.
P4 [CRF-1] The typeof Intl.Segmenter === "function" guard keeps a fallback that no supported browser and no test reaches. (Nami, Bisky)
site/package.json browserslist is chrome 111, firefox 128, safari 16.4; Intl.Segmenter shipped in Chrome 87, Firefox 125 and Safari 14.1, and the Node runtime that runs vitest has it too, so the codepoint loop in sliceAtGraphemeBoundary and the Array.from(text) branch of sliceGraphemes never run. The lib types this PR adopts declare Intl.Segmenter as always present, so the guard no longer matches the types it relies on. Make graphemeSegmenter a plain new Intl.Segmenter(undefined, { granularity: "grapheme" }), delete both fallback branches, and update the doc comments that describe the fallback.
🤖
There was a problem hiding this comment.
Main's SmoothText.ts already falls back when Intl.Segmenter is missing and this PR keeps that, and on main Avatar.tsx and RenameChatDialog.tsx already pair the lib types with the same typeof guard, so the pairing is main's pattern and removing it belongs in a separate cleanup of all three.
🤖 Posted using
/amend-reviewskill via Coder Agents.
There was a problem hiding this comment.
The defense holds: the fallback and the guard are on main, and the PR adds no new fallback. The cleanup across SmoothText.ts, Avatar.tsx and RenameChatDialog.tsx is listed as out of scope in the review body.
🤖
There was a problem hiding this comment.
The reply above stands: the guard and fallback are main's, and the cleanup of all three files is out of scope here.
🤖 Posted using
/amend-reviewskill via Coder Agents.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Since the last review, the PR renames away cut, drops the ! on containing() in favor of ?.index, and updates the benchmark paragraph in the description. 1 P4.
The variable naming and the description fixes are verified. The defense on the unreachable Intl.Segmenter fallback is accepted: the guard and fallback are on main, and the same guard is in Avatar.tsx and RenameChatDialog.tsx.
Out of scope (needs a ticket or explicit acceptance by a human):
site/src/pages/AgentsPage/components/ChatConversation/SmoothText.ts:288: thetypeof Intl.Segmenterguard and the fallbacks insliceAtGraphemeBoundaryandsliceGraphemes, together with the same guards inAvatar.tsx:18andRenameChatDialog.tsx:29, are code that no browserslist target or test runs. The proposed cleanup of all three files has no ticket.
🤖 This review was automatically generated with Coder Agents.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
13c9108 to
158e5ab
Compare
cd9adb6 to
f2cb1be
Compare
0771b38 to
efb20b8
Compare
f2cb1be to
f97530c
Compare
AgentChatInput wrote the --mobile-dropdown-* custom properties on <html> on every focus and keystroke at every viewport width, and a custom property change on the root restyles every element. Only the below-md dropdown utilities read them, so write them only below md, and only when the value on <html> differs.
…n test for what it checks
… of a changed dropdown variable
…check Chromium, WebKit and Firefox already skip a setProperty that sets the value an element's style holds: on a 60k-element page it queued no mutation record and took 0 ms, against 25 to 141 ms for a changed value. The check and its test covered behavior the browser provides.
… one helper The below-md stub was a copy of stubViewport with another query and one caller, and stubViewport already takes the query, so the caller uses it.
…the root variable test The test relied on the matchMedia stub in site/test/setup/polyfills.ts, which matches no query, and its comment credited jsdom with it. It now stubs the below-md query to false, as the below-md test stubs it to true.
Radix ScrollArea renders a <style> element per instance, and WebKit restyles the whole document whenever a stylesheet is added or removed, so every streamed code block that mounted or unmounted cost a document-wide style recalculation. Code blocks now scroll in a plain overflow element that uses the global scrollbar color.
…d View-focus states Add stories that end with the attachment card focused and with View focused, and drop the visibility assertion from AssistantMessageWithImage.
…om the card's focus-within The composer card now sets the buttons' opacity and visibility through custom properties on its own hover and focus-within, as the transcript's attachment frame does, and the buttons sit where they are on main. The wrapper, peer classes, pointer-events, isolate and z-10 are gone; with main's DOM order the upload overlay again paints over Paste inline and under Remove. Hidden with visibility, the buttons leave the tab order and the accessibility tree. A card whose preview is not a button (a PDF, for example) has nothing else to focus, so it shows them at rest, and devices without hover show them as the transcript does. The stories end with the card, Paste inline and Remove focused; ThumbnailFocused ended on Remove and is now RemoveFocused.
…lainly The shared play helper and args constant only saved a few lines across three stories; each story now tabs to its control and the later ones reuse CardFocused.args, as ConversationTimeline does. The waits for animations are gone: the Pixel preview disables transitions.
…sibility comments
… synchronous render
…tons in the tab order With visibility, Shift+Tab from the composer skipped Paste inline and Remove, and a card without a focusable preview showed Remove at rest, which flipped as an upload finished. The buttons hide with opacity only again, as on main; focus shows them through the card's focus-within, and a pointer-events variable keeps them from taking taps while hidden. PasteFocused and RemoveFocused now reach their buttons with Shift+Tab.
…screenshots FE1 keeps assertions out of play functions, and the Pixel capture of each focus story shows whether Tab reached its control. CardFocused focuses View, so it is now ViewFocused, and the comments say what the stories do.
…ent variables replace
…age frame at rest AssistantMessageWithImage now ends without focus, so its screenshot shows Download hidden; the Tab to Download moves to AssistantMessageWithImageDownloadFocused. The attachment card comment names the two buttons focus shows.
…ink in the tab order The transcript's Download link was hidden with visibility, so Shift+Tab from below the attachment frame skipped it and the screen reader's virtual cursor did not find it. It now hides like the composer's buttons: opacity plus a pointer-events variable from the frame's own hover, focus-within and hover:none, so it stays in the tab order and does not take clicks over View's corner while hidden.
…ly while it shows With opacity hiding, the link's backdrop-blur-xs stayed applied at rest, and Chromium composited one layer per transcript attachment: 40 images took 45 layers instead of 5. The frame now sets the backdrop filter with the link's other variables, so a hidden link has none. The frame comments now say why hidden controls stay tabbable.
The frame drops the blur variable in the same style change that starts the opacity fade, so the link showed an unblurred chip until the fade ended. Transitioning backdrop-filter with opacity fades both together and still ends at none, so a hidden link keeps no compositing layer.
Vite 8 codeSplitting.groups include each matched module's imports by default, so the monaco group took React and Vite's preload helper, and every page preloaded the monaco chunk and its stylesheet. Turn that off for the lazily loaded monaco, xterm and emoji-mart groups. The radix-ui group keeps the default, which avoids a radix-ui and Command chunk import cycle.
Deleting the monaco, xterm and emoji-mart groups keeps monaco out of the entry chunk as turning off includeDependenciesRecursively did, with the same initial JS and no chunk import cycles, and without an option that Rolldown pairs with strictExecutionOrder. These libraries no longer get stable vendor chunk names.
A monaco group narrowed so it cannot match React still made index.html load the 4,178,496-byte monaco chunk: the entry imports Vite's preload helper from it.
An xterm group stays lazy: @XTerm imports neither React nor Vite's preload helper, and adding one changes the up-front JS by 17 bytes. An emoji-mart group takes React only when listed ahead of radix-ui; after it, React stays in the radix-ui chunk.
efb20b8 to
eff8991
Compare
sliceAtGraphemeBoundary iterated every grapheme cluster from index 0 on each animation frame while streaming. Segments.containing() finds the cluster at the cut directly. The local Intl.Segmenter types give way to the lib types.
…de Hangul clusters The Hangul sample used precomposed syllables, each one code unit, so no cut fell inside a Hangul cluster. Conjoining jamo form clusters of 3 and 2 code units, so the sample now has cuts inside them.
…at the cluster past the limit After the guards, 0 < maxCodeUnitLength < text.length, so a cluster always contains code unit maxCodeUnitLength, and it starts at the largest boundary that fits. Slicing at its index drops the end check and a fallthrough to the codepoint loop that never ran.
… the non-null assertion on containing() The site rules forbid non-null assertions. containing() returns undefined exactly when maxCodeUnitLength is at or past the end of the text, so that case now returns the whole text, and the length guard serves only the codepoint fallback.
…e length before segmenting A call at or past the end of the text returns again before segment() runs. After that check a cluster always holds index maxCodeUnitLength, and if containing() returned undefined, slicing to an undefined end would keep the whole text, so the optional index needs no assertion.
…y containing() finds a cluster The optional index read as if containing() could return undefined there. The comment now says the length check above leaves a cluster at index maxCodeUnitLength.
…h checks the cluster depends on containing() returns undefined for an index below 0 as well as at or past the end, so the comment now credits both early returns.
f97530c to
ed1928d
Compare
…29596) Base: `main`. First of a stack; #31365, #31366, #31367 and #31572 follow. `useChatDropdownPosition`, which both chat composers use, sets five `--mobile-dropdown-*` properties on `<html>` from an effect that re-reads the composer's position on focus, input, selection, scroll and resize, at every width. Only below-`md` utilities read them, and a changed custom property on the root restyles every element. Browsers skip a write of an equal value, so on `main` the root restyles each time a value changes, for example when the composer grows by a line. This PR runs the effect only below `md`, where dropdown positioning is unchanged. #31278 bench (a tool, not for merging) on production builds of `f348cd66d7` (this PR's base on `main` then) and the pre-rebase version of `af7b2c7b4a` (this PR; later commits change only tests), one chat with 72k nodes at 1800 px, 3 alternating runs per side: | keystroke that wraps the composer | `main` | this PR | |---|---|---| | Chromium | 467 to 649 ms | 17 to 32 ms | | WebKit | 3,381 to 3,892 ms | 99 to 118 ms | Other keystrokes and focusing the composer did not change beyond noise. <details> <summary>Run details</summary> Each run types 560 characters after 340 prefilled ones, so the composer grows by a line 6 times in Chromium and 5 in WebKit. Each wrap cell gives min to max over the wrapping keystrokes of all 3 runs. | p50, min to max | `main` | this PR | |---|---|---| | Chromium, other keystrokes | 23 to 24 ms | 23 to 24 ms | | WebKit, other keystrokes | 97 to 99 ms | 97 to 98 ms | | Chromium focus, pointer | 11 to 13 ms | 11 to 15 ms | | WebKit focus, pointer | 271 to 332 ms | 303 to 324 ms | </details> > 🤖 This PR was created with the help of Coder Agents, and has been reviewed by a human. 🏂🏻
f1fe215 to
cd2b08c
Compare
Base: #31367 (
perf/site-monaco-chunk). Last of five stacked fixes.While a reply streams,
sliceAtGraphemeBoundarywalked every grapheme cluster from the message start on each animation frame. It now asksSegments.containing()for the cluster at the cut. Tests compare it with a full walk at every cut of emoji, combining-mark, Hangul and CRLF samples. The libIntl.Segmentertypes replace the local ones.#31278 bench (a tool, not for merging), production builds of the pre-rebase versions of
99783c681e(base) and401b7007ae(this PR), both onmainatf348cd66d7. Later commits in #29596, #31365, #31366 and #31367 change only comments, attachment controls, tests and stories; later commits here keep onecontaining()call per frame. 3 alternating runs of 2 fresh chats, each streaming a reply that grows from 43k characters to 48k or 49k during typing:WebKit shows no gain beyond noise: its ranges overlap. Chromium suggests a small one: its ranges separate by 1 ms (medians 130 against 121 ms), as 3 runs per side also do by chance 1 time in 10. Frames over 50 ms fill 100 to 104% of every run's phase because that figure counts each in full, even one already running when the phase starts, so it cannot show an effect; key latency follows frame length and can.
An earlier WebKit profile on a smaller transcript put the full walk at 8.8% of JS samples and
containing()at 2.1%. This run has no profile: production builds lack source maps, and the profiling build, which has them, timed out WebKit's inspector at 121k to 123k DOM nodes.