refactor: add provider-first device lab tests#542
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ca1f0c2f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| inputMethodOwned: isAndroidInputMethodOwnedNode({ | ||
| packageName: node.packageName, | ||
| resourceId: node.resourceId, | ||
| }), |
There was a problem hiding this comment.
Thread active IME package into fill ownership
When a non-hard-coded keyboard package captures the text, this verification path still calls isAndroidInputMethodOwnedNode without the active input method package that getAndroidKeyboardStatusWithAdb now parses. In that scenario actualInput.inputMethodOwned remains false for packages like com.vendor.keyboard, so isAndroidImeCapture does not fire and fill retries/fails as a generic text mismatch instead of reporting the IME-capture condition this change is trying to detect.
Useful? React with 👍 / 👎.
| import { runCmdBackground } from '../utils/exec.ts'; | ||
| import { runXcrun } from '../platforms/ios/tool-provider.ts'; |
There was a problem hiding this comment.
Route iOS log streaming through the provider seam
With a request-scoped Apple tool provider, logs start and logs clear --restart for iOS/macOS sessions still hit the local host because this file keeps runCmdBackground and startAppleAppLogStream uses it directly for xcrun/log streams. In Device Lab or remote-provider contexts running off macOS, those commands bypass the scripted provider and either fail with a missing local tool or attach to the wrong host, even though other Apple tool calls in the same request are scoped.
Useful? React with 👍 / 👎.
af4a319 to
b600a3f
Compare
Summary
This PR implements the accepted Provider-First Integration Scenarios architecture from
docs/adr/0001-provider-first-integration-scenarios.md.The goal is to make
agent-deviceeasier to extend across mobile, TV, and desktop without relying on brittle handler-level mocks. We keepInteractoras the high-level semantic API, but introduce request-scoped provider seams below the platform modules so integration tests can run the real daemon request path while replacing only external device/tool boundaries.Architecture: Before
The old test and runtime shape had three problems:
xcrun, runner transport, helper tools,xdotool, clipboard, screenshots, and logs.In practice, this made the codebase harder to change safely as support grew across Android, iOS, tvOS, macOS, and Linux.
Architecture: After
This PR moves the system toward one coherent integration suite under
test/integration:test/integration/provider-scenarios. They are integration tests, not a separate test layer. The subfolder only names the implementation style: real daemon request path, scripted provider boundaries, no real devices.pnpm test:integration:progresstracks command coverage, flag coverage, mock-heavy unit-test pressure, and generic provider usage.test/integration/*.test.tskeeps process/package/CLI smoke boundaries.test/integration/provider-scenariosowns broader daemon-path scenarios and detailed provider/transport contracts. Pure logic, such as retry behavior, stays in unit tests.Benefits
Trade-offs Accepted
82.08%statements /84.20%lines, with provider-backed integration progress tracked separately.mdfind,plutil,otool, sync helpers, and similar low-pressure calls as local until a remote adapter proves the need for semantic promotion.Review Notes
AppLogProvider; localrunCmdBackgroundis only the local provider implementation.smoke-daemon-http.test.tsas a single real-process HTTP smoke. Detailed HTTP method/auth/upload/lease behavior lives inprovider-scenarios/daemon-http-server.test.ts, and pure retry coverage moved from integration tosrc/utils/__tests__/retry.test.ts.Validation
pnpm formatpnpm check:quickpnpm check:unitpnpm buildpnpm test:integrationpnpm test:integration:providerpnpm test:integration:nodepnpm test:coveragepnpm check:fallow --base origin/mainpnpm test:integration:progressCurrent provider-backed integration progress:
43/4355/55460