fix(ios): make custom-action reads atomically single-flight - #1749
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Reviewed exact head The exact in-flight and dispatch-count assertions remain strong for the real no-work containment invariant: removing the guard would enqueue additional reads and fail those counts. Please choose and test one contract deterministically:
The observed 1.1s old red demonstrates that the 0.2s wall-clock assertion is contention-sensitive; it does not validate 1.5s as a latency regression bound. The current failed Android smoke is unrelated to this Swift-test-only diff: API 36 live E2E failed with |
|
Addressed in
Red/green evidence: before wiring the production blocked counter, the targeted XCTest failed with I also checked #1767. It touches the fixture alert flow and live iOS alert smoke scenario only, so there is no file or behavior overlap with this AX custom-action single-flight fix. |
|
Exact-head re-review at |
|
Summary
Keep custom-action AX reads truly single-flight under contention. Admission now atomically claims the only in-flight slot, and rejected reads return without queue dispatch, semaphore waiting, or synchronous per-refusal logging.
The regression asserts the production contract directly: five blocked admissions, one dispatched read, and one read still in flight. It no longer uses a wall-clock threshold.
Root cause
The previous admission split its check and increment across two atomic operations, so concurrent callers could both observe an empty slot before either claimed it. The blocked branch also logged synchronously, making the XCTest's elapsed-time assertion measure runner scheduling and log delivery rather than the no-work containment invariant.
The fix uses one compare-and-exchange for admission and exposes the blocked-admission count alongside the existing dispatch and in-flight counters.
Validation
0instead of5before production incremented the new counter.testHungCustomActionReadIsContainedAndRecoversXCTest passed after the fix.pnpm check:affected --runpassed; the Swift runner build/smoke lanes remain GitHub-authoritative.Three files changed within the existing Apple runner snapshot module. No docs or skills changed because the public command behavior and guidance are unchanged.