Repository navigation
refactor(daemon): query the iOS selector through the request-bound runtime #3430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thymikee
merged 3 commits into
refactor/daemon-composition-root
from
refactor/direct-ios-selector-binding
Oct 12, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
d0ca91a
refactor(daemon): query the iOS selector through the request-bound ru…
thymikee 33d15e9
refactor(apple): parse the query rect once and pin the rescue wiring …
thymikee 23384a0
chore(gates): collapse R76 to a ban on daemon-to-platform-runtime cou…
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
91 changes: 91 additions & 0 deletions
91
packages/platform-apple/src/__tests__/runtime-selector-query.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import { beforeEach, expect, test, vi } from 'vitest'; | ||
| import { IOS_SIMULATOR } from '../__tests__/device-fixtures.ts'; | ||
|
|
||
| const { queryAppleRunnerSelector } = vi.hoisted(() => ({ | ||
| queryAppleRunnerSelector: vi.fn(async (): Promise<Record<string, unknown>> => ({ | ||
| found: true, | ||
| })), | ||
| })); | ||
|
|
||
| vi.mock('../core/runner-selector-query.ts', () => ({ queryAppleRunnerSelector })); | ||
|
|
||
| import { bindAppleQuerySelectorRuntime } from '../runtime-selector-query.ts'; | ||
|
|
||
| beforeEach(() => { | ||
| queryAppleRunnerSelector.mockReset(); | ||
| queryAppleRunnerSelector.mockResolvedValue({ found: true }); | ||
| }); | ||
|
|
||
| const APP = 'com.example.app'; | ||
|
|
||
| function bind(signal?: AbortSignal) { | ||
| return bindAppleQuerySelectorRuntime({ | ||
| device: IOS_SIMULATOR, | ||
| signal: signal ?? new AbortController().signal, | ||
| }); | ||
| } | ||
|
|
||
| test('forwards the selector, app scope, and the full runner-execution projection', async () => { | ||
| await bind().querySelector({ | ||
| selector: { key: 'id', value: 'submit-order' }, | ||
| options: { appBundleId: APP }, | ||
| execution: { | ||
| requestId: 'req-9', | ||
| logPath: '/tmp/runner.log', | ||
| traceLogPath: '/tmp/trace.log', | ||
| verbose: true, | ||
| iosXctestrunFile: '/tmp/run.xctestrun', | ||
| }, | ||
| }); | ||
|
|
||
| expect(queryAppleRunnerSelector).toHaveBeenCalledWith( | ||
| IOS_SIMULATOR, | ||
| { key: 'id', value: 'submit-order' }, | ||
| APP, | ||
| expect.objectContaining({ | ||
| requestId: 'req-9', | ||
| logPath: '/tmp/runner.log', | ||
| traceLogPath: '/tmp/trace.log', | ||
| verbose: true, | ||
| iosXctestrunFile: '/tmp/run.xctestrun', | ||
| }), | ||
| ); | ||
| }); | ||
|
|
||
| test('refuses an already-aborted binding signal without querying the runner', async () => { | ||
| const controller = new AbortController(); | ||
| controller.abort(); | ||
|
|
||
| await expect( | ||
| bind(controller.signal).querySelector({ selector: { key: 'label', value: 'Go' } }), | ||
|
thymikee marked this conversation as resolved.
|
||
| ).rejects.toMatchObject({ name: 'AbortError' }); | ||
| expect(queryAppleRunnerSelector).not.toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| test('projects the matched node to its rect and hittability', async () => { | ||
| queryAppleRunnerSelector.mockResolvedValue({ | ||
| found: true, | ||
| nodes: [{ index: 0, rect: { x: 1, y: 2, width: 3, height: 4 }, hittable: true }], | ||
| }); | ||
|
|
||
| await expect(bind().querySelector({ selector: { key: 'label', value: 'Go' } })).resolves.toEqual({ | ||
| found: true, | ||
| node: { rect: { x: 1, y: 2, width: 3, height: 4 }, hittable: true }, | ||
| }); | ||
| }); | ||
|
|
||
| test('a miss answers found:false with no node', async () => { | ||
| queryAppleRunnerSelector.mockResolvedValue({ found: false, nodes: [] }); | ||
|
|
||
| await expect( | ||
| bind().querySelector({ selector: { key: 'label', value: 'Gone' } }), | ||
| ).resolves.toEqual({ found: false }); | ||
| }); | ||
|
|
||
| test('a node without a usable rect answers found without a node (the rescue stays fail-closed)', async () => { | ||
| queryAppleRunnerSelector.mockResolvedValue({ found: true, nodes: [{ index: 0 }] }); | ||
|
|
||
| await expect(bind().querySelector({ selector: { key: 'label', value: 'Go' } })).resolves.toEqual({ | ||
| found: true, | ||
| }); | ||
| }); | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.