Repository navigation
improve(ios): run simulator tests with pnpm ios:test - #194298
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds pnpm ios:test to run simulator tests, summarize failures, and reject selectors that match nothing. Example: Run GatewayStatusBuilderTests alongside NoSuchSuiteTests.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides useful simulator test tooling with credible CLI evidence and no identified blocking defect; exact-head CI is still pending. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe repository command prepares the iOS project, selects a simulator, invokes xcodebuild, and converts xcresult output into test counts, diagnostics, and an exit status. flowchart LR
A[pnpm ios:test] --> B[Existing project preparation]
B --> C[Simulator selection]
C --> D[xcodebuild test]
D --> E[Log and xcresult artifacts]
E --> F[Summary and selector verification]
Technical reviewBest possible solution: Keep the focused command and shared parser extension, then complete the existing CI gates. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the new entry point and selector checks, and the supplied real simulator trace demonstrates the intended failure; no target code was executed during this review. Is this the best way to solve the issue? The change is appropriately scoped: it reuses project generation, the existing simulator setting, and the xcresult module without replacing the stricter screenshot verifier. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38f68a10828d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceDocs +9, Config +1, Other +177. Total +187 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 6, 2026, 4:11 PM ET / 21:11 UTC (Revision 4). |
Runs the OpenClaw scheme, or named suites, with CI xcodebuild flags. Prints failures and counts from the xcresult, shows compiler errors when the build fails, and fails when a selector matches no test (xcodebuild silently ignores those).
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 63f0570. |
## What Problem This Solves Running iOS app tests from a terminal needs a long, hand-built `xcodebuild` command, and a mistyped suite name in `-only-testing` silently runs nothing and still exits 0. ## User Impact No app change. Developers and agents get one command, `pnpm ios:test`, that runs the iOS app tests on a simulator with the same flags as CI and reports a short, trustworthy result. ## Why This Change Was Made - `pnpm ios:test` runs the `OpenClaw` scheme (`OpenClawTests` and `OpenClawLogicTests`). `pnpm ios:test TalkModeManagerTests` or `Target/Suite[/test]` selectors run fewer; `OpenClawUITests` selectors use their own scheme. `IOS_SIM` picks a simulator by name or UDID; otherwise a booted iPhone, then the first available one. - It runs the same project preparation as `ios:gen`, then `xcodebuild test` with CI's flags (`-parallel-testing-enabled NO`, `-collect-test-diagnostics never`) and the `apps/ios/build/DerivedData` path `ios:run` already uses. Output goes to a log file, as in CI, so simulator log forwarding cannot stall timed tests. - It prints each failure (test ID and the first lines of the message), the pass/fail/skip counts, and the log and `.xcresult` paths in `apps/ios/build/TestResults`. When the build fails, it prints the compiler errors instead of "0 tests". - `xcodebuild` ignores `-only-testing` selectors that match no test. `findUnmatchedSelectors` in `scripts/lib/ios-test-results.mjs` (the existing xcresult parser) compares the selectors with the result tree, and `ios:test` fails when a selector ran nothing. It matches on node URLs, so Swift Testing suites with display names still match their type name. - `apps/ios/README.md` documents the command. ## Evidence - `pnpm ios:test` (whole `OpenClaw` scheme) on an iPhone 17 simulator: 3m19s, 1343 passed, 3 skipped, 2 failed. Both failures are existing source-text tests that are red on `main` and not in any CI list (`RootTabsSidebarRegressionTests` "sidebar has one agent selector…", `WatchApprovalTransportSourceGuardTests` "retry reset matches the exact active attempt"); this PR does not touch them. - Misspelled suite plus real selectors (a Swift Testing suite, a Logic target suite, an XCTest test method): the real ones ran (21 passed), then `no tests ran for OpenClawTests/NoSuchSuiteTests` and exit 1. The same plain `xcodebuild` command exits 0. - A throwaway failing test printed its full test ID (`OpenClawTests/ZZThrowawayTests/…`) and expectation text, exit 1. A throwaway compile error printed the compiler error line and `xcodebuild exited 65 before running tests`, exit 1. - `pnpm ios:test OpenClawUITests/ShareExtensionUITests`: passed through the `OpenClawUITests` scheme. - `pnpm tsgo:scripts` (red with TS2345 before the selector-target fix, green after), `tsconfig.test.root.scripts.json`, oxlint, oxfmt, `check:script-erasability` and the existing `test/scripts/ios-test-results.test.ts` (20 passed) are clean. - No new Vitest test: `main` is 49 lines over the test-line ceiling, and the ratchet fails any PR with positive test-line growth while that debt stands (allocations do not forgive it). The unmatched-selector behavior is proven by the real `ios:test` runs above and below; `pnpm check:test-lines-ratchet` reports net delta 0. - Rebased onto `main` to pick up openclaw#194283 (the first CI run merged with a `main` that failed `tsgo:extensions` in `extensions/deep-research`). Smoke on the rebased head: <details> <summary>pnpm ios:test GatewayStatusBuilderTests NoSuchSuiteTests OpenClawLogicTests/WatchChatStatusLocalizationTests</summary> ```text ios:test: OpenClawTests/GatewayStatusBuilderTests OpenClawTests/NoSuchSuiteTests OpenClawLogicTests/WatchChatStatusLocalizationTests on iPhone 17 (<simulator-udid>) ios:test: log apps/ios/build/TestResults/2026-11-06T20-29-54-025Z.log ios:test: Passed: 20 passed, 0 failed, 0 skipped ios:test: results apps/ios/build/TestResults/2026-11-06T20-29-54-025Z.xcresult ios:test: no tests ran for OpenClawTests/NoSuchSuiteTests; check the target, suite and test names. [ELIFECYCLE] Command failed with exit code 1. ``` </details> - Review: hosted ClawSweeper on this PR. Merge danger: two-way door. Developer tooling only; no app, CI workflow, state or config changes. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Running iOS app tests from a terminal needs a long, hand-built
xcodebuildcommand, and a mistyped suite name in-only-testingsilently runs nothing and still exits 0.User Impact
No app change. Developers and agents get one command,
pnpm ios:test, that runs the iOS app tests on a simulator with the same flags as CI and reports a short, trustworthy result.Why This Change Was Made
pnpm ios:testruns theOpenClawscheme (OpenClawTestsandOpenClawLogicTests).pnpm ios:test TalkModeManagerTestsorTarget/Suite[/test]selectors run fewer;OpenClawUITestsselectors use their own scheme.IOS_SIMpicks a simulator by name or UDID; otherwise a booted iPhone, then the first available one.ios:gen, thenxcodebuild testwith CI's flags (-parallel-testing-enabled NO,-collect-test-diagnostics never) and theapps/ios/build/DerivedDatapathios:runalready uses. Output goes to a log file, as in CI, so simulator log forwarding cannot stall timed tests..xcresultpaths inapps/ios/build/TestResults. When the build fails, it prints the compiler errors instead of "0 tests".xcodebuildignores-only-testingselectors that match no test.findUnmatchedSelectorsinscripts/lib/ios-test-results.mjs(the existing xcresult parser) compares the selectors with the result tree, andios:testfails when a selector ran nothing. It matches on node URLs, so Swift Testing suites with display names still match their type name.apps/ios/README.mddocuments the command.Evidence
pnpm ios:test(wholeOpenClawscheme) on an iPhone 17 simulator: 3m19s, 1343 passed, 3 skipped, 2 failed. Both failures are existing source-text tests that are red onmainand not in any CI list (RootTabsSidebarRegressionTests"sidebar has one agent selector…",WatchApprovalTransportSourceGuardTests"retry reset matches the exact active attempt"); this PR does not touch them.no tests ran for OpenClawTests/NoSuchSuiteTestsand exit 1. The same plainxcodebuildcommand exits 0.OpenClawTests/ZZThrowawayTests/…) and expectation text, exit 1. A throwaway compile error printed the compiler error line andxcodebuild exited 65 before running tests, exit 1.pnpm ios:test OpenClawUITests/ShareExtensionUITests: passed through theOpenClawUITestsscheme.pnpm tsgo:scripts(red with TS2345 before the selector-target fix, green after),tsconfig.test.root.scripts.json, oxlint, oxfmt,check:script-erasabilityand the existingtest/scripts/ios-test-results.test.ts(20 passed) are clean.mainis 49 lines over the test-line ceiling, and the ratchet fails any PR with positive test-line growth while that debt stands (allocations do not forgive it). The unmatched-selector behavior is proven by the realios:testruns above and below;pnpm check:test-lines-ratchetreports net delta 0.mainto pick up fix(research): restore the native pane browser client #194283 (the first CI run merged with amainthat failedtsgo:extensionsinextensions/deep-research). Smoke on the rebased head:pnpm ios:test GatewayStatusBuilderTests NoSuchSuiteTests OpenClawLogicTests/WatchChatStatusLocalizationTests
Merge danger: two-way door. Developer tooling only; no app, CI workflow, state or config changes.