Files
sanderling/proto/driverpb/driver.proto
pj 19a470121f fix: iOS spec driving, InputText replace semantics, native DoubleTap (#58)
* fix(hierarchy): bounds-containment fallback for scoped and path queries

Compose on iOS surfaces a testTag node as an empty leaf sibling of the
content it labels instead of as an ancestor, so descendant search under
the tagged node finds nothing and every path or scoped query returns
null. When structural search yields no match, fall back to nodes whose
bounds lie inside the scope node's bounds.

* feat(sidecar): derive iOS clickable and editable from element type

The XCTest hierarchy mapping dropped the element type, leaving no
clickable or editable flags on iOS, so the fuzzer's tap and typing
verbs never found a candidate inside the app. Map the raw
accessibility tree directly and derive clickable, editable,
scrollable, and class from the XCUIElementType raw value.

* feat(proto): add EraseText RPC for InputText replace semantics

* feat(driver): add EraseText to the device driver surface

* fix(runner): erase existing field text before InputText

InputText appended on native platforms, so repeated draws grew fields
without bound. The folio fuzz run wedged on the add-account screen:
each draw concatenated another name until the 40-character validation
error became permanent. Replace semantics also makes retried typing
idempotent. The web driver already replaced via select-all; native now
matches.

* feat(sidecar): EraseText backend support on android and ios

* fix(folio): saturation-gate account creation in the spec

The 2-3 step add-account loop outcompeted the 5-step transaction chain
at every weighted re-draw, so runs filled with account creation and
rarely exercised the balance properties. Stop offering add-account once
three accounts exist; the renormalized weights then favor the
transaction flow at every step of its chain.

* fix(folio): author spec weights to match testing intent

Revert the account saturation gate: it starved newAccountBalanceIsZero
once it tripped, and a magic account count is app-state tuning, not
intent. Instead weight the generators by what the properties need:
the transaction chain leads, account creation stays exercised, and
doubleTaps gets explicit weight everywhere because double-submission
idempotency is what the spec is testing for.

* fix(folio): lower doubleTaps weight to 5

* fix(sidecar): surface visible text on iOS static elements

Static text and button strings live in the accessibility label on
iOS, so the text attribute came through empty and every balance
extractor parsed to zero, silently disarming both folio properties.
Non-editable elements now fall back title, value, then label;
editable fields keep value-only so an empty field's caption does not
read as content.

* feat(driver): native DoubleTap RPC for a tight inter-tap gap

Composing two Tap round trips from the Go client spread the taps by
hundreds of milliseconds on iOS, wide enough for the app to navigate
between them, so double-submission races could never reproduce. The
sidecar now lands both taps back-to-back next to the device transport.

* feat(sidecar): pipeline iOS double-tap requests

Queue the second tap at the XCTest runner while the first executes.
The runner serializes handlers, so this is the tightest gap the
transport allows (~350ms per tap round trip); recorded here with
measurements for the iOS double-tap limitation.
2026-06-05 23:42:39 +05:30

131 lines
3.0 KiB
Protocol Buffer

syntax = "proto3";
package sanderling.driver.v1;
option go_package = "github.com/priyanshujain/sanderling/proto/driverpb;driverpb";
option java_package = "dev.sanderling.driver.v1";
option java_multiple_files = true;
service Driver {
rpc Launch(LaunchRequest) returns (Empty);
rpc Terminate(Empty) returns (Empty);
rpc Tap(Point) returns (Empty);
// DoubleTap lands two taps as close together as the platform allows.
// Composing two Tap calls from the client spreads them by hundreds of
// milliseconds on iOS, wide enough for navigation to interleave, which
// defeats double-submission testing.
rpc DoubleTap(Point) returns (Empty);
rpc TapSelector(Selector) returns (Empty);
rpc InputText(Text) returns (Empty);
// EraseText deletes characters from the focused field so InputText can
// replace existing content instead of appending to it.
rpc EraseText(EraseTextRequest) returns (Empty);
rpc Swipe(SwipeRequest) returns (Empty);
rpc PressKey(PressKeyRequest) returns (Empty);
rpc LongPress(Point) returns (Empty);
rpc Screenshot(Empty) returns (Image);
rpc Hierarchy(Empty) returns (HierarchyJSON);
// Snapshot captures hierarchy and screenshot back-to-back under a
// backend-side mutex so the pair describes the same on-device frame.
// Use this instead of racing Hierarchy and Screenshot from the runner.
rpc Snapshot(Empty) returns (SnapshotResponse);
rpc RecentLogs(RecentLogsRequest) returns (LogEntries);
rpc WaitForIdle(Duration) returns (Empty);
rpc Health(Empty) returns (HealthStatus);
rpc Metrics(MetricsRequest) returns (MetricsResponse);
}
message Empty {}
message LaunchRequest {
string bundle_id = 1;
bool clear_state = 2;
map<string, string> env = 3;
}
message Point {
int32 x = 1;
int32 y = 2;
}
message Text {
string value = 1;
}
message EraseTextRequest {
int32 character_count = 1;
}
message Selector {
string value = 1;
}
message Image {
bytes png = 1;
int32 width = 2;
int32 height = 3;
}
message HierarchyJSON {
string json = 1;
}
message SnapshotResponse {
HierarchyJSON hierarchy = 1;
Image screenshot = 2;
}
message Duration {
int64 millis = 1;
}
message HealthStatus {
bool ready = 1;
string version = 2;
string platform = 3;
}
message SwipeRequest {
Point from = 1;
Point to = 2;
int64 duration_millis = 3;
}
message PressKeyRequest {
// Logical key name. Supported: "back", "home", "enter", "tab", "up",
// "down", "left", "right".
string key = 1;
}
message RecentLogsRequest {
// Lower bound as unix-epoch milliseconds; entries at or after this are
// returned.
int64 since_unix_millis = 1;
// Minimum level: "E", "W", or "I". Empty defaults to "E".
string level_at_least = 2;
}
message LogEntries {
repeated LogEntry entries = 1;
}
message LogEntry {
int64 unix_millis = 1;
string level = 2;
string tag = 3;
string message = 4;
}
message MetricsRequest {
string bundle_id = 1;
}
message MetricsResponse {
double cpu_percent = 1;
int64 heap_bytes = 2;
int64 total_memory_bytes = 3;
}