Skip to content

test(desktop): deselect-proof the code-scroll selection drag - #4632

Merged
Astro-Han merged 1 commit into
apache:mainfrom
orangeCatDeveloper:test/code-scroll-drag-flake
Sep 3, 2026
Merged

test(desktop): deselect-proof the code-scroll selection drag#4632
Astro-Han merged 1 commit into
apache:mainfrom
orangeCatDeveloper:test/code-scroll-drag-flake

Conversation

@orangeCatDeveloper

@orangeCatDeveloper orangeCatDeveloper commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The code-scroll selection-drag test raced selection anchoring: mousedown on a guessed container offset (codeBox.x + 24) sometimes landed outside the glyphs — cold-start font loading reflows the line after the box is measured — so no selection anchor formed and the long drag auto-scrolled without selecting, failing at the end with an opaque zero. The fix makes anchoring observable instead of assumed: measure after document.fonts.ready, anchor on the first [data-line], prove the selection exists with a short in-viewport drag, then start the long auto-scroll drag. A future anchoring failure now surfaces at the establishment step with a retry window.

Fixes #4633

Verification

Before (unpatched, first run after a fresh build:with-deps; same failure as CI run 33726683004):

Error: expect(received).toBeGreaterThan(expected)
Expected: > 10
Received:   0
Call Log:
- Timeout 10000ms exceeded while waiting on the predicate

After (patched, five consecutive runs including the cold one):

1 passed (7.9s)
1 passed (7.4s)
1 passed (7.7s)
1 passed (7.3s)
1 passed (7.3s)

Anchor-position mechanism confirmed by counter-experiment: anchoring at x + 2 (leading whitespace) fails 4/5 runs.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — diagnosis, patch, and this description, under the contributor's direction; the commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it

@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 3, 2026
The selection-drag assertion raced selection anchoring: mousedown on a
guessed container offset sometimes never formed a selection anchor
(cold-start font reflow moves the glyphs), so the long drag
auto-scrolled without selecting and failed with an opaque zero at the
end. Anchor on the measured first line after fonts settle, prove the
selection exists with a short in-viewport drag, then start the long
auto-scroll drag.

Generated-by: Claude Code
@orangeCatDeveloper
orangeCatDeveloper force-pushed the test/code-scroll-drag-flake branch from 72d05b6 to 30f0a0a Compare September 3, 2026 07:39

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at exact head 30f0a0ac84b7206bc16147531172149ea89f46c5. I found no blocking or non-blocking issues.

The test now waits for font loading, anchors against the first rendered code line, and proves that an in-viewport selection exists before exercising horizontal auto-scroll. This localizes the previous opaque zero-length failure without weakening the wheel, keyboard, auto-scroll, or final-selection assertions.

I independently confirmed the prior CI failure ended with a zero-length selection, rebuilt Desktop at this head, and passed the changed Electron test 5/5. Moving the anchor into the leading edge caused the new establishment assertion to fail, confirming that it detects the intended failure mode. A synthetic merge with current main was clean, and that merge result also built and passed the changed test. The exact-head hosted test check is complete and successful.


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

@Astro-Han
Astro-Han merged commit fde3253 into apache:main Sep 3, 2026
1 check passed
@orangeCatDeveloper
orangeCatDeveloper deleted the test/code-scroll-drag-flake branch September 3, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky desktop e2e: code-scroll selection drag intermittently selects nothing

3 participants