Skip to content

fix: deflake CI test runs - #61

Merged
brendan-ch merged 1 commit into
mainfrom
chore/fix-ci-test-flakes
Jul 22, 2026
Merged

fix: deflake CI test runs#61
brendan-ch merged 1 commit into
mainfrom
chore/fix-ci-test-flakes

Conversation

@brendan-ch

Copy link
Copy Markdown
Owner

Summary

Diagnosed the last month of "Run tests" failures (24 failed/cancelled runs) and fixed each recurring failure class at its root cause, rather than re-running:

  • Pause-button flakes (6 failures, all pre-UTC-midnight): the seeded active rule clamped its end to 23:59, so within the last ~15 minutes of the day RulePolicy.canPause's 15-minute floor hid pauseRuleButton. The seed now wraps the window past midnight (schedules support end <= start), so the rule always has ~6h remaining. Guarded by a parameterized unit test that fails on the old clamp at 23:50/23:58.
  • Typed-text truncation (4 failures): testRenameRuleInEditor observed "My" / "My Foc" instead of "My Focus"typeText drops keystrokes on loaded runners. New setTextVerified helper types, verifies the field value, and retries before submitting.
  • Dropped navigation taps (7 failures across AppListUITests): new tap(untilAppears:) helper re-taps against a postcondition — the same workaround goToSection already used for sidebar rows — applied at the flaking sites.
  • "Unable to find a device" (3 jobs since 07-21, dead in ~80s): some macos-26 runner images intermittently lack the named simulator. New "Ensure simulator exists" step waits for it, creates it if missing, and dumps diagnostics otherwise. The name match is anchored on " (" so iPhone 17 Pro Max can't satisfy a check for iPhone 17 Pro.
  • Timeout raised 45 → 60 minutes for both matrix legs (all 9 historical timeout-kills happened under the old 30-minute limit with tests still passing when cancelled).

Test plan

  • New SampleRulesTests pausability test: red on the old clamp (23:50/23:58 args fail), green after the fix; full suite passes.
  • The three modified UI tests pass locally on a simulator (Executed 3 tests, with 0 failures).
  • build-for-testing succeeds; workflow YAML validated.
  • Observe CI on this PR (both device legs) — including that "Ensure simulator exists" is a fast no-op when the device is present.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y9652c13kpQrUyj7CZrHZg

Fixes the four recurring failure classes from the last month of "Run
tests" workflow history:

- Seeded active rule now wraps past midnight instead of clamping to
  23:59. The clamp left <15 minutes on the block near UTC midnight, so
  RulePolicy.canPause hid the pause button and the pause UI tests failed
  in every run between ~23:44Z and midnight. Covered by a parameterized
  regression test (fails on the old clamp at 23:50/23:58).
- setTextVerified replaces blind typeText where a typed value is later
  asserted: CI runs showed dropped keystrokes ("My", "My Foc" for
  "My Focus"). Types, verifies the field value, and retries.
- tap(untilAppears:) re-taps navigation rows against a postcondition,
  generalizing the retap loop goToSection already used; applied to the
  AppListUITests sites that flaked on dropped taps.
- New "Ensure simulator exists" workflow step: some macos-26 images
  intermittently lack the named simulator (3 jobs since 07-21 died in
  ~80s with "Unable to find a device"); the step waits, creates the
  device if needed, and dumps diagnostics instead of failing cryptically.
  The name match is anchored on " (" so "iPhone 17 Pro Max" can't
  satisfy a check for "iPhone 17 Pro".
- Raise timeout-minutes 45 -> 60 for both device legs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9652c13kpQrUyj7CZrHZg
@brendan-ch
brendan-ch marked this pull request as ready for review July 22, 2026 16:14
@brendan-ch
brendan-ch merged commit 37f5175 into main Jul 22, 2026
2 checks passed
@brendan-ch
brendan-ch deleted the chore/fix-ci-test-flakes branch July 22, 2026 16:14
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.

1 participant