Skip to content

Let the wheel scroll settle before the chat resize measurement - #1505

Merged
alexeyzimarev merged 1 commit into
mainfrom
fix/chat-resize-anchor-flake
Oct 16, 2026
Merged

alexeyzimarev merged 1 commit into
mainfrom
fix/chat-resize-anchor-flake

Conversation

@alexeyzimarev

@alexeyzimarev alexeyzimarev commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Closes #1488 — AI-3781

What & why

The test wheels up, forces 16 render ticks, then resizes and checks that the anchored row stayed put. Each smooth-scroll frame's step comes from the wall-clock time since the previous tick (clamped to 1/240–1/20 s). Back-to-back ticks on a fast runner can leave part of the scroll unfinished. When the runner then pauses before the resize, the resize's frame takes one large step of the reader's own scroll (≈−2 px), which is the reported error. The resize anchoring itself is exact (+960 px offset for +960 px of extent above). The test now ticks until IsSmoothScrolling is false, capped at 500 frames.

Where to look

No product change: the scroll that keeps moving after the resize is the reader's own wheel input, and that's correct behaviour.

Verification

  • Probe log from the failing case: after the resize, the anchor compensation od=+960, then a second scroll change od=-1.945 ed=0 while smooth=True.
  • Mutation, [Repeat(40)] with Thread.Sleep(30) before the resize: unchanged test 41/41 fail (received 2 / received 3); with the fix 41/41 pass.
  • Fix + PreserveResizeAnchor disabled: 41/41 fail with received 960, so the test still catches a real regression.
  • ChatTabViewSmokeTests: 62/62 pass; app and test projects full-rebuild with 0 warnings.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved coverage of chat-tab resizing by checking that smooth scrolling has fully settled before the test completes. The test now allows scrolling to finish over multiple render frames and reports a failure if it does not settle within the allotted time. This makes the resize check less dependent on a fixed wait duration.

Frame steps scale with wall-clock time between forced ticks, so a fixed tick count
can leave the scroll moving and the resize's frame shifts the reader by a few px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: afe48855-7020-43d8-856c-b5462b7f28cd
📥 Commits

Reviewing files that changed from the base of the PR and between 71d714d and 55c4692.

📒 Files selected for processing: 1
  • test/Capacitor.App.Tests.Unit/ChatTabViewSmokeTests.cs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The resize test now advances render frames while smooth scrolling continues. It throws an InvalidOperationException if scrolling has not settled after 500 frames.

Changes: Resize Test

Layer / File(s) Summary
Wait for scroll settling
test/Capacitor.App.Tests.Unit/ChatTabViewSmokeTests.cs
The test replaces its fixed 16-frame wait with a loop that checks IsSmoothScrolling. It throws if scrolling has not settled after 500 frames.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Suggested reviewers: nortonandreev

Merge Risk: ⚪ Minimal · up to 55c46

This change makes the resize test wait for scrolling to finish and fail clearly if it does not settle. No concrete merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: waiting for wheel scrolling to settle before measuring the chat resize result.
Linked Issues check Passed Issue #1488 identifies an intermittent resize-anchor test failure caused by possible unfinished wheel animation. The change in test/Capacitor.App.Tests.Unit/ChatTabViewSmokeTests.cs replaces the fix…
Out of Scope Changes check Passed The whole-PR change is limited to the linked resize-anchor test. It changes test timing and adds a bounded failure path. The diff contains no product-code change or unrelated behavior change.
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Wait for wheel scrolling to settle before testing chat resize anchoring

🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Replace a fixed render-tick count with a wait for smooth wheel scrolling to finish.
• Cap the wait at 500 frames so an animation that never settles fails clearly.
• Prevent residual wheel movement from skewing the resize-anchor assertion; production behavior is
 unchanged.
Diagram

graph TD
  Wheel["Wheel input"] --> Active{"Still scrolling?"} -->|Yes| Tick["Tick and settle"] --> Active
  Active -->|No| Resize["Resize window"] --> Assert["Check anchor"]
  Tick -->|500 frames| Fail["Fail test"]
Loading
High-Level Assessment

Waiting on the existing smooth-scrolling state is appropriate: a fixed tick count depends on runner timing, while a timed sleep would slow the test without proving the animation finished. The frame cap keeps failures bounded.

Files changed (1) +4 / -1

Tests (1) +4 / -1
ChatTabViewSmokeTests.csSettle wheel animation before measuring resize anchoring +4/-1

Settle wheel animation before measuring resize anchoring

• The resize smoke test now forces render ticks while smooth scrolling remains active instead of stopping after 16 ticks. It fails explicitly if the animation has not settled after 500 frames, preventing remaining wheel movement from affecting the anchor-position check.

test/Capacitor.App.Tests.Unit/ChatTabViewSmokeTests.cs

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T06:43:19.095726Z 55c4692 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@alexeyzimarev
alexeyzimarev merged commit 6e2dc3d into main Oct 16, 2026
10 checks passed
@alexeyzimarev
alexeyzimarev deleted the fix/chat-resize-anchor-flake branch October 16, 2026 06:59
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.

ChatTabViewSmokeTests resize-anchor test fails on windows-latest

1 participant