Skip to content

Fix dropped reason field in actionability check results#69

Open
evanniedojadlo wants to merge 1 commit intoVibiumDev:mainfrom
evanniedojadlo:fix/actionability-reason-field-dropped
Open

Fix dropped reason field in actionability check results#69
evanniedojadlo wants to merge 1 commit intoVibiumDev:mainfrom
evanniedojadlo:fix/actionability-reason-field-dropped

Conversation

@evanniedojadlo
Copy link
Contributor

Summary

Fixes #2 - The reason field returned by JavaScript actionability checks (visible, receivesEvents, enabled, editable) was silently dropped during JSON unmarshalling because the Go structs did not include a Reason field. This meant callers only knew that a check failed, but not why.

In Vibium fashion, I leveraged Claude Code to identify and address this issue, then personally tested and verified the fixes on macOS 26.1.

The Fix

The JavaScript check functions return JSON with a reason field when a check fails (e.g., {"visible": false, "reason": "zero size"}), but the Go structs used to unmarshal these results only had the boolean and error fields — reason was never captured.

Solution: Add a Reason field to each check function's unmarshal struct and include it in the returned error message when a check fails.

All four affected functions in clicker/internal/features/actionability.go:

  • CheckVisible — now returns "element not visible: zero size" instead of just false, nil
  • CheckReceivesEvents — now returns "element does not receive events: obscured by div"
  • CheckEnabled — now returns "element not enabled: disabled attribute"
  • CheckEditable — now returns "element not editable: readonly attribute"

This reason info propagates through WaitForActionable into timeout error messages, so users now see:

timeout: Timeout after 30000ms waiting for '#my-button': check 'Visible' failed: element not visible: display none

Instead of:

timeout: Timeout after 30000ms waiting for '#my-button': check 'Visible' failed

Test Plan

  • Verified all four check functions now preserve the reason field from JS responses
  • Confirmed error messages include the reason string for all failure cases (zero size, visibility hidden, display none, obscured by element, disabled attribute, aria-disabled, inside disabled fieldset, readonly attribute, aria-readonly, non-editable input type, non-form element)
  • Go tests pass: go test ./...

Testing with Claude Code

# Verify reason field is preserved in actionability checks
Read the actionability.go file and confirm each check function's unmarshal struct includes a Reason field and returns it in the error message when the check fails

Files Changed

  • clicker/internal/features/actionability.go - Added Reason field to all four check function unmarshal structs and included reason in error messages

🤖 Generated with Claude Code

The JSON reason field from JavaScript check functions was silently
dropped during unmarshalling because the Go structs lacked a Reason
field. Now all four check functions (CheckVisible, CheckReceivesEvents,
CheckEnabled, CheckEditable) preserve the reason and include it in
error messages.

Fixes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@evanniedojadlo
Copy link
Contributor Author

The naming itself needs to be reviewed and approved as it's subjective:

All four affected functions in clicker/internal/features/actionability.go:

  • CheckVisible — now returns "element not visible: zero size" instead of just false, nil
  • CheckReceivesEvents — now returns "element does not receive events: obscured by div"
  • CheckEnabled — now returns "element not enabled: disabled attribute"
  • CheckEditable — now returns "element not editable: readonly attribute"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Json field dropped

1 participant