Repository navigation
fix(selectors): type rect-requiring targets as addressable - #3608
Conversation
There was a problem hiding this comment.
1 issue found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/selectors/src/selector-pipeline.ts">
<violation number="1" location="packages/selectors/src/selector-pipeline.ts:242">
P2: These casts claim that `requireRect` proves addressability, but the pipeline checks only `rect`, not `ref`; a backend-issued or caller-provided node can therefore be returned as addressable and reach acting code with an undefined ref. Validate `hasSnapshotRef` whenever the policy requires addressability (including candidate lists), or require an addressable node at the acting boundary instead of asserting it.
(Based on your team's feedback about snapshot ref minting modes.) [23b875ef-7244-47fb-b775-a2b67cebe52b]</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
| _policy: TPolicy, | ||
| node: SnapshotNode, | ||
| ): SelectorPipelineNodeForPolicy<TPolicy> { | ||
| return node as SelectorPipelineNodeForPolicy<TPolicy>; |
There was a problem hiding this comment.
P2: These casts claim that requireRect proves addressability, but the pipeline checks only rect, not ref; a backend-issued or caller-provided node can therefore be returned as addressable and reach acting code with an undefined ref. Validate hasSnapshotRef whenever the policy requires addressability (including candidate lists), or require an addressable node at the acting boundary instead of asserting it.
(Based on your team's feedback about snapshot ref minting modes.) [23b875ef-7244-47fb-b775-a2b67cebe52b]
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/selectors/src/selector-pipeline.ts, line 242:
<comment>These casts claim that `requireRect` proves addressability, but the pipeline checks only `rect`, not `ref`; a backend-issued or caller-provided node can therefore be returned as addressable and reach acting code with an undefined ref. Validate `hasSnapshotRef` whenever the policy requires addressability (including candidate lists), or require an addressable node at the acting boundary instead of asserting it.
(Based on your team's feedback about snapshot ref minting modes.) [23b875ef-7244-47fb-b775-a2b67cebe52b]</comment>
<file context>
@@ -187,42 +193,60 @@ async function stageResolvedRow(
+ _policy: TPolicy,
+ node: SnapshotNode,
+): SelectorPipelineNodeForPolicy<TPolicy> {
+ return node as SelectorPipelineNodeForPolicy<TPolicy>;
+}
+
</file context>
|
The code in 0c4d1f6 looks good to me, and all 14 checks pass. There are no conflicts. I read the diff only and did not run tsc -b or the tests. I also did not trace whether resolveActionableTouchResolution or classifyActionableTouchCandidates can return a ref-less node on any backend. I relied on the producer-fact JSDoc. Before this is ready, one design question. pipelineNodeForPolicy is exported from the selectors pipeline and called from Could one checked narrowing inside selectors do this at the same size, for example |
0c4d1f6 to
51514af
Compare
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/selectors/src/selector-pipeline.ts">
<violation number="1" location="packages/selectors/src/selector-pipeline.ts:265">
P2: Passing the filtered candidates as the classifier's tree drops ref-less structural ancestors, so its parent-index walk can reject an otherwise collapsible acting match as ambiguous. Preserve the full tree for ancestry/indexing and apply the ref filter only to selector candidates.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| }; | ||
| } | ||
|
|
||
| const classification = classifyActionableTouchCandidates(candidates, matched); |
There was a problem hiding this comment.
P2: Passing the filtered candidates as the classifier's tree drops ref-less structural ancestors, so its parent-index walk can reject an otherwise collapsible acting match as ambiguous. Preserve the full tree for ancestry/indexing and apply the ref filter only to selector candidates.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/selectors/src/selector-pipeline.ts, line 265:
<comment>Passing the filtered candidates as the classifier's tree drops ref-less structural ancestors, so its parent-index walk can reject an otherwise collapsible acting match as ambiguous. Preserve the full tree for ancestry/indexing and apply the ref filter only to selector candidates.</comment>
<file context>
@@ -215,6 +233,57 @@ export function listSelectorPipelineMatches<const TPolicy extends CandidateSetPi
+ };
+ }
+
+ const classification = classifyActionableTouchCandidates(candidates, matched);
+ if (classification.kind === 'ambiguous') {
+ return { kind: 'ambiguous', selector: list.selector, candidates: classification.candidates };
</file context>
51514af to
f7a36b4
Compare
|
This PR is ready. The earlier simplicity question is answered, and the cast is now checked in Not blocking: you can take or leave these. First, On evidence: I read the code but did not run Of the open inline threads, the two from cubic-dev-ai no longer apply at this head, so you can resolve them. The first is #3608 (comment): the cast is now checked in Once Smoke Tests turns green, this can merge. |
* origin/main: feat(leasing): proxy CLI names each new lease, daemon keeps a caller-chosen lease id (#3479) feat(remote): name the held lease on upload, artifact download and diagnostics requests (#3594) fix(android): record the launched intent owner from the device (#3600) fix(selectors): type rect-requiring targets as addressable (#3608) feat(snapshot): interpret iOS node facts once at producer seams (#3592) refactor(gates): own the client-only replay rule as daemon-process reachability (R82) (#3604)
* origin/main: feat(remote): name the held lease on upload, artifact download and diagnostics requests (#3594) fix(android): record the launched intent owner from the device (#3600) fix(selectors): type rect-requiring targets as addressable (#3608) feat(snapshot): interpret iOS node facts once at producer seams (#3592) refactor(gates): own the client-only replay rule as daemon-process reachability (R82) (#3604)
* origin/main: feat(remote): name the held lease on upload, artifact download and diagnostics requests (#3594) fix(android): record the launched intent owner from the device (#3600) fix(selectors): type rect-requiring targets as addressable (#3608) feat(snapshot): interpret iOS node facts once at producer seams (#3592) refactor(gates): own the client-only replay rule as daemon-process reachability (R82) (#3604)
What
Fixes #3576. Rect-requiring selector resolutions were still typed as plain
SnapshotNode, so acting paths had to rely on runtime ref guarantees that TypeScript could not see.Fix
Add
SnapshotAddressableNodefor nodes with refs and keep require-rect narrowing behind checked selector pipeline exits, including acting candidate collapse.Test
Adds selector-pipeline type and ref-less regression coverage for action vs read rows.