role= selector vocabulary diverges from snapshot kind
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- testing
调研方向
Read packages/kernel/src/snapshot.ts and the selector paths in packages/selectors/src/internal/match.ts and find.ts first. Decide the compatibility approach before changing behavior; if a cutover is chosen, update the selectors, the snapshot and client API documentation, and affected recorded-selector fixtures. Done means the rollout decision is documented and role= behavior and vocabulary are consistent with kind.
由索引模型根据 Issue 内容生成。
描述
Context
#2656 added kind: string to structured snapshot nodes — the presenter's platform-neutral role vocabulary (button, text-field, text, switch, ...), computed by formatRole in packages/kernel/src/snapshot.ts and shared by every backend/projection.
Adversarial review of #2656 found that role= selector matching does not use that same vocabulary today, so the two completion conditions below cannot be satisfied without a separate, behavior-changing migration:
packages/selectors/src/internal/match.ts(roleselector term) andpackages/selectors/src/internal/find.ts(find role=...locator) each normalizenode.typeby strippingXCUIElementType/leaf-segment prefixes and lowercasing — producing raw leaf class names (statictext,edittext,textfield) rather thanformatRole's coarse vocabulary (text,text-field).packages/provider-webdriver/src/webdriver-source.ts(roleFromWebDriverType) independently falls back to a similarly-stripped type name when WebDriver'sclassattribute is absent, to populate the (iOS AX-derived)rolefield — a different field thankind, but the same kind of ad hoc normalization.packages/contracts/src/snapshot-text.ts(normalizeType) strips the same prefixes for a different purpose (fillable-type/keyboard-occlusion detection), so it is a distinct concern from role classification but shares the pattern.
Why this is its own issue, not folded into #2656
role= selector matching is a released, public selector feature (shipped before 0.21.x). Switching it to formatRole's vocabulary would change matching results for existing selectors and recorded scripts (e.g. role=statictext and role=edittext would stop matching; role=text/role=text-field would start). That is a breaking change to a versioned surface and needs an explicit compatibility/rollout decision (hard fail vs. an aliasing period), which is out of scope for a PR whose job is adding the kind field.
Proposed work
- Decide whether
role=(both the main selector term and thefindlocator) should match againstformatRole(node.type)instead of raw leaf-class normalization, and whether that is a hard cutover or needs a deprecation window. - If cutover: update
packages/selectors/src/internal/match.tsandpackages/selectors/src/internal/find.tsto import and useformatRolefrom@agent-device/kernel/snapshot, delete the now-redundantnormalizeRoleinfind.ts, updatewebsite/docs/docs/snapshots.mdandwebsite/docs/docs/client-api.mdto state role= shares kind's vocabulary, and sweep recorded-selector/doc fixtures that assume the old raw vocabulary. - Leave
packages/contracts/src/snapshot-text.ts#normalizeType(fillable/occlusion detection) andpackages/provider-webdriver/src/webdriver-source.ts#roleFromWebDriverType(the iOSrolefield fallback) alone unless the decision above says otherwise — they serve different fields/purposes thankind.
References
- #2656
- 主要语言
- TypeScript
- 星标
- 4.8k
- 派生
- 315
- 平均合并
- 11 小时 27 分钟
- 30 天内合并 PR
- 556
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/agent-device 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 82/100
callstack/agent-device#3062 ·
维护者通常 1 天内回复
-
ready-for-agent
难度 2/5 1-3 小时 新手友好度 84/100
callstack/agent-device#2995 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
callstack/agent-device#1869 ·
维护者通常 1 天内回复
-
needs-triage
难度 4/5 3-5 天 新手友好度 38/100
callstack/agent-device#3077 ·
维护者通常 1 天内回复
-
needs-triage
难度 4/5 3-5 天 新手友好度 68/100
callstack/agent-device#3076 ·
维护者通常 1 天内回复
查看 callstack/agent-device 的全部 Issue
相似的 Issue
-
bug via-triage
难度 2/5 1-3 小时 新手友好度 78/100
pingdotgg/t3code#14452 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
solana-foundation/program-examples#747 · 1 条评论 ·
维护者通常 9 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
remotion-dev/remotion#11847 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
openwatersio/slackwater#355 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
melgarafael/DeskcommCRM#1998 · 3 条评论 ·
维护者通常 1 天内回复