perf(scroll-until): answer every candidate from one visibility index - #2596
Conversation
`evaluateIsPredicate` derived its visibility index from the `nodes` it was given, so `scroll --until` rebuilt the node map and viewport-rect scan once per candidate a selector matched. It now takes the capture's `SnapshotVisibility` and has no tree of its own, which is the #1970 rule that N candidates share one whole-tree pass: the caller that owns the capture owns the index. The `--until` pass builds that index only once a candidate exists, so a pass whose selector matches nothing indexes nothing. The pipeline still holds its own index while ranking ambiguous matches; sharing that one means widening `SelectorPipelineOutcome`, which is the capture-kit move and not this.
Size Report
Startup median (7 runs, lower is better):
|
…s on `visibility` is not "the array `node` came from": `findSnapshotAncestor` resolves `parentIndex` positionally, so what the predicate needs is the index of the tree `node` belongs to, in the same `index`/`parentIndex` space. Its doc says that now. `createSnapshotVisibility` materializes nothing until consulted, so the no-match early return guarded a cost that does not exist; it is gone. The probe test claims only what a probe can see — the caller's index is the one consulted — keeps `snapshot-visibility.test.ts`'s counter names instead of a parallel vocabulary, and drops the fallback counter this fixture cannot move. The twin test's docstring says what its counts prove.
|
The shared index gives the same verdicts at 3dbf9dc. The tests do not lock in the change, though. If The failing Smoke Tests job is likely unrelated. The failure is the native runner test |
Verdicts cannot tell one index from one per candidate, so the shape #2528 changed was unproven: moving `createSnapshotVisibility` back inside the candidate loop leaves every earlier test green. A pass now counts the indexes built through the contracts facade and expects one for a selector that matched two rows — two when the build moves back inside the loop.
|
Pushed
Thanks for the alert-runner triage: agrees with the log.
|
|
The counting test at bd319ae locks in the change. It wraps the same |
|
…tle-on-exit-2522 * origin/main: perf(scroll-until): answer every candidate from one visibility index (#2596) refactor(daemon): resolve device interactors through a composed capability (#2593) refactor(daemon): stop the client value-importing daemon internals (#2559) (#2594) refactor(shell-quote): one implementation, reached through the runner host port (#2595) docs(agents): delete the file-size tiers nobody enforces (#2597) fix(daemon): key the implicit session by workspace and platform (#2587) refactor(cli-schema): orient the schema layer above commands (#2543 step 3) (#2590)
Summary
evaluateIsPredicatederived its visibility index from thenodesit was handed, so onescroll --untilpass rebuilt the node map and viewport-rect scan once per candidate its selector matched. It now takes the capture'sSnapshotVisibilityand holds no tree of its own: the caller that owns the capture owns the index, which is #1970's rule that N candidates share one whole-tree pass. The--untilpass builds one index and asks every candidate of the selector against it.No behavior change for
is <predicate> <selector>orscroll <dir> --until <selector>.@agent-device/selectorsis private, so no CLI, MCP, help or wire surface moves. 6 files.Closes #2528, correcting its premise: the
waitrow isfirst-match, so it resolves through the existence-only scan and never builds the index the issue pointed at. Nothing was left to thread on this path;is(readUnique) is where two indexes meet.Validation
pnpm check:affected --runpasses atbd319ae7: format, lint, typecheck, layering,check:fallow --base origin/main, build, and 568 related test files / 4129 tests including provider integration. The first run failed only inandroid-lifecycle.test.tsframe-action correlation; that file passes alone and on the rerun, at load average 40+ on 12 cores.Evidence: the probe test failed on unmodified
predicates.ts(TypeError … reading 'map'); the two twin tests were green on unmodified code first; anda pass materializes one visibility index for the candidates it askscounts index builds through the contracts facade — 1 for a selector matching two rows, 2 and red when that build moves back inside the candidate loop.Device lanes and Coverage stay GitHub-authoritative for this diff.