iOS keyboard capture can race dismissal and omit the input assistant bar
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 51/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- ios, typescript
- 领域
- mobile, testing-qa
调研方向
Read RunnerTests+Keyboard.swift at the supplied source revision, focusing on captureKeyboardBandFact and keyboardBandFact, then follow the caller in RunnerTests+SnapshotAcquisition.swift. Use the upstream keyboard fixtures and tests to check that one captured tree determines keyboard presence and coverage, including the assistant bar and normalized frames. Done means the dismissal race is removed while absent results, invalid geometry, budgets, and wire shape remain preserved; the payload reports 14 native keyboard tests and iOS/macOS runner builds passing.
由索引模型根据 Issue 内容生成。
描述
Problem
The iOS XCTest capture path reads its accessibility tree, then independently queries app.keyboards.firstMatch, keyboard.exists, and keyboard.frame to publish the keyboard band. These observations can describe different moments. If the keyboard disappears between the existence and frame reads, XCTest can fail the live element lookup instead of returning a usable capture. A keyboard appearing or disappearing after the tree capture can also make its nodes and published band disagree.
The measured band additionally omits SystemInputAssistantView when the prediction/input-assistant bar is outside the keyboard element. An app control covered by that bar can consequently be treated as clear of the keyboard.
Source at 45125d717b207736dd47bc7969edbff7807a6e6d: RunnerTests+Keyboard.swift, captureKeyboardBandFact/keyboardBandFact; caller: RunnerTests+SnapshotAcquisition.swift.
Generic reproduction and expected behavior
- Capture a standard text field with the software keyboard visible, including its input assistant. Compare the published keyboard frame with both captured rectangles.
- Example captured keyboard
(0,600,390,244)plus assistant(0,556,390,44)must cover(0,556,390,288). - Capture while ending editing: measurement must use that capture's immutable tree, rather than re-querying a live keyboard that may have disappeared. The source-level race does not establish a deterministic crash reproduction on every simulator.
Completion conditions
Use the same captured tree for keyboard presence and coverage. Include the native assistant only when a keyboard is present. Normalize each contributing frame through the existing coordinate-space policy before combining it, including landscape and placed windows. Preserve absent/unmeasurable results, invalid-geometry handling, budgets and wire shape. Verify through upstream fixtures only; no application-specific fixture or new dependency is required.
Verification at 81266c2598b162d373703a921fdfedaee97ea00f
Dedicated iPhone 15 Pro Simulator, iOS 27.0; only the upstream com.callstack.agentdevice.runner fixture. Each checkout had separate DerivedData and daemon state. The same live tree-backend capture and band-containment assertion ran against base 45125d717b207736dd47bc7969edbff7807a6e6d and the proposed head:
| Capture | Published band (x,y,width,height) |
Captured assistant | Assistant covered |
|---|---|---|---|
| Base, portrait | (0,568,393,226) |
(0,524,393,44) |
No: assertion fails |
| Head, portrait | (0,524,393,270) |
(0,524,393,44) |
Yes: assertion passes |
| Head, landscape | (75,169,702,221) |
(75,169,702,44) |
Yes: assertion passes |
Relaunching with no software keyboard also reports keyboard: {kind: "absent"}. Fourteen native keyboard tests pass with zero retries, including mixed-window coordinates and invalid native geometry. iOS and macOS runner builds pass. The source-level dismissal race was not deterministically reproduced as an XCTest failure in this public fixture; the independent live-query sequence is removed by construction. No native CI or physical-device result is claimed.
Reproduction commands
In each checkout, first run pnpm install --frozen-lockfile and pnpm build. Select a dedicated simulator through $UDID and use a unique $SESSION and $AGENT_DEVICE_STATE_DIR for that build:
export UDID SESSION
export AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH="$PWD/.tmp/keyboard-ios"
export AGENT_DEVICE_STATE_DIR="$(mktemp -d)"
AGENT_DEVICE_XCUITEST_ARCHS=arm64 AGENT_DEVICE_XCUITEST_DESTINATION='generic/platform=iOS Simulator' pnpm build:xcuitest:ios
pnpm clean:daemon
xcrun simctl install "$UDID" .tmp/keyboard-ios/Build/Products/Debug-iphonesimulator/AgentDeviceRunner.app
node bin/agent-device.mjs open com.callstack.agentdevice.runner --foreground --relaunch --launch-args=--agent-device-text-entry-regression --launch-args=--agent-device-text-entry-soft-keyboard --session "$SESSION" --platform ios --udid "$UDID" --json
node bin/agent-device.mjs press 'id="agent-device-hardware-keyboard-input"' --session "$SESSION" --platform ios --udid "$UDID" --json
node --experimental-strip-types capture-tree.mjs
The snapshot probe uses the built SDK with the existing-daemon transport and existing forced-backend conformance helper. This deliberately exercises the changed XCTest tree route; ordinary simulator CLI snapshots can use the independent AX bridge instead. capture-tree.mjs:
import assert from 'node:assert/strict';
import { pathToFileURL } from 'node:url';
const root = process.cwd();
const load = (path) => import(pathToFileURL(`${root}/${path}`).href);
const { createAgentDeviceClient } = await load('dist/src/index.js');
const { readDaemonInfo } = await load('src/daemon-client/daemon-client-metadata.ts');
const { sendRequest } = await load('src/daemon-client/daemon-client-transport.ts');
const { resolveDaemonPaths } = await load('packages/daemon-contracts/src/daemon-resolution.ts');
const { createSnapshotBackendConformanceTransport } = await load('test/integration/ios-simulator-e2e/snapshot-backend-conformance.ts');
const { AGENT_DEVICE_STATE_DIR: stateDir, SESSION: session, UDID: udid } = process.env;
const paths = resolveDaemonPaths(stateDir, { env: process.env, cwd: root });
const info = readDaemonInfo(paths.infoPath);
assert.ok(info, 'CLI daemon must already be ready');
const transport = (request, context) => sendRequest(
info, { ...request, session: request.session, token: info.token }, 'auto', paths, 90000,
{ host: { env: process.env, cwd: root }, signal: context?.signal, timeoutRecovery: 'none' }
);
const client = createAgentDeviceClient(
{ session, stateDir, daemonLifecycle: 'attach' },
{ transport: createSnapshotBackendConformanceTransport('tree', transport) }
);
const snapshot = await client.capture.snapshot({ platform: 'ios', udid, raw: true });
const assistant = snapshot.nodes.find((n) => n.identifier === 'SystemInputAssistantView').rect;
const band = snapshot.keyboard.frame;
console.log(JSON.stringify({ backend: snapshot.snapshotQuality.backend, keyboard: snapshot.keyboard, assistant }));
assert.equal(snapshot.snapshotQuality.backend, 'tree');
assert.ok(band.y <= assistant.y && band.y + band.height >= assistant.y + assistant.height);
For landscape, use node bin/agent-device.mjs orientation landscape-right --session "$SESSION" --platform ios --udid "$UDID" --json, reopen/focus the same fixture, and repeat the probe. Finish with node bin/agent-device.mjs close --session "$SESSION" --platform ios --udid "$UDID" --json and node bin/agent-device.mjs daemon stop --clean --state-dir "$AGENT_DEVICE_STATE_DIR".
- 主要语言
- TypeScript
- 星标
- 5.1k
- 派生
- 339
- 平均合并
- 12 小时 50 分钟
- 30 天内合并 PR
- 632
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/agent-device 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
callstack/agent-device#3945 ·
维护者通常 1 天内回复
-
Limrun iOS fill reports success but drops non-ASCII text可能已有人在做 @mvanhorn 于 5 天前认领。 未关闭bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 87/100
callstack/agent-device#3819 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
callstack/agent-device#1869 ·
维护者通常 1 天内回复
-
iOS fill can report TEXT_ENTRY_MISMATCH before the confirmation deadline可能已有人在做 @shamilovtim 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
callstack/agent-device#3952 ·
维护者通常 1 天内回复
-
Conformance Differential (iOS): nightly job red on main since 10-17可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug ready-for-agent
难度 4/5 3-5 天 新手友好度 35/100
callstack/agent-device#3944 ·
维护者通常 1 天内回复
查看 callstack/agent-device 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
Merit-Systems/x402scan#1312 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Native Web
难度 1/5 1 小时以内 新手友好度 80/100
digitalfabrik/integreat-app#4517 ·
维护者通常 2 天内回复
-
TLS guide repeats certs/ in the certificate directory可能已有人在做 @maheshrijal 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
prometheus/docs#3156 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
medusajs/dtc-starter#90 ·
维护者通常 1 天内回复