test(examples-chat): kill aimock-e2e flake (chunkSize + data-streaming wait)#327
Merged
Conversation
…flake Aggressive default chunking sometimes splits a triple-backtick mid-token, producing inline <code> rendering instead of <pre><code>. The harness tests measure FINAL rendered structure (streaming-progressive behavior is covered by the Phase 1 unit-variance tables), so single-chunk replay is the right tradeoff. Comment in the runner documents the choice.
…streaming=false Asserting on intermediate streaming-state DOM is the other source of e2e flake. The chat composition flips chat-message[data-streaming] to 'false' when the agent's isLoading() goes false; helper waits on that DOM contract before returning the finalized bubble. Smoke, markdown, and A2UI specs all route through the helper now.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two-part fix for the recurring e2e flake noted in #314 and #322.
What caused the flake
<code>instead of<pre><code>. Showed up as the "code fence" spec failing.<li>immediately after seeing assistant text, sometimes catching a transient 1-or-2-item state during streaming. Showed up as the "bullet list" spec failing.Fix
chunkSize: 4096on the runner so each response arrives in 1–2 SSE deltas. Streaming-progressive behavior is already covered by Phase 1's unit-variance tables (#305); the e2e harness tests final-state invariants and cross-stack integration, not the streaming partial-render path.sendPromptAndWaithelper intest-helpers.tsthat waits onchat-message[data-role="assistant"][data-streaming="false"]before returning the finalized bubble. The chat composition already exposes this DOM contract — wiring[streaming]="agent.isLoading() && i === lastIndex"tochat-message's host attribute — but the specs weren't using it. Smoke, markdown, and A2UI specs now route through the helper.Verification
Ran the full Playwright suite 5 times consecutively locally: 5/5 clean (no flakes). Before this PR, runs failed 2/5 to 3/5 on either the code-fence or the bullet-list spec. Runner unit tests still pass (3/3).
Note on the streaming-DOM contract
While investigating I confirmed the
data-streamingattribute on<chat-message>already exists at libs/chat/src/lib/primitives/chat-message/chat-message.component.ts:28. No@ngaf/chatchange was needed — this was a test-side bug, not a library feature gap.Test plan