Skip to content

systems transport parity

Douwe de Vries edited this page Jul 2, 2026 · 2 revisions

Transport parity

Active contributors: Douwe de Vries

Purpose

Transport parity keeps browser HTTP mode and desktop Tauri mode equivalent. A user operation should have one shared workflow and matching frontend, HTTP, and Tauri contract surfaces.

Directory layout

src/api/app.rs
src/api/handlers.rs
src-tauri/src/main.rs
src-tauri/src/commands.rs
frontend/src/services/
├── tauri.ts
├── tauriCommands.ts
└── apiRoutes.ts
tests/transport_parity_integration.rs

Key abstractions

Name File Description
TRANSPORT_PARITY_ROUTE_PATHS src/api/app.rs Canonical HTTP route list covered by parity tests.
tauri_commands! src-tauri/src/main.rs Canonical Tauri command registration list.
TAURI_COMMANDS frontend/src/services/tauriCommands.ts Frontend command name constants.
build*Route functions frontend/src/services/apiRoutes.ts Frontend HTTP route builders.
isTauri frontend/src/services/tauri.ts Runtime switch between Tauri and browser implementations.

How it works

graph LR
    UI[UI action] --> Switch[frontend/src/services/tauri.ts]
    Switch -->|browser| Routes[apiRoutes.ts -> src/api/app.rs]
    Switch -->|desktop| Commands[tauriCommands.ts -> src-tauri/src/main.rs]
    Routes --> Workflow[src/backend/workflow.rs]
    Commands --> Workflow
Loading

Tests catch drift between route constants, command constants, and command registration. Browser tests alone cannot prove desktop parity, so changes must update both runtime paths.

Integration points

src/api/handlers.rs and src-tauri/src/commands.rs should call shared workflow functions in src/backend/workflow.rs. Type drift is handled by paired edits in src/backend/requests.rs, src/presentation/responses.rs, and frontend/src/types/api.ts.

Entry points for modification

When adding an operation, update all four surfaces: frontend service, HTTP route/handler, Tauri command/registration, and tests. If the operation is browser-only or desktop-only, document why and avoid exposing a misleading shared function.

Key source files

File Purpose
src/api/app.rs HTTP route constants and parity route list.
src-tauri/src/main.rs Tauri command registration macro.
src-tauri/src/commands.rs Command implementations.
frontend/src/services/tauri.ts Runtime transport switch.
tests/transport_parity_integration.rs Transport parity coverage.

Clone this wiki locally