Repository navigation
fix(maestro): typed failure reasons for target-resolution misses - #3341
Conversation
…eason An out-of-range selector index over otherwise-visible matches produced a resolution with matched/visible evidence but no target, and every miss was reported with the same generic 'did not resolve to a visible element' text. assertVisible then accepted the vacuous matched/visible pair, so a flow could assert an element its selector never selected. Carry a MaestroTargetFailureReason from the resolution site through the daemon match projection to the reporter: messages now name the selector and the actual miss (no match, none visible, index out of range, no usable geometry), the typed reason rides along in error details, and observation conditions hold only for an actionable resolution.
Size Report
Startup median (7 runs, lower is better):
|
|
Re-ran the failed 'Smoke Tests' job (run 37843216989 / job 113537548137). Its only failure was the step 'Preflight iOS runner through public CLI' with typed |
|
The PR is ready for human review at 2964115. The code looks right to me. All 19 checks pass. The earlier Smoke Tests failure was the "Preflight iOS runner through public CLI" step with a typed daemon_startup_failed. This diff touches only packages/maestro, which the daemon loads lazily, and the re-run passed, so the two do not overlap. I did not run the tests or the iPad ASWebAuthenticationSession repro, so the live-validation claim rests on the PR body. I also did not check third-party MaestroRuntimeOperations implementers outside this repo. Their matches without failureReason fall back to the default message and the old matched/visible rules, which is fine for in-repo code. Not blocking, and you can take or leave these: the new |
|
Summary
Fixes the live defect behind #2560 for Maestro
indexselectors. An out-of-rangeindexover otherwise-visible matches produced resolution evidence withmatched: true, visible: trueand no target, so every miss — selector miss, invisible matches, out-of-range index, degenerate geometry — was reported as the generic "Maestro target did not resolve to a visible element.", andassertVisibleaccepted the vacuous matched/visible pair (asserting an element its selector never selected).Adds a typed
MaestroTargetFailureReasoncomputed at the resolution site, threaded through the daemon match projection to the reporter. Messages now name the selector and the actual miss; the reason rides in errordetails.targetFailureReason; observation conditions hold only for an actionable resolution.The other two #2560 symptoms (plain test/replay/manual divergence, silent
repeat) do not reproduce on current main and were already addressed by the optional-step warnings (#2571) and the earlier dispatch fixes.Validation
pnpm check:affected --run: format, lint, typecheck, layering, fallow, build, 3183 tests pass.ASWebAuthenticationSessionfixture hostingcom.apple.SafariViewService: out-of-rangeindexnow fails with "matched 1 element(s); its index is out of range" (hard fail and precise optional-skip warning);index: 0and plain dismissal still pass;assertVisiblewith out-of-range index now correctly fails instead of passing vacuously.