Skip to content

Flaky: the Activity feed keyboard-scroll test reads the wrong first row in view #1006

Closed

Description

@V3RON

What happened

e2e/console/activity.spec.ts:373 "the Activity page › the feed scrolls inside itself with the keyboard, and counts the events that came in while scrolled down" fails in the Console (1/4) job, its retry too:

Error: expect(received).toEqual(expected) // deep equality
> 395 |       expect(await firstRowInView(page)).toEqual(inView);

What you expected

The test passes on every run of an unchanged commit.

How to reproduce

Seen on CI run 40184982178 on main at def25c8 (a commit that leaves the console alone). It passed on PR #1003 and PR #1004 at the same base.

Environment

GitHub Actions, Console (1/4) shard, chromium.

Logs and evidence

gh run view 40184982178 --log-failed.

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8), and nothing more.
    flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.
    on Oct 25, 2026
  2. self-assigned this
    on Oct 25, 2026
  3. V3RON commented on Oct 25, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    This is a defect in the test, not in the console. It notes the row in view before the history's end row has arrived. When that row arrives late, the feed keeps the reader at the end on purpose and moves the rows by the row's height. That gives the same result CI saw: -51 becomes the next row at -37.

    Branch bug/1006-repro, in e2e/console/activity.spec.ts: "the feed scrolls inside itself with the keyboard, and counts the events that came in while scrolled down". The test holds the real daemon's ?before= answer until after inView is noted, then releases it and waits for "Start of the history (".

    pnpm test:console --project=chromium e2e/console/activity.spec.ts -g "scrolls inside itself"
    
        -   "href": "/activity/evt_e16bb8da-…",
        -   "top": -51,
        +   "href": "/activity/evt_caafad57-…",
        +   "top": -37,
        > 410 |       expect(await firstRowInView(page)).toEqual(inView);
    

    Root cause

    e2e/console/activity.spec.ts:391 (on main) reads firstRowInView as soon as the box reaches its end. The older-page request that useNearEnd sends (ui/src/ds/feed.tsx:158-161) may still be in flight at that point. When it answers, the end row goes below the box and shrinks it. useStayAtEnd (feed.tsx:131-132) then scrolls to the new end, which is the behaviour the test at activity.spec.ts:404 asks for. The rows move by the end row's height: -51 - 46 + 60 = -37. On a loaded runner the answer can come after line 391.

    Simplest fix

    In the test only: release the gate once the box is at its end, wait for "Start of the history (", poll again that the box is at its end, and only then note inView. Keep the gate so the late answer is still forced. Locally this passed 5/5 (--repeat-each 5).

    Alternatives rejected

    • Stop useStayAtEnd moving the rows: this breaks the behaviour the test at line 404 pins.
    • Use PageDown so the reader is not at the end: this needs many more events.
    • Retry the assertion with expect.poll: this hides the move instead of ordering it.

    Risk

    • The fix must keep the gate. Without it, the test goes back to depending on timing.

    Written by an agent.

  4. removed their assignment
    on Oct 25, 2026
  5. added
    bug:readyAn agent may fix it.
    and removed
    bug:newReported. An agent may triage it (rule 8), and nothing more.
    on Oct 25, 2026
  6. self-assigned this
    on Oct 25, 2026
  7. V3RON commented on Oct 25, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1007 (#1006)

    Written by an agent.

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

Metadata

Metadata

Assignees

Labels

bug:readyAn agent may fix it.flaky-testNames a test that fails without a code change. Delivery skips its base-commit check.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions