Improve ControlKit UI introspection and tvOS diagnostics - #51
Conversation
Co-Authored-By: siGit Code <297239231+sigitc@users.noreply.github.com>
|
siGit Code review is paused because this GitHub App installation is not linked to a siGit account. Link it at https://sigit.si/settings to resume reviews. |
There was a problem hiding this comment.
This PR adds a mandatory bundle_id field to UiTargetArgs and threads it through both ui_describe and ui_element_list ControlKit calls. It also refactors ControlKit::call into call+send, with call now handling JSON-RPC error extraction and emitting a richer diagnostic (including a follow-up device.info probe) when the method is not found. Additional fields (depth, enabled, selected, hittable) are included in the filtered element output, and the empty-string identity check tightens element selection. Error messages and docs are updated to be platform-agnostic (iOS → Apple simulator).
Automated review by siGit Code Review · commit 10b369c
There was a problem hiding this comment.
This PR makes two main changes:
-
bundle_idis now required forui_describeandui_element_list: a newrequire_bundle_idhelper validates and trims it, returning a structured error if absent. ThebundleIdfield is forwarded to thedevice.dump.uiRPC call. -
Better ControlKit error diagnostics:
callis split intocall+send; on a-32601(method-not-found) response, a secondarydevice.infocall fetches the runner name and protocol version to produce an actionable upgrade message.
Additional changes: AppleTargetArgs (without bundle_id) is introduced so orientation_get and similar tools keep a clean schema; empty-string identity values are now filtered out in collect_controlkit_elements; new tvOS-resolution fields (depth, enabled, selected, hittable) are included in the element snapshot; error messages and docs are generalised from "iOS" to "Apple".
Automated review by siGit Code Review · commit 75f5b51
There was a problem hiding this comment.
This PR adds bundle_id as a required runtime parameter to ui_describe and ui_element_list, introduces a new AppleTargetArgs struct (without bundle_id) to keep orientation_get and similar tools free of that field, refactors ControlKit::call into call+send so that -32601 Method Not Found errors automatically fetch device.info for a richer diagnostic, filters out empty-string identity values from the element collector, and adds depth/enabled/selected/hittable to the fields copied into flat element objects. Tests cover schema shape, require_bundle_id trimming/rejection, the new error-message paths, and element extraction.
Automated review by siGit Code Review · commit 4d005aa
There was a problem hiding this comment.
This PR adds a required bundle_id parameter to ui_describe and ui_element_list (validated at runtime via require_bundle_id, while the schema field stays optional so callers can omit it and get a clear error). It also introduces AppleTargetArgs (without bundle_id) to replace UiTargetArgs for tools like orientation_get, improves collect_controlkit_elements to skip empty-string identity fields, adds depth/enabled/selected/hittable to the extracted element keys, and enriches error messages for JSON-RPC -32601 (method not found) by doing a secondary device.info probe to surface the runner version.
Automated review by siGit Code Review · commit 4d1cf59
There was a problem hiding this comment.
This PR adds bundle_id as a required runtime parameter to ui_describe and ui_element_list (passed in the JSON-RPC call but kept Option<String> in the schema so the field is optional at the schema level, with explicit validation via require_bundle_id). It splits AppleTargetArgs from UiTargetArgs so tools like orientation_get no longer expose bundle_id. The ControlKit::call path is refactored into call+send: on a JSON-RPC method-not-found error it now fires a secondary device.info probe (with a 2-second timeout) to include runner version info in the error message. collect_controlkit_elements gains empty-string filtering for identity fields and surfaces depth/enabled/selected/hittable. Error messages are updated throughout for tvOS/watchOS/visionOS generality.
Automated review by siGit Code Review · commit 1f423c6
|
Thanks for the thorough pass. Went through all of it against the current head. Most of the real issues are already fixed in One thing left worth doing: added a comment on What I skipped, and why:
fmt, clippy ( |
There was a problem hiding this comment.
This PR makes two main changes:
-
bundle_idis now required at call-time forui_describeandui_element_list– a newAppleTargetArgsstruct (withoutbundle_id) splits off fromUiTargetArgs(which gainsbundle_id). Arequire_bundle_idhelper validates the field and returns a clear error when it's absent or blank. Both UI tools passbundleIdto the ControlKitdevice.dump.uiRPC. -
Richer ControlKit error diagnostics –
ControlKit::callis split intocall+send. When a JSON-RPC-32601(method-not-found) error is returned,callfires a secondarydevice.infoprobe (with a 2-second timeout) and surfaces the runner name and protocol version in the error message. Theis_controlkit_method_not_foundhelper also handles runners that serialize the error code as a float.
Additionally, collect_controlkit_elements now filters out empty-string identity fields, and the output includes depth, enabled, selected, and hittable per element.
Tests cover the new schema shape, error formatting, and element extraction. The primary concern is a subtle double-probe risk and an error path that silently drops runner info.
Automated review by siGit Code Review · commit c85b39a
Related Issue
Related ondeinference/xcrs-controlkit#1
Description
Type of Change
How Has This Been Tested?
cargo test --all-featuressmb <command>)Checklist
cargo check --workspacepassescargo clippy --workspace --tests -- -D warningspassescargo fmt --all -- --checkpassesunwrap()orexpect()calls in production codemod.rsfiles introducedCargo.tomland inherited with{ workspace = true }Release Notes