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
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
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.