iOS submit integration gate: Rust httpmock + Vitest contract tests
Sindri the Assayer — QA Engineer
By the end of this chapter you’ll understand:
- How
submit_report_via_bridgewas extracted from the Tauri command to make it testable without a keychain or device - What the five httpmock tests verify and which HTTP error classes they cover
- Why contract tests at this layer catch the regression class that unit tests on each side alone cannot
iOS submit integration gate: Rust httpmock + Vitest contract tests
Status: Delivered CAS: CAS-2532 Delivered: 2026-05-12 Commit: 40f14de
What’s new
The iOS bug-report submit path now has an integration test layer that catches the class of regression that caused the CAS-2381 → 2516 → 2522 chain — two days of whack-a-mole where each fix broke a different layer because nothing tested the full Rust → CloudBridge → iOS path together.
Two test suites were added:
-
5 Rust httpmock integration tests in
src-tauri/tests/cloud_bridge_report_issue_integration.rs: verify endpoint path, bearer auth header, and error-to-status mapping for HTTP 401, 413, and 503 responses. The business logic was extracted from the keychain-bound Tauri command into the testablesubmit_report_via_bridgefunction. -
18 Vitest contract tests in
test/utils/platform.test.ts(unblocked by this PR): iOS routing, User-Agent fallback, and platform detection viatauri-plugin-os. These pre-existed as stubs; the Rust-side extraction made the TS contract testable in isolation.
How to run it
# Rust integration tests (requires no simulator)cd src-tauri && cargo test cloud_bridge_report_issue
# Frontend contract testsdeno task testWhat changed under the hood
src-tauri/src/commands/ai_commands.rs—submit_report_via_bridgeextracted from thecloud_bridge_report_issueTauri command; the command is now a thin keychain-fetching wrapper.src-tauri/tests/cloud_bridge_report_issue_integration.rs— 5 httpmock tests covering the three HTTP error classes plus happy path.src-tauri/Cargo.toml—httpmockadded as a dev-dependency.src/types/html2canvas.d.ts— type stub so the platform test file can import cleanly.
Why we built it
The CAS-2516 incident (iOS submit broken because tauri-plugin-os was
absent from Cargo.toml) was caught only after a TestFlight build and a
device test — a loop that costs 30+ minutes per cycle. Each of the three
regression layers (Rust error mapping, iOS routing, platform detection)
had tests at the unit level, but nothing tested the integration contract.
This gate closes that gap so the next CAS-2516-class bug fails CI before
it reaches TestFlight.
Known limitations
- The httpmock tests mock CloudBridge at the HTTP level; they do not test the Tauri keychain call that feeds the auth token. That boundary remains manual-only.
- Maestro (device-level) tests for the submit flow still require a paired device; no simulator path exists for the full submit UX.
Recap
submit_report_via_bridgewas extracted from the keychain-bound Tauri command so it can be called in tests without a real keychain; the command itself becomes a thin wrapper.- Five httpmock tests cover the happy path and HTTP 401, 413, and 503 error classes against a local mock server — no simulator required.
- Eighteen Vitest contract tests in
platform.test.tsverify iOS routing, User-Agent fallback, and platform detection in isolation.
What changed {#what-changed}
This feature shipped in CAS-2532. See: CHANGELOG → 2026-05-18