Type the rect-requiring resolution rows as ref-bearing instead of proving it by comment
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 22/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- devtools
调研方向
Start with the producer-fact paragraph in packages/kernel/src/snapshot.ts (the JSDoc on SnapshotNode.ref), then the pipeline entry in packages/selectors that resolves targets. Add a narrowing entry keyed on resolution.requireRect, and move the four ref-printing sites in find.ts (lines 200 and 426), target-visibility-stages.ts, resolution-disclosure.ts, selector-action-resolution.ts:43 and selector-pipeline.ts:245 onto it. Done means tsc -b (repo and examples/sdk) and pnpm check:affected pass with no new ?? '' coercions and no output changes.
由索引模型根据 Issue 内容生成。
描述
Purpose
SnapshotNode.ref became optional in #3547. The type still lets a pipeline row that requires a rect carry a ref-less node, and four acting-path sites print node.ref unguarded. They are safe today only because of a producer fact recorded in the field's JSDoc (packages/kernel/src/snapshot.ts, the "A ref-less node also carries no rect" paragraph): producers measure geometry only for refs they issued, so a rect-bearing node always has a ref. That invariant is currently a runtime fact, not a type fact. Make it one.
Required behavior
A resolution row whose policy declares resolution.requireRect: true is typed so its node cannot be ref-less, and the acting-path prints stop being provable-by-comment.
- Add the narrow type beside
SnapshotNode(name it for the domain, e.g. an addressable-node type =SnapshotNode & { ref: string }), and a pipeline entry point that narrows a resolved target through the row'srequireRectpolicy — one place that turns the producer fact into the type fact. - The rect-requiring consumers take the narrowed type:
src/commands/interaction/runtime/target-visibility-stages.ts,resolution-disclosure.ts, the acting rows insrc/daemon/interaction/internal/find.ts(find.ts:200,:426), andselector-action-resolution.ts:43/selector-pipeline.ts:245as the narrowing demands. - Read rows keep returning plain
SnapshotNode— a ref-less node is legitimately selectable by text and byfind/wait/get. One outcome type cannot serve both rows; that is why this needs a narrowing entry, not a field type.
Measured cost (why this was deferred)
A first attempt typed the resolver and classifier as addressable (SnapshotAddressableNode + a hasSnapshotRef guard) instead of narrowing at the pipeline entry: tsc -b produced 28 errors across 5 files (18 in packages/selectors/src/__tests__/interaction-targeting.test.ts, 7 inside interaction-targeting.ts, one each at selector-pipeline.ts:245, selector-action-resolution.ts:43, and the new test). The guards relocate inward — tree walks yield SnapshotNode[] — and the four named prints are fed by the pipeline outcome, not by the resolver, so typing the resolver does not reach them. The narrowing entry is the smaller change; expect test-fixture widening more than new logic.
Completion conditions
- The four prints listed above read a
refthe checker knows is present; no new?? ''-style coercion appears. tsc -b(repo +examples/sdk) green,pnpm check:affectedgreen.- No behavior change is possible; if a test's observable output moves, that is a bug in the narrowing, not an expected diff.
Dependencies
#3547 (optional ref, the producer-fact JSDoc) and #3515 (the router case proving a ref-less text line is selectable but never a target — the runtime side of this invariant).
- 主要语言
- TypeScript
- 星标
- 5k
- 派生
- 334
- 平均合并
- 11 小时 48 分钟
- 30 天内合并 PR
- 605
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/agent-device 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
callstack/agent-device#3407 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
callstack/agent-device#3353 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
callstack/agent-device#1869 ·
维护者通常 1 天内回复
-
iOS: fill rejects the right text as `TEXT_ENTRY_MISMATCH` when the focused field moves while typing (since 0.21.25)可能已有人在做 @Lanchez 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 42/100
callstack/agent-device#3595 ·
维护者通常 1 天内回复
-
`fold` always fails on Xcode 27.1 RC: its pose check calls `devicectl device motion hinge-angle`, which this devicectl doesn't have可能已有人在做 @thymikee 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
callstack/agent-device#3581 ·
维护者通常 1 天内回复
查看 callstack/agent-device 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
high priority
难度 2/5 1-3 小时 新手友好度 62/100
CI-CMG/deep-sea-corals-exb#84 · 1 条评论 ·
-
Create/import wallet form shows raw "password must be at least 1 characters" instead of the translated message可能已有人在做 @CapThunder19 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
joinmarket-webui/jam#1538 ·
维护者通常 1 天内回复
-
t0ggles
难度 2/5 1-3 小时 新手友好度 70/100
nolimits4web/swiper#8240 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复