Skip to content

Fix accessibility collection reads - #166

Open
sebb3 wants to merge 1 commit into
cmsj:mainfrom
sebb3:fix/ax-array-attributes
Open

Fix accessibility collection reads#166
sebb3 wants to merge 1 commit into
cmsj:mainfrom
sebb3:fix/ax-array-attributes

Conversation

@sebb3

@sebb3 sebb3 commented Aug 23, 2026

Copy link
Copy Markdown

Summary

  • use AXSwift arrayAttribute(.children) for accessibility child and menu collections
  • restore functional children(), childAtIndex(), menu discovery, and menu traversal behavior
  • strengthen Finder integration coverage so empty or unbridged child collections fail validation

Closes #165.

Test plan

  • Build the Development scheme with code signing disabled
  • Run the focused HSAXTests suite with code signing disabled; runnable tests pass, while permission-gated AX tests are skipped for the unsigned host
  • Run documentation generation, validation, and coverage checks; coverage remains 100%
  • Run the ad-hoc-signed Development app with Accessibility permission and verify Finder returns 2 functional children and 8 menu items
  • Verify Dia returns 2 application children, 13 focused-window children, and 11 menu items
  • Full unsigned suite currently has four unrelated failures in screen-mode matching, London sunrise/sunset timezone expectations, and OCR missing-file rejection

AI assistance disclosure

This change was implemented with Letta Code assistance. AI was used to inspect the documentation and Swift implementation, identify the affected array-valued AX reads, apply the arrayAttribute correction, strengthen tests, and execute validation. The contributor has reviewed and understands the changes and their interaction with the accessibility bridge.

👾 Generated with Letta Code

Use AXSwift array attributes for child and menu collections so JavaScript receives real accessibility elements instead of empty arrays. Add Finder integration coverage for bridged children and menu items.

AI-assisted by Letta Code: implementation, test changes, and validation.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@sebb3
sebb3 marked this pull request as ready for review August 23, 2026 00:43
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects accessibility collection reads by using AXSwift’s array-specific attribute API and strengthens Finder integration coverage.

  • Updates application menu discovery and recursive menu traversal to read AX child arrays correctly.
  • Restores HSAXElement.children() bridging through the collection-specific API.
  • Adds assertions that Finder children are usable bridged elements and menu items are readable.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code defects identified.

The collection-specific AXSwift reads match the array-valued children contract across element and menu traversal paths, while the strengthened Finder checks remain protected by the existing Accessibility-permission suite gate.

Important Files Changed

Filename Overview
Hammerspoon 2/Modules/hs.application/HSApplication.swift Consistently replaces generic reads of array-valued AX children with arrayAttribute throughout menu discovery and traversal.
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift Corrects children() to retrieve and bridge the AX children collection through AXSwift’s array API.
Hammerspoon 2Tests/IntegrationTests/HSAXIntegrationTests.swift Strengthens permission-gated Finder tests to reject empty or incorrectly bridged accessibility collections.

Reviews (1): Last reviewed commit: "Fix accessibility collection reads" | Re-trigger Greptile

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.

The API that reads a list of accessibility items returns an empty list

1 participant