-
Notifications
You must be signed in to change notification settings - Fork 0
systems shared backend workflows
Active contributors: Douwe de Vries
The shared backend workflow layer coordinates CSV loading, mapping suggestions, comparisons, export, pair-order files, and comparison snapshots. It is the main API called by both Axum handlers and Tauri commands.
src/backend/
├── workflow.rs
├── requests.rs
├── validation.rs
├── error.rs
├── store.rs
└── session.rs
| Name | File | Description |
|---|---|---|
load_csv_workflow |
src/backend/workflow.rs |
Parses bytes or paths, enforces file size, builds file-load metadata. |
apply_loaded_csv_for_session |
src/backend/workflow.rs |
Stores loaded CSV data and clears stale results. |
suggest_mappings_for_session |
src/backend/workflow.rs |
Suggests column mappings using headers and loaded values. |
run_comparison_for_session |
src/backend/workflow.rs |
Validates request, executes comparison, writes results if inputs are still current. |
CsvAlignError |
src/backend/error.rs |
Shared error type serialized through HTTP and Tauri. |
graph TD
Adapter[HTTP handler or Tauri command] --> Workflow[src/backend/workflow.rs]
Workflow --> Validation[src/backend/validation.rs]
Workflow --> Store[src/backend/store.rs]
Workflow --> Csv[src/data/csv_loader.rs]
Workflow --> Mapping[src/comparison/mapping.rs]
Workflow --> Engine[src/comparison/engine.rs]
Workflow --> Responses[src/presentation/responses.rs]
Workflow functions keep expensive work outside long store locks where possible. run_comparison_for_session reads the current Arc<CsvData> inputs and data_revision, runs comparison, then writes results only if the session still points at the same inputs.
src/api/handlers.rs wraps blocking workflow calls for Axum. src-tauri/src/commands.rs calls the same functions directly for desktop. Frontend state expects response shapes from src/presentation/responses.rs and src/backend/requests.rs.
New product behavior should usually start here. Add a workflow function, keep validation in src/backend/validation.rs if it is request-specific, add integration tests under tests/, and only then wire HTTP, Tauri, and frontend UI.
| File | Purpose |
|---|---|
src/backend/workflow.rs |
Shared workflow orchestration. |
src/backend/requests.rs |
Request and persistence DTOs. |
src/backend/validation.rs |
Comparison request validation. |
src/backend/error.rs |
Error shape and status mapping. |
src/presentation/responses.rs |
Public response DTOs. |