test(app): deflake cached tab paint probe - #41965
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Deflakes the “cached session tab paint” smoke test by delaying “first paint” recording until the timeline is fully hydrated (specifically, until markdown’s synchronous fallback pass is gone), so post-hydration DOM morphing doesn’t get misclassified as cached-tab teardown.
Changes:
- Tightens the probe’s
firstPaintgating conditions to also require no[data-markdown-key="initial"]fallback content. - Exposes a
painted()probe method and updates the test to wait forfirstPaintbefore starting the observation window.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+192
to
+197
| if ( | ||
| !firstPaint && | ||
| visible.includes(last) && | ||
| Math.abs((bottom?.bottom ?? Infinity) - view.bottom) <= 1 && | ||
| !root.querySelector('[data-markdown-key="initial"]') | ||
| ) { |
Hona
enabled auto-merge (squash)
August 12, 2026 07:46
Hona
disabled auto-merge
August 12, 2026 10:21
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.
Flake
smoke: session timeline › paints cached session tabs at the latest messagefails under CPU load withExpected: 0, Received: 10on theremovedassertion. On unmodifiedv2it fails 4-6 of 8 with--repeat-each=8 --workers=4 --retries=0, while passing in isolation.The ten removed nodes are exactly the ten
<br>elements from the markdown renderer's synchronous fallback pass. TheMarkdowncomponent renders in two passes: a sync fallback block (keyinitial) that escapes text and converts newlines to<br>, then an async worker-parsed result that replaces the fallback block via morphdom because the block key changes. On a fast machine the parsed result lands before the probe records first paint; under load it lands after, so the probe snapshots the fallback<br>nodes into its first-paint WeakSet and then counts their intended replacement as cached-tab row teardown.Fix
The probe now only records first paint once markdown hydration has settled: in addition to the existing conditions (last message visible, bottom spacer aligned), the timeline root must contain no
[data-markdown-key="initial"]element. The test also waits for first paint to be recorded before the 200ms observation window, so theremoved === 0assertion still observes a real post-hydration window and still guards against genuine cached-tab row teardown.The two-pass markdown render is intended product behavior; only the test probe changes. The
samplescollection is unchanged, so the paint-at-latest and bottom-alignment assertions still evaluate the first non-empty sample.Validation
bunx playwright test e2e/smoke/session-timeline.spec.ts:120 --repeat-each=10 --workers=4 --retries=0→ 10/10 passbunx playwright test e2e/smoke/session-timeline.spec.ts→ 5/5 passbun typecheckinpackages/apppasses