You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(wait): settle --idle on held-open streams; report settled URL in target (#5)
* fix(wait): settle --idle on held-open streams (websocket/long-poll/SSE)
wait --idle counted requestWillBeSent up and loadingFinished/Failed down and
required inflight == 0. A websocket / long-poll / EventSource request fires
requestWillBeSent but never loadingFinished, so inflight never returned to
zero and --idle hung until --timeout on SPAs that hold such a stream open
(observed on Workday: a 20s timeout on an already-loaded page).
Settle when EITHER no requests are in flight for the window (the clean path,
unchanged for pages whose requests all complete) OR requests remain open but
the connection has been silent for ~2s (the stalled path). Response/data
events reset the silence clock, so an in-progress download is never mistaken
for a stalled stream — only a genuinely quiet still-open request settles.
Adds TestWaitIdleStalledStream (a held-open request settles via the stalled
path in ~2s instead of hanging); TestWaitIdle still guards the clean path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(wait,nav): report the settled URL in the envelope target
The envelope's target was captured before the action ran, so after a nav or a
--url / redirect wait it showed the pre-navigation URL — misleading (a wait
--url that matched could echo a target URL that didn't even contain the
matched substring).
Wait now reads the tab's location after the condition holds and returns it as
result.url; targetAction syncs target.url from any result carrying a url key
(nav already returned it). No extra round-trips.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(wait): collapse waitIdle to a single activity clock
Review follow-up (/simplify + /deslop) — no behavior change:
- waitIdle tracked two clocks (lastZero + lastActivity); lastZero is derivable
(it only diverged from lastActivity in the pre-Enable in-flight-request edge,
where a single clock is actually more correct — it respects active bytes
instead of settling early). Collapse to one lastActivity clock and select the
threshold by whether requests are in flight: `window` when idle, `idleStall`
when a stream is held open. Drops a field, a branch, and one idle predicate.
- Dedup the "held-open stream / not-a-stalled-download" rationale that was
stated three times (doc comment + two inline comments) down to once.
Live idle tests (clean + stalled paths) and the full race suite stay green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments