Repository navigation
test(stories): add a story of the whole chat - #127
pratikbuilds wants to merge 3 commits into
Conversation
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. Stacked on #126: only this pull request's own changes were checked. Notes:
|
e312fe9 to
4bc9068
Compare
260ee19 to
22da640
Compare
TheGreatAxios
left a comment
There was a problem hiding this comment.
Automated multi-agent review: independent review + second-agent validation; only confirmed items listed. The story itself is genuinely strong; the e2e spec under it has one blocking structural error.
-
blocking (verified against Ladle 5.1.1 itself — package contents + routing source)
e2e/full-chat.spec.ts:9-11— the spec drives Storybook URLs (/iframe.html?id=…&viewMode=story&globals=theme:light, waits forbody.sb-show-main) at a Ladle server. Ladle ships exactly one HTML file (lib/app/index.html, noiframe.html), ignoresid/viewMode/globalsparams, has nosb-show-mainclass ever, and its own comment inplaywright.config.tscalls it "the Ladle stories build" — so all five tests fail at the firstgoto, permanently, in CI. Fix: use the sibling spec's real Ladle scheme —page.goto(\${STORIES}/?story=chat-full-chat--${story}&mode=preview&theme=light`)and wait for[data-storyloaded](the story idschat-full-chat--settle/--stickare already in correct Ladle format) — then rerunbun run build && bun run test:e2e`. -
should-fix (plan gap)
stories/chat/full-chat.stories.tsx:473-486— the Sources family never composes: the story'scase "sources"branch is dead code because the only sample carrying asourcespart (shortChat) is never mounted, while task 15's objective is "prove every family composes". Give one mounted answer asourcespart. -
minor (process) no
e2e/fixtures.tsxentry, while the plan requires one entry per scenario and every sibling spec follows that contract. Defensible here (the composition lives in the story and the axe sweep hits the same server) — but say so in the PR body rather than silently dropping it. -
minor (flake)
e2e/full-chat.spec.ts:133-141— Stop is clicked on a live label that exists for a single 120 ms replay frame, from inside apage.waitForFunction(..., { polling: "raf" })side effect; one missed frame = permanent false condition = 30 s timeout despite a clean settle. Poll read-only (expect.pollon the trigger text) and click via locator. -
nits —
onOpen={(image, opener) => …}misnames an index (the prop hands over(index, opener); rename toindex,:470); approved tool outputs are hardcoded"Done"(:~308) — vary or derive them; attached files are never openable (viewerItemsOfonly mapsimagekinds and message-tileAttachmentPreviewgets noonOpen— story-coverage follow-up);MODELS/MODES/attachment refusal copy is duplicated fromprompt-input.stories.tsx/attachments.stories.tsxand already diverged (2 vs 3 models;MAX_FILESvs literal20) — hoist tosamples/.
4bc9068 to
dba5b9e
Compare
22da640 to
be03ac7
Compare
dba5b9e to
b402e73
Compare
be03ac7 to
4f86f25
Compare
b402e73 to
5f8dcec
Compare
4f86f25 to
163203b
Compare
|
Thanks for the review. Here's what happened to each point. On the blocking itemThis repo runs Storybook 10, not Ladle (see Fixed1. The Sources component never appeared in the whole-chat story (should-fix)
2. The Stop test was flaky (minor)
3. Nits
Not changed, and why
Also in this PRA Commits: |
5f8dcec to
c8ba54f
Compare
163203b to
92e2515
Compare
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Request changes
Adds a story of the whole chat. Stop and unmount do clear the replay timer in the story. The e2e does not prove that.
Findings
-
e2e/full-chat.spec.ts:164— Stop can pass while the next frame is still scheduled.playTurnemits the running frame and queues the next one 120ms later (play-turn.ts:183).stopAnswerappliesstopped()synchronously (full-chat.stories.tsx:1194-1205), so "1 failed",data-status="sent", and the tool'serrorare already true beforepage.clock.resume(). Resume unpauses and does not advance that 120ms, anddata-status="sent"is also the natural last frame. Droppingstop.current?.()and keeping the state update still goes green if the expects finish inside the step. After Stop,runForseveralREPLAY_STEP_MSand assert the tool is stillerror. -
e2e/full-chat.spec.ts:191— The "4 replies" expect does not wait for the streamed answer.sendappends the user reply andplayTurnemits the empty streaming frame in the same turn (full-chat.stories.tsx:988-996,play-turn.ts:185). The parent count isthreadReplies.length, so it becomes 4 before any timer. AplayTurnthat emits once and returns would still pass. Wait for the reply text before asserting the count.
Compose the new chat family from the shared samples into one story, in both scroll policies: a conversation with agent steps, approvals and generated images, a prompt input with its toolbar and attachments, the conversation map and history window, and a panel with a thread tab. A browser spec drives the story to check that sending settles, approvals keep keyboard focus after they fold, and attachments move into the sent message.
No mounted message carried a sources part, so the Sources family never rendered in the whole-chat story. Start the recent stretch with the short-chat sample, whose answer cites two sources, and check them in the browser spec. The Stop test had to hit a call that runs for one 120 ms replay frame, clicking from inside a raf-polled waitForFunction. Under CPU load it missed the frame, or clicked as the settled frame landed. Hold the page clock once the story has loaded and step the replay a frame at a time, so the running frame stays put while Stop is pressed. Also name the GeneratedImages onOpen index for what it is, and derive an approved call's output from its name instead of a fixed "Done".
The full-chat ThreadTab kept its stop function in a ref written during render, so unmounting could call the latest one. Make the function stable with useCallback instead and return it from the effect.
92e2515 to
7c44aa4
Compare
Compose the new chat family from the shared samples into one story, in both scroll policies: a conversation with agent steps, approvals and generated images, a prompt input with its toolbar and attachments, the conversation map and history window, and a panel with a thread tab. A browser spec drives the story to check that sending settles, approvals keep keyboard focus after they fold, and attachments move into the sent message.
Stacked on #126: review only this commit. Part of #94.
Notes for review
Verification
bun run typecheckandbun run linton its own (the stack is checked commit by commit).bun run check,bun run build,bun run dep-guard,bun run contrast-testandbun run test:e2e(Playwright specs and the Storybook axe sweep in light and dark) pass.Closes #109