fix(maestro): typed failure reasons for target-resolution misses

Merged
TH
2mo ago
+266-9

Summary

Fixes the live defect behind #2560 for Maestro index selectors. An out-of-range index over otherwise-visible matches produced resolution evidence with matched: true, visible: true and 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.", and assertVisible accepted the vacuous matched/visible pair (asserting an element its selector never selected).

Adds a typed MaestroTargetFailureReason computed 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 error details.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.
  • New regression tests: resolution-level typed reasons, daemon match projection, observation-complement semantics, reporter message + typed details.
  • Device repro on iPad Pro 13-inch (M5) with an ASWebAuthenticationSession fixture hosting com.apple.SafariViewService: out-of-range index now fails with "matched 1 element(s); its index is out of range" (hard fail and precise optional-skip warning); index: 0 and plain dismissal still pass; assertVisible with out-of-range index now correctly fails instead of passing vacuously.