Skip to content

improve(ios): run simulator tests with pnpm ios:test - #194298

Merged
obviyus merged 3 commits into
mainfrom
ios-test-cli
Nov 6, 2026
Merged

obviyus merged 3 commits into
mainfrom
ios-test-cli

Conversation

@obviyus

@obviyus obviyus commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

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 fix(research): restore the native pane browser client #194283 (the first CI run merged with a main that failed tsgo:extensions in extensions/deep-research). Smoke on the rebased head:
pnpm ios:test GatewayStatusBuilderTests NoSuchSuiteTests OpenClawLogicTests/WatchChatStatusLocalizationTests
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.
  • Review: hosted ClawSweeper on this PR.

Merge danger: two-way door. Developer tooling only; no app, CI workflow, state or config changes.

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios scripts Repository scripts size: M labels Nov 6, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds pnpm ios:test to run simulator tests, summarize failures, and reject selectors that match nothing.

Example: Run GatewayStatusBuilderTests alongside NoSuchSuiteTests.

  • Before: Plain xcodebuild can run the valid suite and exit successfully while ignoring the misspelled selector.
  • After: The valid tests run, then ios:test identifies OpenClawTests/NoSuchSuiteTests and exits 1.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful tooling with real CLI evidence and no identified actionable defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied pnpm ios:test simulator output exercises real project preparation, xcodebuild, xcresult parsing, and unmatched-selector rejection; recorded additional runs cover UI selection and failure diagnostics, and the latest revision changes no production code.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Developers must assemble simulator test commands and can mistake an ignored selector for successful coverage.
Reason: The maintainer-authored direction adds a practical developer command with explicit failure reporting and no app behavior change.

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
Reviewed head: a06d418626a8f69b5c87ad3e3fe39b9be18426b7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduced diff: The introduced hunks add the command and selector verification while preserving the existing exact screenshot-result verifier. (scripts/ios-test.mts:89, a06d418626a8)
  • Real simulator evidence: The PR body records an iPhone 17 CLI run with 20 passing tests followed by an unmatched-selector diagnostic and exit 1; it also records whole-scheme, UI-suite, failing-test, and compile-error scenarios. (a06d418626a8)
  • Existing parser ownership and intent: Josh Avant introduced the strict screenshot verifier through improve(ios): reduce screenshot test startup overhead #178891; this PR leaves that contract intact and adds a separate selector operation in the same parser module. (scripts/lib/ios-test-results.mjs:9, d3da87e79d48)
  • Latest revision and review continuity: GitHub's commit patch confirms the latest commit removes only the newly added selector unit test; production behavior is unchanged from the previously reviewed head, whose typing fix remains present. (scripts/ios-test.mts:34, a06d418626a8)
  • Repository policy and inspection limits: Read the complete root, scripts, and iOS AGENTS.md files and applied the simplification and testing guidance; no maintainer-notes directory exists, and some historical blob reads failed locally. (AGENTS.md:1, a06d418626a8)

Likely related people:

  • Josh Avant: Raw commit d3da87e adds scripts/lib/ios-test-results.mjs:9 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d3da87e79d48; files: scripts/lib/ios-test-results.mjs)

PR surface

Docs +9, Config +1, Other +177. Total +187 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 9 0 +9
Config 1 1 0 +1
Generated 0 0 0 0
Other 3 177 0 +177
Total 5 187 0 +187

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This improves developer test ergonomics without changing shipped app behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-06T20:15:12.560Z sha 57ef9f0 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-06T20:36:09.109Z sha c8596b3 :: needs changes before merge. :: [P2] Return a definite string when extracting selector targets
  • reviewed 2026-11-06T20:44:27.510Z sha 85c4966 :: needs maintainer review before merge. :: none

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).
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 6, 2026
@obviyus
obviyus merged commit 63f0570 into main Nov 6, 2026
226 of 227 checks passed
@obviyus
obviyus deleted the ios-test-cli branch November 6, 2026 21:30
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 63f0570. pnpm ios:test runs the iOS app tests on a simulator with CI flags, prints failures and counts from the xcresult, shows compiler errors on build failure, and fails when a selector matches no test (plain xcodebuild exits 0 there). Proof: a full OpenClaw scheme run (1343 passed; 2 pre-existing source-text failures), misspelled-suite, failing-test, compile-error and UI-scheme runs, plus tsgo:scripts.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant