Skip to content

feat(snapshot): collapse the iOS keyboard into one line in text snapshots - #5189

Merged
thymikee merged 10 commits into
mainfrom
t3/collapse-ios-keyboard-snapshot-nodes
Nov 29, 2026
Merged

thymikee merged 10 commits into
mainfrom
t3/collapse-ios-keyboard-snapshot-nodes

Conversation

@thymikee

@thymikee thymikee commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

With the iOS software keyboard up, text snapshots listed every key, the QuickType bar, and the dock buttons: 17 app lines became 68. keyboardEnter is now a conditional operation of the snapshot uses. The daemon stamps keyboardEnterServed on the response only when the bound runtime carries it. formatSnapshotText collapses only on that fact: it drops what the existing keyboard chrome classifier strips from settle diffs, keeps the [keyboard] line, and prints one notice. Devices without Return (cloud WebDriver iOS, Revyl iOS, tvOS) keep every key. JSON, raw, and diff output are unchanged; CLI --json strips the fact.

Before / after

iPhone 17 Simulator, iOS 27.0, SwiftUI sign-in demo, press id="email", measured at 5f0e5d6 (base 89e65e9):

Call base head
snapshot -i 68 lines, 1,633 chars (408 tok) 20 lines, 722 chars (181 tok)
snapshot 2,259 chars (565 tok) 1,031 chars (258 tok)
sign-in flow (MCP), 5 runs, median 790 tok 577 tok
batched flow, median 566 tok 353 tok

Head adds Collapsed 49 iOS keyboard nodes (keyboard covers y 590-874); keyboard enter sends Return. Snapshot JSON lists every keyboard key.

Unchanged on both: keyboard status reports visible with return key enter; keyboard enter dismisses the keyboard; snapshot -i --json keeps 68 nodes, 40 Key.

Validation

At 5f0e5d6: snapshot-ios-keyboard.test.ts (fact present collapses; fact absent and a WebDriver iOS response keep Return; exact raw lines; --json strips the fact) and snapshot-chrome.test.ts (reparenting) pass. Other gates: CI.

🤖 Generated with Claude Code

thymikee and others added 2 commits November 28, 2026 20:46
…hots

Text snapshots listed every key, the QuickType bar and the dock buttons
once the iOS software keyboard was up (16 app nodes became 68 lines).
The text presenter now drops the nodes the keyboard chrome classifier
already strips from settle diffs, keeps the [keyboard] line, and prints
one notice with the covered area, keyboard enter, and --raw/--json for
the full tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.69 MB 6.69 MB +2.2 kB
Package (unpacked) 6.69 MB 6.69 MB +2.2 kB
Package (download) 2.04 MB 2.04 MB +536 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 18.1 ms 17.9 ms -0.1 ms
CLI --help 37.3 ms 41.4 ms +4.1 ms

Affected plugins

Plugin Installed (including dependencies) Unpacked Download
@agent-device/revyl 179.6 kB → 179.6 kB (+40 B) 179.2 kB → 179.2 kB (+40 B) 58.2 kB → 58.2 kB (+15 B)
@agent-device/testmu 26.1 kB → 26.1 kB (0 B) 25.7 kB → 25.7 kB (0 B) 9.4 kB → 9.4 kB (0 B)
@agent-device/tizen 97.5 kB → 97.5 kB (0 B) 97.1 kB → 97.1 kB (0 B) 34.4 kB → 34.4 kB (0 B)
@agent-device/webos 96.4 kB → 96.4 kB (0 B) 96.1 kB → 96.1 kB (0 B) 34.0 kB → 34.0 kB (0 B)

@blacksmith-sh

This comment has been minimized.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread website/docs/docs/snapshots.md Resolved
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At 546847f, the keyboard collapse can send a caller to a command that the device does not support, so this needs a fix before merge.

On a cloud WebDriver iOS session with the keyboard up, the Appium keyboard tree goes through the collapse. The Return, Search, Go or Done key line and its ref are removed, and the notice says keyboard enter sends Return. That route is not served there: enter is declared for Android only. This is a regression, because on the base branch the return key is visible in snapshot -i and can be pressed. Revyl iOS refuses the whole keyboard family, so it is affected too if its tree reports a Keyboard node (not checked). The rule: collapse the keys and name keyboard enter only where the bound device serves the keyboardEnter operation. That answer should come from the runtime operation facts on the daemon side, as one typed fact on the snapshot response, not from a guess in the presenter. Where the fact is absent, keep the keys, or keep them and print no route. Please qualify the new help and snapshots.md sentences to match, and cover WebDriver iOS with a test on a production-shaped response (no backend).

Not blocking: each of these can be taken or left: Apple TV captures reach the same collapse, so if tvOS reports its on-screen keyboard as a Keyboard element with Key children, even the [focused] key would be removed while keyboard enter is refused there (the fix above covers this; confirm with a tvOS capture or exclude it by the same fact); the backend check reads a field that production responses do not carry, so it and its Android test input could be replaced by that fact, with test input built through serializeSnapshotResult; diff text (diff snapshot -i, snapshot --diff) still lists every key, so a follow-up could apply the same collapse, or the help sentence could be limited to snapshot; hints in CLI help, workflow help, the occlusion hint and the runner point to a visible Hide Keyboard key that snapshot text now omits on iPad, so they could also say that --json lists keyboard keys, ideally from one shared string; readKeyboardFrame could parse with readSnapshotKeyboardBandFact and read frame from the visible and derived kinds; the notice names --raw and --json even in MCP text, where those flags do not apply as written; and kept nodes get a new depth but can keep a parentIndex to a removed node, which stops ancestor walks early, so each could be reparented to its nearest kept ancestor in the same pass.

Could the daemon snapshot route stamp one typed text-presentation fact only when the bound device serves keyboardEnter, with formatSnapshotText collapsing solely on that fact? The snapshot response (daemon snapshot runtime, CaptureSnapshotResult and its client normalizer) would have to carry it first. JSON can stay unchanged by stripping the fact the way unchanged is already stripped, and the backend gate and its Android test could then go.

One earlier high-priority thread still applies: backend gate is inert. These threads no longer apply and can be resolved: #5189 (comment) (snapshots.md now says the covered area is present only when measured), #5189 (comment) (the command description no longer promises a [keyboard] line), and #5189 (comment) (the raw test now compares every line with the input nodes).

Checks are green: 22 checks, all passing. The earlier MCP description test failure came before this commit.

Not verified here: no tests or devices were run, and production routes were only traced from source. No live cloud WebDriver iOS or tvOS capture was taken, so the WebDriver finding rests on the declared runtime facts and the Appium source parser, and the tvOS tree shape is assumed. The iPad Hide Keyboard key and the hardware-keyboard assistant bar were not exercised, and the notice may also appear when only a keyboard marker host remains with no keyboard up. The simulator line and output size figures in the PR were measured at an earlier commit and were not reproduced.

Before merge, the collapse and its keyboard enter route need to depend on the device actually serving Return, based on a fact the response really carries.

…board enter

The text collapse removed the Return key line on devices that do not
serve keyboard enter (cloud WebDriver iOS, Revyl iOS), leaving no route
to submit. keyboardEnter is now a conditional operation of the snapshot
uses; the daemon stamps keyboardEnterServed on the snapshot response
only when the bound runtime carries it, the client keeps it, CLI --json
strips it, and formatSnapshotText collapses only on it.

Also: parse the band with readSnapshotKeyboardBandFact, word the notice
without CLI flags from one shared string the occlusion hint reuses,
reparent kept nodes to their nearest kept ancestor, and limit the help
sentence to snapshot text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blacksmith-sh

This comment has been minimized.

thymikee and others added 2 commits November 28, 2026 22:23
…in tests and trim the workflow card

Simplify the keyboard reparenting loop to one ancestry record per node.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Hide Keyboard note lives in the shared occlusion hint and the keyboard
description; the workflow card stays as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thymikee

Copy link
Copy Markdown
Member Author

Addressed the blocking finding at 3bbb661 (fix in 5f0e5d6):

  • keyboardEnter is a conditional operation of the snapshot uses. The daemon stamps keyboardEnterServed on the snapshot response only when the bound runtime carries it; CaptureSnapshotResult and the client normalizer keep it, and CLI --json strips it next to unchanged.
  • formatSnapshotText collapses only on that fact. The backend gate and its Android test are gone. WebDriver iOS, Revyl iOS, tvOS and macOS keep every key.
  • New test: a production-shaped WebDriver iOS response (no backend, no fact) keeps its Return key line; inputs go through serializeSnapshotResult.
  • Non-blocking notes taken: band parsed with readSnapshotKeyboardBandFact; notice worded without CLI flags from one shared string the occlusion hint reuses; kept nodes reparented to their nearest kept ancestor; help and snapshots.md limited to snapshot text on devices that serve keyboard enter. Skipped: the Swift runner hint (needs a runner rebuild) and the workflow card (over its size budget).
  • Re-measured at 5f0e5d6 on the iPhone 17 Simulator: snapshot -i with the keyboard up 408 → 181 tokens, sign-in flow over MCP 790 → 577 tokens. Later commits change only tests, help text, and an internal rewrite.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 3bbb661. The earlier problem with keyboard enter is fixed: the daemon now reports whether the bound device serves it, so unsupported routes such as cloud WebDriver iOS keep the base output.

Not blocking: these can be taken or left: add a daemon snapshot-route case where the device refuses keyboardEnter and assert the response lacks keyboardEnterServed, because a decision that always returned true would still pass the current tests; change “Diff output always lists every key” to “diff snapshot output lists every key”, because --settle diffs already strip keyboard chrome; and, since only the snapshot CLI output strips the field while batch --json snapshot steps, Node SDK results and structured MCP results carry keyboardEnterServed, either narrow the two matching sentences to snapshot/open --json or accept the additive field.

These earlier threads no longer apply and can be resolved: #5189 (comment) (the docs name the area only when the keyboard frame was measured), #5189 (comment) (the command description now describes one notice and promises no [keyboard] line), #5189 (comment) (Android trees reach the collapse, but no Android node was found that matches its keyboard type or roles), and #5189 (comment) (the test now compares every raw line with the input nodes).

Checks are green at this commit: 22 checks, all passing.

Not verified here: no tests, devices or builds were run, and routes were only traced from source. No live cloud WebDriver iOS, Revyl, tvOS or Android capture was taken; the WebDriver case rests on declared runtime facts and a hand-built tree. The absence of an Android or HarmonyOS node typed Keyboard rests on a repository search and the code that builds the trees, not device dumps, and HarmonyOS ArkUI keyboard-window component types were not checked. The author's simulator measurements at 5f0e5d6 were not reproduced.

Nothing else is needed before merge from this review.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
thymikee and others added 2 commits November 28, 2026 23:10
…fact

Cover the daemon snapshot route where the owner facts refuse keyboardEnter,
say that diff snapshot output lists every key, and name snapshot --json as
the output that hides the text-presentation fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 4bb6c10

Since the review of 3bbb661: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

1 new finding away from what changed since 3bbb661 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (89e65e9099d1).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
@thymikee

Copy link
Copy Markdown
Member Author

No code problems were found at 4bb6c10. Since the earlier clean result, the docs and CLI help wording points are fixed, and nothing remains to change.

None of these open threads still applies, so they can be resolved:

All checks pass except Proof, which is skipped. The required evidence is in place.

Not verified here: no tests, builds or device runs were performed, and the new test was judged from its source and the passing checks. No new live run is needed, because the newer changes have no device-facing production change. The earlier simulator measurements reported at 5f0e5d6 were not reproduced.

Nothing from this review holds back the merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
@thymikee
thymikee merged commit 1efc47d into main Nov 29, 2026
22 checks passed
@thymikee
thymikee deleted the t3/collapse-ios-keyboard-snapshot-nodes branch November 29, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant