fix(preview): name hidden, disabled, and ambiguous click failures - #7301
fix(preview): name hidden, disabled, and ambiguous click failures#7301gbarros-dev wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
One finding on the desktop-side error construction. See the inline comment.
Posted via Macroscope — Effect Service Conventions
ApprovabilityVerdict: Approved a149228 This PR improves error categorization for preview automation click failures, distinguishing between hidden, disabled, and ambiguous targets. The changes are self-contained error handling improvements with comprehensive test coverage and no runtime behavior changes beyond better error messages. You can customize Macroscope's approvability policy. Learn more. |
preview_click treated a hidden or disabled button as missing and leaked the locator when it failed. Agents then spent turns guessing at chrome they could already see. Clicks now report hidden, disabled, or ambiguous targets without putting the locator on the wire.
A free function picked hidden/disabled/ambiguous and defaulted ambiguous matches to 0. The policy now lives on PreviewAutomationTargetNotFoundError.fromLookupFailure, and ambiguous requires an explicit match count.
bc897ad to
698bda4
Compare
Dismissing prior approval to re-evaluate 698bda4
There was a problem hiding this comment.
Reviewed the new preview automation lookup error classes against the Effect service conventions. The desktop-side classification is now a static factory next to the error type (PreviewAutomationTargetNotFoundError.fromLookupFailure), the new errors are structured Schema.TaggedErrorClass variants with messages derived from attributes, no selector text is leaked, and the host-side wrappers preserve cause. One finding: a redundant failureKind discriminator path on the web translation boundary that nothing produces.
Posted via Macroscope — Effect Service Conventions
Host mapping still accepted a failureKind field on PreviewAutomationTargetNotFoundError. Nothing emits that shape. Classification now uses the hidden, disabled, and ambiguous tags only.
preview_clicktreated a hidden or disabled button as missing and leaked the locator when it failed. Agents then spent turns guessing at chrome they could already see.Clicks now report hidden, disabled, or ambiguous targets without putting the locator on the wire.
Related to #3714. Does not close it: that issue wants the selector in the error; this PR names the failure kind and keeps locators off the wire.
Split out of closed #7127.
Tests:
vp test run apps/desktop/src/preview/Manager.test.ts apps/web/src/components/preview/previewAutomationErrors.test.ts apps/web/src/components/preview/previewAutomationRequestConsumer.test.tsImplemented with Grok 4.6 through Grok CLI.
Note
Low Risk
Scoped to preview automation error typing and click target resolution messaging; no auth, data, or payment paths. Type/scroll paths are unchanged.
Overview
Preview selector-based clicks no longer collapse hidden, disabled, or multi-match failures into a single “not found.” The in-page lookup returns a structured
failureKind, and desktopPreviewManagerraises hidden, disabled, ambiguous (with match count), or missing errors viaPreviewAutomationTargetNotFoundError.fromLookupFailure. Ambiguous matches are detected when Playwright strict mode throws.The web preview automation layer maps those desktop tags to matching
*HostErrortypes so agents get clear execution messages (e.g. not visible, disabled, matched N elements) while serialized responses stay free of locator text, covered by new desktop and web tests.Reviewed by Cursor Bugbot for commit a149228. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add named error types for hidden, disabled, and ambiguous click failures in preview automation
evaluateWithDebuggersnippet now catches strict-mode errors to surface ambiguous selectors with amatchCount, and explicitly checks visibility and enabled state.PreviewAutomationTargetNotFoundError.fromLookupFailuremaps afailureKindto the appropriate concrete error class; the host-sidePreviewAutomationOperationError.fromCausedoes the same for client-visible messages.Macroscope summarized a149228.