Skip to content

test: stabilize flaky widget-tag streaming assertion (#3314) - #3378

Merged
iamwhatever merged 1 commit into
mainfrom
fix/flaky-widget-tag-test-3314
Aug 13, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/flaky-widget-tag-test-3314

Conversation

@bolichen97

Copy link
Copy Markdown
Collaborator

test: stabilize flaky widget-tag streaming assertion

Problem

MochiChatPanel.coverage.test.tsx > ChatPanel streaming footer > drops a half-arrived widget tag rather than showing its markup fails intermittently in CI while passing locally. Observed on PR #3302, run 31710742636, shard Frontend Tests (4) at head cba9e9778 — a PR whose diff cannot reach this test's code paths.

Why it matters

A shard that fails on a file the diff cannot reach costs every unrelated PR a re-run and trains reviewers to distrust red CI.

Fix (symptom → root cause → change)

  • Symptom: the test fails only on loaded 2-core CI runners, never locally.
  • Root cause: after the stream mock emits content containing a partial <mcwidget tag, the test awaits the positive assertion (findByText('Building it now'), which waits) but then immediately fires the negative assertion with a synchronous queryByText(/mcwidget/). The streamed-state commit that strips the partial tag is asynchronous; on a slow runner the assertion runs before React flushes, still sees the pre-strip markup, and fails.
  • Change: wrap the negative assertion in waitForawait waitFor(() => expect(screen.queryByText(/mcwidget/)).not.toBeInTheDocument()) — so the assertion polls until React commits. This is the determinism-conventions remedy for this flake class (poll, never sleep/rerun/relax) and the same pattern this file already uses for its other post-async negative assertion ("replaces the streamed text with the committed message").

The assertion semantics are unchanged: if the panel ever rendered the partial widget markup persistently, waitFor times out and the test still fails.

Tests

This PR is itself a test change. MochiChatPanel.coverage.test.tsx passes 82/82; full frontend suite 17990 passed / 0 failed on the branch; npx tsc -b clean.

Manual verification

N/A — unit coverage sufficient; the change is confined to one test assertion.

Screenshots

N/A — no user-visible UI change.

Closes #3314

Wrap the negative queryByText assertion in waitFor so React flushes the streaming state update before the assertion fires on slow CI runners.

Closes #3314
@bolichen97
bolichen97 requested a review from a team as a code owner August 13, 2026 19:42
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

Advisory UX-level review of 2c405b23e7b97c41c42cde6e743d5ff14c345215 — updated in place on each push; does not block merge.

UX-Verdict: PASS

Test-only change — one assertion wrapped in waitFor; no user-facing strings, components, or rendered pixels are touched.

[UX-REVIEWED] 2c405b2

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 2c405b23e7b97c41c42cde6e743d5ff14c345215 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2c405b2

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2c405b23e7b97c41c42cde6e743d5ff14c345215: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 2c405b23e7b97c41c42cde6e743d5ff14c345215 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2c405b2

Verdict parsed from the review's SHA-scoped output markers for commit 2c405b23e7b97c41c42cde6e743d5ff14c345215.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2c405b23e7b97c41c42cde6e743d5ff14c345215: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Advisory design-level review of 2c405b23e7b97c41c42cde6e743d5ff14c345215 — updated in place on each push; does not block merge.

Design-Verdict: PASS

Root-cause fix for a diagnosed CI race, using the repo's documented flake remedy and the file's own existing pattern; semantics preserved.

[DESIGN-REVIEWED] 2c405b2

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Aug 13, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) August 13, 2026 20:04

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tier 1 auto-approve: test stabilization (1 file). Criteria: no conflict, no requested changes, no security surface, AI reviewers green. Category: flaky test fix — stabilizes widget-tag streaming assertion timing (#3314 follow-up).

@iamwhatever
iamwhatever merged commit 786e86c into main Aug 13, 2026
56 checks passed
@iamwhatever
iamwhatever deleted the fix/flaky-widget-tag-test-3314 branch August 13, 2026 20:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Aug 13, 2026
encomjp pushed a commit to encomjp/kirocrew-customapi that referenced this pull request Aug 22, 2026
kirodotdev#3378)

Wrap the negative queryByText assertion in waitFor so React flushes the streaming state update before the assertion fires on slow CI runners.

Closes kirodotdev#3314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky: MochiChatPanel half-arrived widget tag test fails in CI, passes locally

2 participants