Skip to content

test(browser): hold reading focus until the unread baseline is observed - #1182

Merged
kalvinnchau merged 1 commit into
mainfrom
larry/unread-startup-focus-hold
Oct 15, 2026
Merged

kalvinnchau merged 1 commit into
mainfrom
larry/unread-startup-focus-hold

Conversation

@loganj

@loganj loganj commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

🤖

Summary

  • Fixes a flaky browser test that failed on main 572a4ac (run 38737666184). The Alpha channel showed 499 unread messages instead of the expected 500.
  • Cause: Messages opens with the message box focused, and focus in the message box counts as reading the channel. The test then opens the search palette, which moves focus away. On the failing WebKit runner the Search button click waited about 2 seconds for the page to stop moving. During that time the app correctly read the newest visible message, so the count dropped to 499 before the test checked it. The failure trace shows the read 5 seconds (the publish delay) before the read-state publication.
  • Fix: the two journeys in unread.spec.mjs that check an unread starting count now block reading focus during startup. They use the existing holdReadingFocus helper, as the surviving-window journey in the same file already does. The first journey releases the hold after it moves focus to the sidebar, so its later read steps run as before.

Details

  • App behavior does not change. Only the test changes.
  • To confirm the cause, I added a temporary 2-second wait before the palette in the shared open() helper on unmodified main. The "built sidebar" journey and the "chat followed by membership activity" journey both failed because the channel was read at startup. With this change, both pass with the same wait.
  • open() itself is unchanged: other journeys (for example "own-composer focus quiets a channel…") depend on the default startup focus.

Messages opens with its composer focused, and composer focus counts as
reading. When a slow runner delays the search palette, that dwell reads
visible Alpha rows before the test parks focus. Main 572a4ac showed 499
observed unread instead of 500 for this reason.

Hold reading focus through startup in the two unread.spec journeys that
assert an unread baseline, as the surviving-window journey already does.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <[email protected]>
@loganj
loganj marked this pull request as ready for review October 15, 2026 13:51
@loganj
loganj requested a review from a team as a code owner October 15, 2026 13:51
@kalvinnchau
kalvinnchau merged commit 6ab2547 into main Oct 15, 2026
61 of 63 checks passed
@kalvinnchau
kalvinnchau deleted the larry/unread-startup-focus-hold branch October 15, 2026 16:07
johnmatthewtennant added a commit that referenced this pull request Oct 15, 2026
* origin/main:
  perf(css): replace wide :has() anchors with owner-set data attributes (#1180)
  fix(goose): share an MCP server pool and harden session lifecycle (#1142)
  test(browser): hold reading focus until the unread baseline is observed (#1182)
  Refine the profile menu and open status editing immediately (#1172)
  unify session naming, workspace and lifetime settings (#1079)
  perf(messages): stop forcing a layout on every action bar position frame (#1184)
  test(browser): prepare fixture dependencies once per run (#1126)
  test: replace fragile string assertions with precise checks (#1162)
  test: keep thread fixture errors out of http responses (#1163)
  feat: upgrade tauri and native plugins (#1169)
  test: pass native menu scripts to eval as arguments (#1160)
  test: cover shared link url policy (#1165)
  test: preserve literal text across markdown comment projection (#1164)
  test: pin html escaping of clipboard link labels (#1166)
  Preserve linked text pasted from other apps (#1069)
  fix(messages): keep the reader's message in place when a thread reply and layout change land together (#1130)

Signed-off-by: John Tennant <[email protected]>

# Conflicts:
#	src/bundled/channels/ChannelBody.tsx
#	src/bundled/channels/ConversationTab.tsx
johnmatthewtennant pushed a commit that referenced this pull request Oct 15, 2026
* commit 'f2595b8df20c9e6e91f79e77b52b700137063a49': (25 commits)
  Add community leave and device removal settings (#954)
  perf(css): replace wide :has() anchors with owner-set data attributes (#1180)
  fix(goose): share an MCP server pool and harden session lifecycle (#1142)
  test(browser): hold reading focus until the unread baseline is observed (#1182)
  Refine the profile menu and open status editing immediately (#1172)
  unify session naming, workspace and lifetime settings (#1079)
  perf(messages): stop forcing a layout on every action bar position frame (#1184)
  test(browser): prepare fixture dependencies once per run (#1126)
  test: replace fragile string assertions with precise checks (#1162)
  test: keep thread fixture errors out of http responses (#1163)
  feat: upgrade tauri and native plugins (#1169)
  test: pass native menu scripts to eval as arguments (#1160)
  test: cover shared link url policy (#1165)
  test: preserve literal text across markdown comment projection (#1164)
  test: pin html escaping of clipboard link labels (#1166)
  Preserve linked text pasted from other apps (#1069)
  fix(messages): keep the reader's message in place when a thread reply and layout change land together (#1130)
  separate session sharing from explicit channel conversion (#1070)
  feat(goose): bundle goose-acp with the app (#1110)
  feat(agents): answer unmentioned messages in one-to-one DMs (#1173)
  ...

Signed-off-by: Sol <49aa1f65411fd096d2e2ec144f1e7aa36fdc76d1b907cfdf7be000c66f9d3b8e@buzz.block.builderlab.xyz>
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.

2 participants