Skip to content

refactor: change package wda to devicekit - #312

Merged
gmegidish merged 1 commit into
mainfrom
refactor-package-rename-wda
Jul 28, 2026
Merged

refactor: change package wda to devicekit#312
gmegidish merged 1 commit into
mainfrom
refactor-package-rename-wda

Conversation

@gmegidish

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a06a1f9e-3eaa-49d4-bbb3-903c73588f03

📥 Commits

Reviewing files that changed from the base of the PR and between b169e89 and d043ae4.

📒 Files selected for processing (27)
  • commands/input.go
  • devices/android.go
  • devices/common.go
  • devices/devicekit/active-app.go
  • devices/devicekit/gesture.go
  • devices/devicekit/longpress.go
  • devices/devicekit/mjpeg/health.go
  • devices/devicekit/mjpeg/screencapture.go
  • devices/devicekit/mjpeg/types.go
  • devices/devicekit/open-url.go
  • devices/devicekit/orientation.go
  • devices/devicekit/press-button.go
  • devices/devicekit/press-keys.go
  • devices/devicekit/requests.go
  • devices/devicekit/screenshot.go
  • devices/devicekit/send-keys.go
  • devices/devicekit/source.go
  • devices/devicekit/source_test.go
  • devices/devicekit/status.go
  • devices/devicekit/swipe.go
  • devices/devicekit/tap.go
  • devices/devicekit/types.go
  • devices/devicekit/windowsize.go
  • devices/ios.go
  • devices/keys.go
  • devices/remote.go
  • devices/simulator.go

Walkthrough

The change moves the WebDriverAgent implementation into the devicekit package namespace. It adds gesture conversion and RPC methods, MJPEG screen capture and health-check clients, URL and status APIs, and updates Android, iOS, simulator, remote-device, command, and key-combo integrations to use the new package and action types.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No author description was provided, so there is no meaningful summary to assess. Add a short description explaining the package rename and any API or type updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the package rename that dominates the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor-package-rename-wda

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
devices/devicekit/gesture.go (1)

19-79: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject unsupported gesture action types instead of silently dropping them.

convertActions has no default case, so malformed or future actions are omitted and the RPC may execute a truncated gesture successfully. This is inconsistent with devices/android.go, which returns an error for unsupported types.

Proposed fix
-func convertActions(actions []TapAction) []gestureAction {
+func convertActions(actions []TapAction) ([]gestureAction, error) {
...
 		case "pause":
 			if len(result) > 0 {
 				result[len(result)-1].Duration += float64(a.Duration) / 1000.0
 			}
+		default:
+			return nil, fmt.Errorf("unsupported gesture action type: %s", a.Type)
 		}
 	}
-	return result
+	return result, nil
 }

 func (c *WdaClient) Gesture(actions []TapAction) error {
+	converted, err := convertActions(actions)
+	if err != nil {
+		return err
+	}
 	params := map[string]any{
-		"actions": convertActions(actions),
+		"actions": converted,
 	}

Also applies to: 81-87

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@devices/devicekit/gesture.go` around lines 19 - 79, Update convertActions to
detect unsupported TapAction.Type values and return an error instead of silently
omitting them. Propagate the error through its callers so the gesture RPC fails
without executing a truncated action sequence, matching the unsupported-type
handling in devices/android.go.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@devices/devicekit/mjpeg/screencapture.go`:
- Around line 13-43: Bound the initial MJPEG connection and probe while
preserving an unbounded client for the established stream: in
devices/devicekit/mjpeg/screencapture.go lines 13-43, replace the unbounded
request context or client behavior used by the connection retry with a
deadline-limited probe, then switch to unbounded streaming only after the 200
response is established; in devices/devicekit/mjpeg/health.go lines 5-11, update
CheckHealth to use a bounded context or read deadline while waiting for the
first body bytes so health checks cannot hang.

---

Outside diff comments:
In `@devices/devicekit/gesture.go`:
- Around line 19-79: Update convertActions to detect unsupported TapAction.Type
values and return an error instead of silently omitting them. Propagate the
error through its callers so the gesture RPC fails without executing a truncated
action sequence, matching the unsupported-type handling in devices/android.go.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a06a1f9e-3eaa-49d4-bbb3-903c73588f03

📥 Commits

Reviewing files that changed from the base of the PR and between b169e89 and d043ae4.

📒 Files selected for processing (27)
  • commands/input.go
  • devices/android.go
  • devices/common.go
  • devices/devicekit/active-app.go
  • devices/devicekit/gesture.go
  • devices/devicekit/longpress.go
  • devices/devicekit/mjpeg/health.go
  • devices/devicekit/mjpeg/screencapture.go
  • devices/devicekit/mjpeg/types.go
  • devices/devicekit/open-url.go
  • devices/devicekit/orientation.go
  • devices/devicekit/press-button.go
  • devices/devicekit/press-keys.go
  • devices/devicekit/requests.go
  • devices/devicekit/screenshot.go
  • devices/devicekit/send-keys.go
  • devices/devicekit/source.go
  • devices/devicekit/source_test.go
  • devices/devicekit/status.go
  • devices/devicekit/swipe.go
  • devices/devicekit/tap.go
  • devices/devicekit/types.go
  • devices/devicekit/windowsize.go
  • devices/ios.go
  • devices/keys.go
  • devices/remote.go
  • devices/simulator.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
devices/devicekit/gesture.go (1)

19-79: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject unsupported gesture action types instead of silently dropping them.

convertActions has no default case, so malformed or future actions are omitted and the RPC may execute a truncated gesture successfully. This is inconsistent with devices/android.go, which returns an error for unsupported types.

Proposed fix
-func convertActions(actions []TapAction) []gestureAction {
+func convertActions(actions []TapAction) ([]gestureAction, error) {
...
 		case "pause":
 			if len(result) > 0 {
 				result[len(result)-1].Duration += float64(a.Duration) / 1000.0
 			}
+		default:
+			return nil, fmt.Errorf("unsupported gesture action type: %s", a.Type)
 		}
 	}
-	return result
+	return result, nil
 }

 func (c *WdaClient) Gesture(actions []TapAction) error {
+	converted, err := convertActions(actions)
+	if err != nil {
+		return err
+	}
 	params := map[string]any{
-		"actions": convertActions(actions),
+		"actions": converted,
 	}

Also applies to: 81-87

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@devices/devicekit/gesture.go` around lines 19 - 79, Update convertActions to
detect unsupported TapAction.Type values and return an error instead of silently
omitting them. Propagate the error through its callers so the gesture RPC fails
without executing a truncated action sequence, matching the unsupported-type
handling in devices/android.go.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@devices/devicekit/mjpeg/screencapture.go`:
- Around line 13-43: Bound the initial MJPEG connection and probe while
preserving an unbounded client for the established stream: in
devices/devicekit/mjpeg/screencapture.go lines 13-43, replace the unbounded
request context or client behavior used by the connection retry with a
deadline-limited probe, then switch to unbounded streaming only after the 200
response is established; in devices/devicekit/mjpeg/health.go lines 5-11, update
CheckHealth to use a bounded context or read deadline while waiting for the
first body bytes so health checks cannot hang.

---

Outside diff comments:
In `@devices/devicekit/gesture.go`:
- Around line 19-79: Update convertActions to detect unsupported TapAction.Type
values and return an error instead of silently omitting them. Propagate the
error through its callers so the gesture RPC fails without executing a truncated
action sequence, matching the unsupported-type handling in devices/android.go.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a06a1f9e-3eaa-49d4-bbb3-903c73588f03

📥 Commits

Reviewing files that changed from the base of the PR and between b169e89 and d043ae4.

📒 Files selected for processing (27)
  • commands/input.go
  • devices/android.go
  • devices/common.go
  • devices/devicekit/active-app.go
  • devices/devicekit/gesture.go
  • devices/devicekit/longpress.go
  • devices/devicekit/mjpeg/health.go
  • devices/devicekit/mjpeg/screencapture.go
  • devices/devicekit/mjpeg/types.go
  • devices/devicekit/open-url.go
  • devices/devicekit/orientation.go
  • devices/devicekit/press-button.go
  • devices/devicekit/press-keys.go
  • devices/devicekit/requests.go
  • devices/devicekit/screenshot.go
  • devices/devicekit/send-keys.go
  • devices/devicekit/source.go
  • devices/devicekit/source_test.go
  • devices/devicekit/status.go
  • devices/devicekit/swipe.go
  • devices/devicekit/tap.go
  • devices/devicekit/types.go
  • devices/devicekit/windowsize.go
  • devices/ios.go
  • devices/keys.go
  • devices/remote.go
  • devices/simulator.go
🛑 Comments failed to post (1)
devices/devicekit/mjpeg/screencapture.go (1)

13-43: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== file list ==\n'
git ls-files 'devices/devicekit/mjpeg/*'

printf '\n== outlines ==\n'
ast-grep outline devices/devicekit/mjpeg/screencapture.go --view expanded || true
ast-grep outline devices/devicekit/mjpeg/health.go --view expanded || true

printf '\n== screencapture.go ==\n'
cat -n devices/devicekit/mjpeg/screencapture.go | sed -n '1,220p'

printf '\n== health.go ==\n'
cat -n devices/devicekit/mjpeg/health.go | sed -n '1,200p'

Repository: mobile-next/mobilecli

Length of output: 2996


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== search for related timeouts / contexts ==\n'
rg -n "Timeout: 0|context.Background\(|WithTimeout|WithDeadline|SetReadDeadline|CheckHealth\(|StartScreenCapture\(" devices/devicekit/mjpeg -S

printf '\n== call sites of StartScreenCapture ==\n'
rg -n "StartScreenCapture\(" -S .

Repository: mobile-next/mobilecli

Length of output: 2368


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,220p' devices/devicekit/mjpeg/screencapture.go | nl -ba
printf '\n---\n'
sed -n '1,120p' devices/devicekit/mjpeg/health.go | nl -ba

Repository: mobile-next/mobilecli

Length of output: 199


Bound the MJPEG connect/probe path.

Timeout: 0 plus context.Background() lets client.Do block past the 10-second retry window, and CheckHealth can hang waiting for the first body bytes after a 200 response. Use a bounded context or transport timeout for the initial probe, and keep the long-lived stream unbounded after it is established.

  • devices/devicekit/mjpeg/screencapture.go#L13-L43
  • devices/devicekit/mjpeg/health.go#L5-L11
📍 Affects 2 files
  • devices/devicekit/mjpeg/screencapture.go#L13-L43 (this comment)
  • devices/devicekit/mjpeg/health.go#L5-L11
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@devices/devicekit/mjpeg/screencapture.go` around lines 13 - 43, Bound the
initial MJPEG connection and probe while preserving an unbounded client for the
established stream: in devices/devicekit/mjpeg/screencapture.go lines 13-43,
replace the unbounded request context or client behavior used by the connection
retry with a deadline-limited probe, then switch to unbounded streaming only
after the 200 response is established; in devices/devicekit/mjpeg/health.go
lines 5-11, update CheckHealth to use a bounded context or read deadline while
waiting for the first body bytes so health checks cannot hang.

@gmegidish
gmegidish merged commit 6797743 into main Jul 28, 2026
19 checks passed
@gmegidish
gmegidish deleted the refactor-package-rename-wda branch July 28, 2026 18:27
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