Conversation
Pilot for ADR 0012 — Tauri command error-type standardization.
The AppError infrastructure in src-tauri/src/error.rs (stable error
codes, categories, retryable flag, From impls for rusqlite / io /
validation / security errors) was fully built but zero commands used
it. All 324 command signatures were on Result<T, String> with manual
.map_err(|e| e.to_string()) at every error site.
This PR establishes the migration pattern without a frontend flag day:
1. AppError now serializes as its Display form ("[CODE] message"),
preserving the existing wire contract. Frontend `${err}` / showError
handlers continue to work unchanged but now receive strings with a
stable [CODE] prefix they can branch on.
2. security_commands.rs + its 14 #[tauri::command] wrappers in
commands/mod.rs + the shared normalize_github_host helper are
migrated from Result<T, String> to Result<T, AppError>. One
still-unmigrated caller (ingest_github_remote at mod.rs:3733)
bridges via .map_err(|e| e.to_string())? — these bridges disappear
as each enclosing function migrates in future PRs.
ADR 0012 captures the methodology, the migration recipe (6-step per
file), the file-by-file runway for the remaining 13 command files, and
reproducible grep commands to track progress.
Verified: cargo check --all-targets clean. cargo test --lib 311/312
(the one ignored is pre-existing model-download). No frontend changes
needed — sampled 100 error-handling sites and 13 toThrow assertions,
all compatible with the string wire format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pilot for ADR 0012 — Tauri command error-type standardization.
The
AppErrorinfrastructure insrc-tauri/src/error.rs(stable error codes, categories, retryable flag,Fromimpls for rusqlite / io / validation / security errors) was fully built but zero commands used it. All 324 command signatures were onResult<T, String>with manual.map_err(|e| e.to_string())at every error site.This PR establishes the migration pattern without a frontend flag day.
The pattern
AppErrornow serializes as itsDisplayform ("[CODE] message") via a customimpl Serializeusingserializer.collect_str. The#[derive(Serialize, Deserialize)]was removed in favor of the explicit impl. Frontend${err}/showError(...)handlers keep working — they receive strings, now with a stable[CODE]prefix they can branch on.security_commands.rs+ its 14#[tauri::command]wrappers incommands/mod.rs+ the sharednormalize_github_hosthelper are migrated fromResult<T, String>toResult<T, AppError>.ingest_github_remoteatmod.rs:3733) calls the migrated helper through.map_err(|e| e.to_string())?. These bridges disappear automatically as each enclosing function migrates in future PRs.The runway
ADR 0012 captures:
grepcommands to track progressTarget cadence: one file per PR, admin-merge since each migration is a pure refactor with tests green.
Test plan
cargo check --all-targets— cleancargo test --lib— 311/312 pass (one pre-existing#[ignore]-gated model-download test)toThrow(...)assertions — all compatible with the string wire format (thetoThrowcalls are against mocks, not wire errors)backend-testsgreenbuildgreen🤖 Generated with Claude Code