Commit a9d6584
fix(deflake): AccountsManager useBeta handler off poster-thread + CrossDeviceSyncE2E joins (#1321)
The two deadline-poll/hang flakes that survived #1306's crasher fix:
- AccountsManager.updateAccountSetFromNotification (testUseBetaDidChange 120s hang):
.TPPUseBetaDidChange is delivered SYNCHRONOUSLY by NotificationCenter on the
poster's thread (main, from a Settings toggle). The handler did an
accountSetsLock.sync read (performRead) that blocks until any in-flight
background catalog-refresh barrier on that lock drains — under CI full-suite
load that barrier can hold for the whole 120s execution allowance, hanging the
poster (and, in production, stalling the Settings UI). Dispatch the account-set
update off the poster's thread (.userInitiated) — it's inherently async (it may
reload catalogs), so this is behavior-correct AND unblocks the poster.
- CrossDeviceSyncE2ETests (test_audiobookPositionOnDeviceA ~32s): all 10
wait/fulfillment(timeout:) deadline-polls on fire-and-forget backend annotation
completions converted to withCheckedContinuation joins. Bookmark types are
NSObject-based (non-Sendable), so each site projects the asserted primitive
facts inside the completion (off-isolation) and resumes with a Sendable
projection — no non-Sendable object crosses the @mainactor boundary.
Verified: 56 tests pass in isolation (51 E2E + 5 AccountsManager).
**Scope:** one critical-path AccountsManager behavior fix (settings-notification
handler no longer blocks the poster) + E2E test-hermeticity. The async dispatch
preserves the account-set update; only the thread it runs on changes.
**Not done:** the broader deadline-poll tail beyond these observed-failing tests.
Co-authored-by: t <t@t.io>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6cfef68 commit a9d6584
2 files changed
Lines changed: 209 additions & 124 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2002 | 2002 | | |
2003 | 2003 | | |
2004 | 2004 | | |
2005 | | - | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
2006 | 2017 | | |
2007 | 2018 | | |
2008 | 2019 | | |
| |||
0 commit comments