Skip to content

test(ios): check the navigation glass state often instead of once a second - #9786

Merged
matt2e merged 2 commits into
mainfrom
fix-ios-navigation-glass-test-flake
Nov 23, 2026
Merged

matt2e merged 2 commits into
mainfrom
fix-ios-navigation-glass-test-flake

Conversation

@matt2e

@matt2e matt2e commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a flaky native iOS test, RunnerTests.testNavigationGlassMergesAndRestoresInBothDirections. Test-only: one file, mobile/ios/RunnerTests/RunnerTests.swift.

Failure

"Mobile Swift Domain / Mobile Swift (Native)" failed on #9780 (run 44682658228):

mobile/ios/RunnerTests/RunnerTests.swift:83: error: -[RunnerTests.RunnerTests testNavigationGlassMergesAndRestoresInBothDirections] : Asynchronous wait failed: Exceeded timeout of 2 seconds, with unfulfilled expectations: "Expect predicate BLOCKPREDICATE(...)"

Why it is a flake

Cause

setMenuOpen(true) starts a 0.18 s UIViewPropertyAnimator. The test then waited up to 2 s for both side surfaces to reach alpha 0, using XCTNSPredicateExpectation.

That expectation evaluates its predicate about once a second. The evidence is in the passing run: the test takes 4.07 s for four waits on a 0.18 s animation, about 1 s per wait. A 2 s timeout therefore gets one or two evaluations. RunnerTests runs inside the Flutter app, and when the app holds the main thread across those evaluations the wait expires although the animation finished long before. In the failing run the 2 s timeout was reported 5.2 s after the test started, and the test's three remaining waits then passed at about 1 s each.

This is inferred from the CI timings and the code. It was not reproduced.

Fix

Both waits now use a small waitUntil helper in the existing XCTestCase extension. It checks the condition every 10 ms on the main actor, for up to 10 s (the budget the other RunnerTests callbacks use since #8678 and #8741). It checks the condition before the deadline on every pass, so a main-thread stall of any length is followed by one more check instead of a timeout.

The two conditions and every assertion after them are unchanged. If the surfaces never merge or restore, the test still fails, at the calling line. As a side effect the test should take about 0.4 s instead of 4 s.

Not included

BuzzPushNotificationResolverTests.testShownMessagesStayShownAcrossCommunitiesFailuresAndBursts also failed once on main with a 2 s timeout (run 44682614076). It is a different mechanism: an XCTestExpectation fulfilled by the resolver's own completion, across about 145 resolver runs, in the macOS swift test step. The only available change is a longer timeout in a helper shared by the whole class, and the cause of the slow run is not established, so it is left out.

Testing

  • Not compiled against the app and not run on a simulator. A local simulator build was started and then abandoned; the machine was heavily loaded. swiftc -parse accepts the file.
  • The Mobile Swift (Native) lane on this PR is the first place the change compiles and runs.
  • Pushed with git push --no-verify.

buzz-review-completed is not added: agent review and human testing (AGENTS.md "Before opening a PR") have not happened.

🤖 Generated with Claude Code

@matt2e
matt2e requested a review from a team as a code owner November 20, 2026 06:40
@matt2e
matt2e deployed to codex-review November 20, 2026 06:40 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 42dc2a8c580c4ee0b25af042b757c42d700b1d90...7cdfda6fe67a2013e738758c953dd19ecf52eb07
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

The PR only changes iOS test synchronization. Inspection of the changed waits and animation implementation found no concrete security, correctness, or reliability issues.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • Builds and tests were not run, as requested.

Generated by Codex Security Review |
Requested by: @matt2e |
Workflow run

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Star Lord: No changes requested on aee2ab3. The source review found that main-actor polling preserves the merge and restore checks in both orientations. The first native simulator run was in progress at review time, so runtime validation is pending.

brow

This comment was marked as resolved.

@brow

This comment has been minimized.

jedwards27

This comment was marked as resolved.

@kazemek21 kazemek21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kyle reviewed this PR and the Nexus review-tracker notes.

Posted by Codex (gpt-6.1-sol) on behalf of kylez

matt2e and others added 2 commits November 23, 2026 14:37
…econd

testNavigationGlassMergesAndRestoresInBothDirections timed out on CI
(run 44682658228) waiting 2 s for the side surfaces of
MergingNavigationGlass to fade out after setMenuOpen(true), a 0.18 s
animation.

The test waited with XCTNSPredicateExpectation, which evaluates its
predicate about once a second: the test's four waits take about 4 s in
passing runs, 1 s each for a 0.18 s animation. A 2 s timeout therefore
gets one or two evaluations. RunnerTests runs inside the Flutter app, and
when that app holds the main thread across those evaluations the wait
expires even though the animation has long finished. In the failing run
the 2 s timeout was reported 5.2 s after the test started.

Replace both waits with a `waitUntil` helper that checks the condition
every 10 ms on the main actor for up to 10 s, the budget the other
RunnerTests callbacks use. It checks the condition before the deadline on
every pass, so a main-thread stall of any length is followed by one more
check rather than a timeout. The conditions and the assertions after them
are unchanged, and the test no longer spends 4 s waiting.

The cause is inferred from the CI timings and the code. Not compiled or
run locally; `swiftc -parse` accepts the file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
The merged and restored values are set as soon as an animation starts,
so both waits passed on their first check. Also require that the side
layers have no running animations, so the close that follows starts from
a finished animator.

Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
Signed-off-by: Tom Brow <tomb@block.xyz>
(cherry picked from commit 0519036)
Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e
matt2e force-pushed the fix-ios-navigation-glass-test-flake branch from aee2ab3 to 7cdfda6 Compare November 23, 2026 03:39
@github-actions github-actions Bot removed the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 23, 2026
@matt2e
matt2e deployed to codex-review November 23, 2026 03:40 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Nov 23, 2026
@matt2e
matt2e merged commit e03a11f into main Nov 23, 2026
53 checks passed
@matt2e
matt2e deleted the fix-ios-navigation-glass-test-flake branch November 23, 2026 05:04
tlongwell-block added a commit that referenced this pull request Nov 23, 2026
…uash

* origin/main:
  Offer image and animated avatars for human profiles (#9724)
  feat(mobile): add people and agents to a DM (#9153)
  test(ios): check the navigation glass state often instead of once a second (#9786)

Co-authored-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Co-authored-by: Tyler Longwell <tlongwell@squareup.com>
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
wpfleger96 added a commit that referenced this pull request Nov 23, 2026
…ion-persist

* origin/main:
  fix(mobile): keep Light/Dark/System on each device (#9894)
  Cache recently opened mobile thread replies (#9844)
  fix(mobile): align the New menu with desktop (#9883)
  fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#9877)
  Remember collapsed sidebar sections on mobile (#9879)
  Add inline emoji shortcode suggestions on mobile (#9882)
  fix(mobile): reply to a thread's head in its open page (#9889)
  fix(mobile): offer linked identity import when only other backups exist (#9053)
  feat(mobile): enroll Android devices for push (#9811)
  fix(mobile): keep "+" reactions working when a new message rebuilds the row (#9831)
  Request sentence capitalization in the mobile composer (#9881)
  Offer image and animated avatars for human profiles (#9724)
  feat(mobile): add people and agents to a DM (#9153)
  test(ios): check the navigation glass state often instead of once a second (#9786)
  feat(mobile): add screen breadcrumbs to diagnostic reports (#9823)
  fix(mobile): keep error names in send, upload and invite failure text (#9855)
  ci(mobile): run the Mobile Swift Native lane only for native changes (#9847)

Signed-off-by: Will Pfleger <wpfleger@block.xyz>
jedwards27 added a commit to jedwards27/buzz that referenced this pull request Nov 23, 2026
* origin/main: (23 commits)
  refactor(mobile): remove unused CommunityListNotifier.addCommunity (block#9896)
  fix(mobile): keep Light/Dark/System on each device (block#9894)
  Cache recently opened mobile thread replies (block#9844)
  fix(mobile): align the New menu with desktop (block#9883)
  fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (block#9877)
  Remember collapsed sidebar sections on mobile (block#9879)
  Add inline emoji shortcode suggestions on mobile (block#9882)
  fix(mobile): reply to a thread's head in its open page (block#9889)
  fix(mobile): offer linked identity import when only other backups exist (block#9053)
  feat(mobile): enroll Android devices for push (block#9811)
  fix(mobile): keep "+" reactions working when a new message rebuilds the row (block#9831)
  Request sentence capitalization in the mobile composer (block#9881)
  Offer image and animated avatars for human profiles (block#9724)
  feat(mobile): add people and agents to a DM (block#9153)
  test(ios): check the navigation glass state often instead of once a second (block#9786)
  feat(mobile): add screen breadcrumbs to diagnostic reports (block#9823)
  fix(mobile): keep error names in send, upload and invite failure text (block#9855)
  ci(mobile): run the Mobile Swift Native lane only for native changes (block#9847)
  Revert "perf(db): stop per-id planning of wide #e reads (block#9591)" (block#9848)
  feat(mobile): count networking events for diagnostics (block#9810)
  ...

Signed-off-by: Jude Edwards <judeedwards@squareup.com>
jedwards27 added a commit to jedwards27/buzz that referenced this pull request Nov 23, 2026
* tmp-base: (23 commits)
  refactor(mobile): remove unused CommunityListNotifier.addCommunity (block#9896)
  fix(mobile): keep Light/Dark/System on each device (block#9894)
  Cache recently opened mobile thread replies (block#9844)
  fix(mobile): align the New menu with desktop (block#9883)
  fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (block#9877)
  Remember collapsed sidebar sections on mobile (block#9879)
  Add inline emoji shortcode suggestions on mobile (block#9882)
  fix(mobile): reply to a thread's head in its open page (block#9889)
  fix(mobile): offer linked identity import when only other backups exist (block#9053)
  feat(mobile): enroll Android devices for push (block#9811)
  fix(mobile): keep "+" reactions working when a new message rebuilds the row (block#9831)
  Request sentence capitalization in the mobile composer (block#9881)
  Offer image and animated avatars for human profiles (block#9724)
  feat(mobile): add people and agents to a DM (block#9153)
  test(ios): check the navigation glass state often instead of once a second (block#9786)
  feat(mobile): add screen breadcrumbs to diagnostic reports (block#9823)
  fix(mobile): keep error names in send, upload and invite failure text (block#9855)
  ci(mobile): run the Mobile Swift Native lane only for native changes (block#9847)
  Revert "perf(db): stop per-id planning of wide #e reads (block#9591)" (block#9848)
  feat(mobile): count networking events for diagnostics (block#9810)
  ...

Signed-off-by: Jude Edwards <judeedwards@squareup.com>

This branch was successfully deployed

1 active deployment
codex-review — 7cdfda6f Deployed Nov 23, 2026 by matt2e via Run Codex Security Review #17258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants