Repository navigation
fix(flow): a timeout or a scroll speed may be a ${...} expression, as in Maestro - #279
Merged
omnarayan merged 1 commit intoNov 18, 2026
Conversation
… in Maestro
Maestro reads extendedWaitUntil's, waitForAnimationToEnd's and
scrollUntilVisible's timeout, and scrollUntilVisible's speed, as text
(Strings in its YAML model) and evaluates them with the step's other
scripts when the step runs (evaluateScripts in Commands.kt). Here they are
ints, so a flow that writes `timeout: ${PAUSE_MS}`, or quotes the number,
failed to parse ("cannot unmarshal !!str `${PAUSE...` into int"), and the
validation stopped every flow of the run before a device was touched.
Such an expression is now kept as written (TimeoutExpr, SpeedExpr) and
resolved into the int each time the step runs, in the copy expansion
makes, so a sub-flow run twice or a repeat gets its variables' values of
the moment. A number, quoted or not, is read as Maestro reads it: in
decimal ("0100" is 100, where YAML reads octal 64), a timeout's
underscores dropped as Maestro's extendedWaitUntil drops them (its
scrollUntilVisible and waitForAnimationToEnd fail on one when the step
runs, so there this is lenient). A value that is not a number
fails the step without running it, naming what it resolved to; as in
Maestro (Orchestra.kt executeCommands), an optional extendedWaitUntil or
scrollUntilVisible lets the flow go on (reported failed here, a warning
there), since its timeout error is an InvalidCommand, while a bad scroll speed (InvalidNumericFieldValue) or
waitForAnimationToEnd timeout fails even an optional step; the speed is
resolved before the timeout, as Maestro evaluates it. A literal that is
not a number is still refused at parse time.
The other number fields Maestro reads as text (repeat's times, retry's
maxRetries, assertScreenshot's thresholdPercentage, a selector's index,
the points) already took an expression here, and the ones it reads as
numbers (tapOn's repeat and delay, scrollUntilVisible's
visibilityPercentage, swipe's duration) refuse one there too.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
omnarayan
added a commit
that referenced
this pull request
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A flow that sets
extendedWaitUntil'stimeoutfrom a variable fails validation, before any device is touched:The validation covers every flow of the run, so none of them starts, including the ones without a variable. The same happens with
waitForAnimationToEnd'stimeout,scrollUntilVisible'stimeoutandspeed, and with those numbers quoted (timeout: "3000").Maestro's YAML model reads these four as strings (
YamlExtendedWaitUntil.timeout,YamlWaitForAnimationToEndCommand.timeout,YamlScrollUntilVisible.timeoutand.speed). Each command evaluates them with its other scripts when it runs (evaluateScriptsofAssertConditionCommand,WaitForAnimationToEndCommandandScrollUntilVisibleCommandinCommands.kt), then reads the number (parseTimeoutMs,NumericFields.parseScrollSpeed). Maestro 2.12.1'scheck-syntaxaccepts${N}in each of them, and in the other numbers it reads as strings (repeat.times,retry.maxRetries,assertScreenshot.thresholdPercentage, a selector'sindex), which this runner already takes. It refuses${N}where its model types the number asInt,Long,DoubleorBoolean(tapOn'srepeat,delayandwaitToSettleTimeoutMs, a selector'swidth,scrollUntilVisible'svisibilityPercentage,swipe'sduration,travel'sspeed,optional,launchApp'sclearState), as this runner does.Type of Change
Changes Made
${...}value of those four fields out of the step's mapping before decoding and keeps it as written (BaseStep.TimeoutExpr,ScrollUntilVisibleStep.SpeedExpr). A literal that is not a number is still refused at parse time.timeout: 0100is 100 where YAML reads the unquoted0100as octal 64 (andtimeout: "0100", quoted, was refused before this change, as any quoted number was), and a timeout's underscores dropped, as Maestro'sextendedWaitUntildrops them (parseTimeoutMs). Maestro'sscrollUntilVisibleandwaitForAnimationToEndfail on an underscore when the step runs, so for those two this is more lenient.ExpandStepresolves the expression intoTimeoutMsorSpeedeach time the step runs, in the copy that expansion makes, so a sub-flow run twice with differentenv:, or a step in arepeat, gets the values of that moment.Orchestra.kt, the command loop), an optionalextendedWaitUntilorscrollUntilVisiblelets the flow go on, since their timeout error is anInvalidCommand, whichoptionaldowngrades: Maestro reports the step as a warning, the runner as failed, as for any optional step that fails. A bad scroll speed (InvalidNumericFieldValue) orwaitForAnimationToEndtimeout (aNumberFormatException) fails even an optional step. The speed is resolved before the timeout, asScrollUntilVisibleCommand.evaluateScriptsevaluates them, so with both bad the speed's error is the step's.Related Issues
None open; found running a suite written for Maestro (searched for "timeout variable", "cannot unmarshal", "into int").
Testing
go test -race ./...,pkg/driver/browser/cdpleft out: it launches Chrome)pkg/flow/number_expression_test.go: the four fields keep a${...}; a number, quoted or not, is read in decimal ("0100"and an unquoted0100are both 100,08is 8) and a timeout's underscores dropped (forscrollUntilVisible's"3_000"a leniency, as above); a word or an out-of-range speed is still refused.pkg/executor/number_expression_test.go: the driver gets the values at the top level, in a sub-flow run twice with differentenv:, and in each pass of arepeat. A value that is not a number fails the step without reaching the driver, withoptionalhonoured per field as above, also inside arunFlow, arepeat, aretryand anonFlowStart; with a bad speed and a bad timeout the speed's error wins; a${...}that throws fails even an optional step. Both tests fail onmain, where the flows do not parse.On an Android emulator (API 36), with Maestro 2.12.1 for reference: the repro above (with an installed app's id) waits its 3 s and fails at the wait, as on Maestro (
mainrefuses the file), and an optional wait whosetimeoutcomes from-ewaits that long and lets the flow pass, as on Maestro.Checklist
Additional Notes
Proposed CHANGELOG entry: