fix(find): enforce offscreen and non-hittable guarantees on focus

Merged
SA
2h ago
+843-426

Summary

Close the offscreen and nonHittable waivers on find-focus-dispatch in packages/contracts/src/interaction-guarantees.ts. Refs #3734.

  • Move throwIfOffscreenTarget and describeNonHittableTarget into @agent-device/selectors so command-runtime and daemon share one rule.
  • Refuse off-screen find focus and find type targets; limit iOS rescue to one exact id or label probe match and mark rescued targets hittable: true.
  • Expose targetHittable: false and hint on find responses, FindCommandResponseData, CLI stderr warnings, and MCP text.
  • Keep targetStability waived on find-focus-dispatch pending an ADR 0039 decision.

Before / after

Before: find focus and find type dispatched off-screen points and reported silent success on non-hittable targets.

After: off-screen targets fail with a find-specific retry hint, non-hittable targets include targetHittable: false and a warning hint, and iOS rescue verifies exact target identity.

Validation

  • Head c97e5b99a: pnpm check:affected --run passed 22/23 gates (full unit, format, lint, typecheck, layering, fallow, build, package, vitest-related) plus all 20 other local gates; depgraph exceeded its 5 s CPU budget locally on both branch and unchanged base under host load.
  • Red/green proof: 3 scenarios fail on origin/main and pass on c97e5b99a.

Reviewed with sol-loop: 4 rounds with gpt-6.2-sol. Sol verdict: approved.
Created with Claude Opus 5.5 and Gemini 4 Neon in T3 Code.


Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.