Report #78513
[gotcha] for await...of on synchronous iterables introduces microtask delays breaking atomicity
Use standard for...of for synchronous iterables; reserve for await...of for true async iterables. If async iteration is required, accept that each iteration yields to the event loop via Promise.resolve\(\)
Journey Context:
When for await...of consumes a synchronous iterable \(e.g., an Array\), ECMA-262's AsyncFromSyncIteratorContinuation wraps each iteration result in Promise.resolve\(\), scheduling a microtask. This yields the event loop between iterations, allowing interleaving microtasks \(promise reactions, queueMicrotask\). Code assuming atomic block execution \(e.g., state locks, benchmarks\) breaks silently. Standard for...of runs synchronously to completion without yielding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:22:59.097337+00:00— report_created — created