Skip to content

Commit d0de2f7

Browse files
committed
refactor: drop find's dead candidate binding
The selector branch bound the row's candidate set and never read it: only the acting classification needs that tree, and find's locator branch brings its own matcher. Names what actually governs the locator target — the shared node stages below, not a candidate set it never had.
1 parent 920edc8 commit d0de2f7

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

‎src/core/selector-pipeline.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import type {
2727
* cannot pair one row's candidate set with another row's ambiguity contract:
2828
* the row enters once, at the top.
2929
*
30-
* That containment is the point. While callers composed the stages by hand, a
31-
* read route could declare `promotion: 'none'` and be believed without
32-
* executing anything — the cell was true of the table and unfalsifiable in
33-
* production. Flipping any cell now changes what `get`, `is`, `wait`, `find`,
34-
* `click`, and `fill` do, because those routes run the row rather than
35-
* re-deriving it. `scripts/layering/selector-pipeline-ownership.ts` keeps the
36-
* raw engine unreachable from anywhere else.
30+
* That containment is what makes a cell falsifiable. A route that composes the
31+
* stages itself can declare `promotion: 'none'` and be believed without
32+
* executing anything, which is true of the table and unprovable in production;
33+
* because every route runs its row here instead of re-deriving it, flipping any
34+
* cell changes what `get`, `is`, `wait`, `find`, `click`, and `fill` do.
35+
* `scripts/layering/selector-pipeline-ownership.ts` keeps the raw engine
36+
* unreachable from anywhere else, so that stays true.
3737
*
3838
* Three entries, because the rows genuinely ask two different questions of the
3939
* engine and one route family never asks it at all:

‎src/daemon/handlers/find.ts‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,18 @@ function resolveFindMatch(params: {
281281
// own recovery advice ("use a selector") pointed agents at.
282282
const policy = pipeline.resolution;
283283
let matches: SnapshotState['nodes'];
284-
let searchableNodes: SnapshotState['nodes'];
285284
if (selectorExpression) {
286285
// The `reject-candidates` door: the row's candidacy stage runs inside, and
287286
// the whole candidate set comes back for find to rank and narrow.
288-
const listed = listSelectorPipelineMatches(pipeline, rooted, selectorExpression, { platform });
289-
searchableNodes = listed.candidates;
290-
matches = listed.list?.matchedNodes ?? [];
287+
matches =
288+
listSelectorPipelineMatches(pipeline, rooted, selectorExpression, { platform }).list
289+
?.matchedNodes ?? [];
291290
} else {
292-
// The locator branch matches by fuzzy text scoring rather than by selector
293-
// chains, so it produces its candidate set with its own matcher — under the
294-
// same row, whose rect requirement it reads — and joins the contract below.
295-
searchableNodes = rooted;
296-
matches = findBestMatchesByLocator(searchableNodes, locator, query, {
291+
// Fuzzy text scoring, not a selector chain: this branch brings its own
292+
// matcher and reads the row's rect requirement. The row still governs the
293+
// target it produces — occlusion and promotion run on it below, in the
294+
// same node stages the selector branch reaches.
295+
matches = findBestMatchesByLocator(rooted, locator, query, {
297296
requireRect: policy.requireRect,
298297
}).matches;
299298
}

0 commit comments

Comments
 (0)