`settleTree` bounded its polling by a 3s window but never bounded the
number of reads it took, and a tree read can fail by TIMING OUT. Every
tree source's RPC timeout outlasts that window, the shortest being iOS's
5s, so the window fit exactly one such read: "every read in the window
failed", the condition the throw reports as a tree-source outage,
collapsed into "the first read was slow", erroring a tap/type/scroll
step on one transient blip with no retry at all.
The floor makes the deadline stop deciding how much evidence an outage
verdict is drawn from. `await`/`assert` have never had this flaw, since
`waitForCondition`'s final poll already guarantees a second attempt, so
this is the same guarantee given to the directives that resolve through
a settle.
A run whose reads answer inside the window pays nothing: two reads are
what a settle already costs there. A run whose reads outlast it pays a
second read, and gets a settle it never actually got before, since past
the deadline the old code returned its single tree having compared it
against nothing. A wedged source costs two full reads rather than one,
and a read is several RPCs deep with each hop on its own timeout, so
that is tens of seconds on a step that used to fail in one read. The
alternative is the step failing on evidence the window was too short to
gather.
A selector target settles inside `waitForFrame`, but a target that
resolves nothing skipped the settle altogether: a coordinate
`tap`/`long-press` and a centre-anchored `pinch`/`rotate` dispatched
into whatever motion was in flight, so they could land mid-fling, which
is the exact race the settle exists to close. Every input directive now
settles first, however it is addressed.
The settle is best-effort here, unlike on the selector path: these
gestures read no frame out of the tree, so an outage must not fail them,
which would break the escape hatch coordinates exist to be (an element
the tree cannot see). This is the allowance `snapshot` already makes
before a capture that reads pixels rather than nodes.
Best-effort is not free, though, and the run pays it per gesture. A tree
the run can never read is not only the disconnect mid-run:
`fetchFlowTree` serves no tree at all on `ios-remote`, and an app that
cannot load the instrumentation fails every read off an in-memory list,
an Apple system app being the case in point, which flows drive by
coordinates for exactly that reason, so every step of such a flow is one
of these gestures. Measured against the real fetch on an `ios-remote`
device, a coordinate tap went from 0ms to 3022ms, once per gesture, for
a settle that was never going to arrive.
So a settle that spends its whole window without one successful read
records the outage on the run, against the device that proved it, and a
later gesture rethrows that instead of buying the same verdict again.
Not a shorter budget: any threshold low enough to spare a source that
serves no tree would also abandon the mid-navigation blip the settle's
retry exists for. But the record is a prediction, not a proof of
repetition. One window mints it and nothing re-tests it, and on iOS that
window can be a single stalled read, since the deadline is only tested
after a read returns and `ViewHierarchy.getFullHierarchy` sits on a 15s
RPC tier behind a serial 5s `Application.getState` probe. Being wrong
therefore costs a settle rather than a step, and it is not silent: a
gesture that spends the record warns its step report that it dispatched
unsettled, quoting the source's own reason, so a run whose prediction
was wrong says which of its greens mean the gesture was sent rather than
that it landed.
Every tree read a directive makes now goes through one helper so that a
read which comes back clears the record whichever directive asked for
it. `await`/`assert` and `idle` never settle, and a run that reads the
tree successfully must not keep skipping. A relaunch clears it too,
whether written as a `launch:` directive or as one of the raw `tool:`
steps that perform the same operation, since a relaunch is the repair
the commonest of these errors asks for by name. Two more reads route
through the same helper for uniformity but can never be the clearing
one: `rotate`'s aspect read skips itself while a record stands, and the
`type` focus wait runs only behind a `waitForFrame` whose own settle
already cleared it.
What it costs, in two directions. An outage that lasted a full window,
in a run that then never reads the tree again and never relaunches,
leaves later gestures unsettled even once it clears: a flow of nothing
but coordinate gestures giving up a best-effort settle it never had
before this change, against every one of those gestures otherwise paying
the window for a settle that is not coming. And on a screen that never
holds still, a spinner, a video, a ticking clock, nothing converges, so
every one of these gestures pays the whole window, measured at about
3.05s each. The record buys no relief there by design, because a window
that read the tree proves no outage, and the fingerprint cannot be
narrowed the way `scrollToVisible` narrows its own: a scroll knows the
motion it waits on is its own, inside the containers under its anchor,
while a gesture waits on motion of unknown origin that can move what
sits under the point without touching it. It is the same window every
selector directive already paid on such a screen; what changed is that
coordinate targets pay it too.
Two smaller pieces ride along. A centre-anchored `rotate` skips its
screen-aspect read on a recorded outage as well, degrading to the same
legacy orbit a failed read gives it, so the record actually takes the
window off that directive instead of handing back a 15s-tier RPC. And
the settle's tree read now takes the run's abort signal, so a cancelled
run reports its skip immediately rather than once the source finally
answers. It deliberately takes no time budget: one cut to what is left
of the window would fail the cold start #778 raised that tier to ride
out.