You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rebased onto latest main after selector capture policy landed there. This PR now extracts daemon selector runtime backend construction into src/daemon/selector-runtime-backend.ts while leaving dispatch, direct iOS selector fast paths, response shaping, and recording/result handling in selector-runtime.ts.
Scope checks: PR diff is only src/daemon/selector-runtime.ts and src/daemon/selector-runtime-backend.ts; no src/commands/interaction/runtime/* changes; no src/compat/maestro/* changes; Maestro target/ranking/visibility logic untouched. The latest main src/daemon/selector-capture-runtime.ts is preserved and reused by the backend.
Validation
Focused guard suite passed: ./node_modules/.bin/vitest run src/daemon/handlers/tests/find.test.ts src/daemon/handlers/tests/snapshot-handler.test.ts src/daemon/handlers/tests/snapshot-scoped-refs.test.ts src/daemon/handlers/tests/interaction.test.ts src/compat/maestro/tests/runtime-interactions.test.ts src/compat/maestro/tests/runtime-targets.test.ts (6 files, 167 tests).
Fallow passed locally after rebasing: ./node_modules/.bin/fallow audit --base origin/main.
The PR diff includes .worktreeinclude, which is unrelated to the daemon selector capture extraction. Please remove it from the branch so the PR scope is limited to the selector runtime extraction files.
CI is failing Fallow Code Quality. The job reports src/daemon/selector-capture-runtime.ts:190 findText HIGH with cyclomatic 16 / CRAP 71.3. Please split findText into smaller private helpers while preserving the current ordering and behavior: macOS non-app surface snapshot lookup, Apple runner findText, then snapshot fallback.
The extraction direction is good, but these are scope/quality blockers.
CI is blocked on Fallow Code Quality. The failing finding is src/daemon/selector-capture-runtime.ts:190 findText HIGH with cyclomatic 16 / CRAP 71.3.
The rest of the checks are green. Please address the Fallow finding before re-review; I am holding off on reviewer scheduling while the required check is red.
Heads-up on overlap with #857: both PRs add a new file at the same pathsrc/daemon/selector-capture-runtime.ts but with different contents and exports — this PR exports createSelectorRuntimeForDevice / createSelectorRuntime / SelectorRuntimeParams (a wholesale move of the runtime+backend), while #857 exports createSelectorCaptureRuntime (a shared capture/cache policy). Both branch independently off main, so whichever lands second hits an add/add conflict on the new file plus overlapping edits in selector-runtime.ts. They're also different end-states: this PR is a low-risk structural extraction that leaves the cache/recovery/session-write logic duplicated between find.ts and the selector backend; #857 unifies that policy and shares it with find.ts (removes the duplication) at the cost of touching behavior-sensitive code. Recommend deciding direction before merging either — e.g. land this mechanical extraction first, then redo #857's unification on top (it'd shrink), or pick #857 for the dedup and close this.
Review notes on this PR in isolation:
The findText decomposition (2nd commit) is behavior-preserving: branch precedence (macos-non-app → Apple runner → wait-snapshot) is intact, and the !== null sentinel correctly distinguishes "branch handled, returned false" from "branch not applicable".
The rest is a verbatim move; caching/session-write semantics unchanged. No circular import (new file doesn't import selector-runtime.ts); all re-imports are used.
Minor: the filename says "capture-runtime" but the module now owns the whole selector runtime (backend incl. findText/readText), not just snapshot capture — consider selector-runtime-backend or similar.
Preview removed because the pull request was closed.
2026-06-24 15:54 UTC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased onto latest main after selector capture policy landed there. This PR now extracts daemon selector runtime backend construction into src/daemon/selector-runtime-backend.ts while leaving dispatch, direct iOS selector fast paths, response shaping, and recording/result handling in selector-runtime.ts.
Before/after LOC: selector-runtime.ts 788 -> 536; selector-runtime-backend.ts 0 -> 252. Files touched: 2.
Scope checks: PR diff is only src/daemon/selector-runtime.ts and src/daemon/selector-runtime-backend.ts; no src/commands/interaction/runtime/* changes; no src/compat/maestro/* changes; Maestro target/ranking/visibility logic untouched. The latest main src/daemon/selector-capture-runtime.ts is preserved and reused by the backend.
Validation
Focused guard suite passed: ./node_modules/.bin/vitest run src/daemon/handlers/tests/find.test.ts src/daemon/handlers/tests/snapshot-handler.test.ts src/daemon/handlers/tests/snapshot-scoped-refs.test.ts src/daemon/handlers/tests/interaction.test.ts src/compat/maestro/tests/runtime-interactions.test.ts src/compat/maestro/tests/runtime-targets.test.ts (6 files, 167 tests).
Fallow passed locally after rebasing: ./node_modules/.bin/fallow audit --base origin/main.
Static checks passed directly: ./node_modules/.bin/oxlint . --deny-warnings and ./node_modules/.bin/tsc -p tsconfig.json.
Format passed via the repo formatter binary: ./node_modules/.bin/oxfmt --write src/daemon/selector-runtime.ts src/daemon/selector-runtime-backend.ts.