Skip to content

Add ax_tree_walk: readable roles + addressable node paths for a11y dumps#399

Merged
JE-Chen merged 1 commit into
devfrom
feat/ax-tree-walk-batch
Jun 24, 2026
Merged

Add ax_tree_walk: readable roles + addressable node paths for a11y dumps#399
JE-Chen merged 1 commit into
devfrom
feat/ax-tree-walk-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why

dump_accessibility_tree emits each node with the platform's raw role — on Windows the bare UIA ControlType id, e.g. ControlType_50000 for a button — which is unreadable, and a serialised dump carries no stable per-node identity (UIA RuntimeId needs the live element). ax_tree_walk adds the pure, platform-agnostic post-processing the dump lacks, composable on top of any dump_accessibility_tree output:

  • control_type_name / humanize_role — ControlType id (or "ControlType_NNNNN" / "NNNNN") → friendly name
  • humanize_tree — deep copy of the tree with every role humanised
  • assign_node_paths — deep copy stamping each node with a stable positional path ("0.2.1"), a pure stand-in for RuntimeId
  • find_by_path — resolve a node back from its path

Unknown ids and non-UIA roles ("AXApplication") pass through unchanged.

Design

  • Pure-stdlib over AXTreeNode — no device/backend access, no PySide6.
  • 5 layers wired: core → facade __all__AC_walk_tree (humanised + path-stamped dict; the readable counterpart to AC_a11y_dump) and AC_humanize_role executor commands → read-only ac_* MCP tools → Script Builder (Native UI).

Tests

test/unit_test/headless/test_ax_tree_walk_batch.py — pure-function cases (table, all role forms, deep-copy isolation, path round-trip) plus the _walk_tree executor path exercised via a fake backend returning ControlType_* elements, and 5-layer wiring. 23 passed alongside the sibling a11y batches.

dump_accessibility_tree emits the platform's raw role (on Windows the
bare UIA ControlType id, e.g. ControlType_50000) and a serialised dump
carries no stable per-node identity. Add the pure post-processing it
lacks: a ControlType-id to friendly-name table, whole-tree role
humanization, a stable positional path per node (a pure stand-in for
RuntimeId), and path resolution. AC_walk_tree is the readable
counterpart to AC_a11y_dump.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 32 complexity · 0 duplication

Metric Results
Complexity 32
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit b5d6a41 into dev Jun 24, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/ax-tree-walk-batch branch June 24, 2026 02:50
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant