Conversation
…o a whole pixel A pick scrolls to the heading's top less 80 px. That top is often fractional (Rollout at 1522.22 px in the e2e plan); Chromium snaps the scroll offset to a whole pixel (1442), so the heading sat 0.22 px below the activation line. The pick marked Rollout at once, then the scroll's own event a frame later re-read the position and marked the heading above it (Idempotency keys). The spy now counts a heading within 1 px below the line as reached. The e2e asserted in the same frame as the pick, so it passed whenever it beat the scroll event and failed on a slower CI runner. It now waits two frames before reading the mark.
1 task
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.
Fixes the intermittent
tests/e2e/inbox-contents.spec.ts:122failure ("side:" and "full:") that hit #2413 and #2389 in the merge queue (runs 41165574822 and 41166537619: expected "Rollout", received "Idempotency keys").Cause
This is a product bug. The test only exposed it some of the time.
scrollTopreads 1442 (or 1486), not 1442.22. Rollout ends 0.22 px below the line.scrollevent runs the scroll-spy (activeHeadingBinding). The spy reads the real position, sees that Rollout has not reached the line, and marks the heading above it, "Idempotency keys". The wrong mark stays.Timeline from a probe in the page (local, full layout):
The e2e checked
toHaveText('Rollout')in the same frame as the pick. So it passed when its first check ran before the scroll event, which is usual on a fast machine, and it failed on a slower CI runner.Fix
packages/ui/utils/headingScrollSpy.ts: a heading that is up to 1 px below the activation line now counts as reached (CONTENTS_SNAP_TOLERANCE). This matches the 1 px slack the spy already uses at the document's end. The rail and the Inbox's Contents sheet (useHeadingScrollSpy) both use this function, so the fix covers both. Plan review'suseActiveSectionis not changed.tests/e2e/inbox-contents.spec.ts: after a pick, the test waits two animation frames before it reads the mark. This makes sure the scroll event has run, so the test checks the settled state, not the same frame as the pick. No timeout was raised and no retry was added.packages/ui/utils/headingScrollSpy.test.ts(new): the picked heading is current at both a rounded and a floored snapped offset, and a heading 4 px below the line is not current yet. The first test fails without the tolerance.Repro numbers (macOS, headless Chromium, compiled binary built review → hook → opencode → compile)
--repeat-each 10(both layouts)--repeat-each 5--repeat-each 20inbox-contents.spec.tsUnit tests:
packages/ui/utils,packages/ui/hooks,MarkdownContentsRail.test.tsxandpackages/inbox/documentContents.test.tsxpass (1254 tests).tsc -p packages/uiis clean. The fix has no server change (Inbox only, UI only).