iOS submit integration gate: Rust httpmock + Vitest contract tests
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.