Skip to content

test(stories): add sample conversations for the chat stories - #117

Merged
TheGreatAxios merged 3 commits into
conversation/12-panelfrom
conversation/02-samples
Oct 28, 2026
Merged

TheGreatAxios merged 3 commits into
conversation/12-panelfrom
conversation/02-samples

Conversation

@pratikbuilds

Copy link
Copy Markdown
Collaborator

Add deterministic samples built only from the conversation contract: a short chat, a 300-message history, a tool storm with a batch, a failure and every approval outcome, generated images, a thread and a failed send. playTurn reveals a message's parts over time for streaming stories. Images are inline SVG, timestamps are fixed, and nothing reads the clock or Math.random.

Stacked on #116: review only this commit. Part of #94.

Notes for review

  • Sample unit tests live beside the samples under stories/ and run with bun test stories/chat/samples; bun run test only covers src/.
  • Streaming stories built on playTurn should start paused or play on a user action: the axe sweep waits for CSS animations, not timers.
  • Follow-up: stories/chat/conversation.stories.tsx still has its own placeholder history; move it onto the samples when it first renders contract messages.

Verification

  • This commit passes bun run typecheck and bun run lint on its own (the stack is checked commit by commit).
  • At the top of the stack: bun run check, bun run build, bun run dep-guard, bun run contrast-test and bun run test:e2e (Playwright specs and the Storybook axe sweep in light and dark) pass.

Closes #96

Add deterministic samples built only from the conversation contract:
a short chat, a 300-message history, a tool storm with a batch, a
failure and every approval outcome, generated images, a thread and a
failed send. playTurn reveals a message's parts over time for streaming
stories. Images are inline SVG, timestamps are fixed, and nothing reads
the clock or Math.random.
@corbits-triage

corbits-triage Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

Stacked on #116: only this pull request's own changes were checked.

Notes:

  • added code matches a code pattern: stories/chat/samples/samples.stories.tsx:47 Invented fallback `?? 0`; handle the missing value instead.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated multi-agent review: independent review + second-agent validation of every flag; only confirmed items listed. Everything below is minor and verified by running the helper.

  • minor stories/chat/samples/play-turn.ts:49-60 — a queued call (status: "pending", no approval record) replays as running first, then regresses to pending: toolStages only short-circuits approval-requested and running, so bare queued traces fall through to the synthetic-running branch (verified repro). Add part.status === "pending" to the no-stage branch plus a regression test asserting a queued call never shows running before its final frame.
  • minor stories/chat/samples/play-turn.ts:100 — turnFrames can emit a duplicate no-op frame after a tool batch whose last call contributes no stage (final running/approval-requested with no record makes started[last] equal the settled form; verified). Fix: skip a frame whose parts equal the previous frame's, or stop the batch loop one short.

The sample replay gave a queued call (pending, no approval record) a
synthetic running frame, so it ran and then went back to pending. It
is now shown queued from the start, like a waiting or running call.

A tool batch also emitted one frame per call, so a call with no
earlier form produced a frame identical to the one before it. The
batch now finishes only the calls that change, one at a time, and
leaves the rest in their final form, so every frame differs from the
previous one.
@pratikbuilds
pratikbuilds force-pushed the conversation/02-samples branch from 05fc47b to 42b5877 Compare October 27, 2026 13:25
@pratikbuilds

pratikbuilds commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Both points are fixed.

1. A queued call replayed as running first, then went back to pending (minor)

  • The fix: a queued call (pending, no approval record) now shows as queued from the first frame, just like a waiting or running call.
  • Test: "shows a queued call in its final form at once, never as running".

2. A tool batch could produce a duplicate frame (minor)

  • The fix: the batch now steps through only the calls that actually change, one at a time, and leaves the rest in their final form. This also covers a stage-less call in the middle of a batch, and a batch where no call has a stage, which stopping the loop one short would have missed.
  • Tests: "never repeats a frame after a batch call that has no stage", plus a check across every sample message.

Commit: fix(stories): replay queued and stage-less tool calls faithfully

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review · Approve

Adds sample conversations and a play-turn helper for the chat stories.

Findings

No findings.

@pratikbuilds
pratikbuilds force-pushed the conversation/02-samples branch 2 times, most recently from 475d220 to d6f1c71 Compare October 28, 2026 11:28
The Samples table caption said Frames counts the steps a streaming
story plays for the last message, but no story replays a sample's last
message. It now says the column is how many steps turnFrames gives for
that message.
@pratikbuilds
pratikbuilds force-pushed the conversation/02-samples branch from d6f1c71 to 8eb4d54 Compare October 28, 2026 14:47
@pratikbuilds

Copy link
Copy Markdown
Collaborator Author

Round 3 fixes

A fresh review pass over the stack turned up the points below; each is fixed in a new commit at the end of this branch, and the stack is rebased onto it.

  • 8eb4d54: The Samples caption described a replay no story performs; it now says what the Frames column counts.

bun run check and dep-guard pass on every branch of the stack, and the full e2e suite passes at the top of the stack (163/163, including the stories axe sweep). Each behaviour fix comes with a test that fails without it; the forwardRef tests can only guard, since the suite runs on React 19.

@TheGreatAxios
TheGreatAxios removed this pull request from stack #130 October 28, 2026 21:38
@TheGreatAxios
TheGreatAxios added this pull request to stack #139 October 28, 2026 21:38
@TheGreatAxios
TheGreatAxios force-pushed the conversation/02-samples branch from 8eb4d54 to 7873d58 Compare October 28, 2026 21:42
@TheGreatAxios
TheGreatAxios merged commit 4c04a0f into main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sample conversations for the chat stories

2 participants