refactor(src): migrate jira commands to AppError with From<JiraError>#81
Merged
refactor(src): migrate jira commands to AppError with From<JiraError>#81
Conversation
Continue ADR 0012 migration. jira_commands.rs has 10 Tauri commands (is_jira_configured, get_jira_config, configure_jira, clear_jira_config, get_jira_ticket, add_jira_comment, push_draft_to_jira, get_jira_transitions, transition_jira_ticket, post_and_transition). Added a From<jira::JiraError> impl in error.rs so each JiraClient call site collapses from .map_err(|e| e.to_string()) to ?-propagation, with rich code mapping: - JiraError::Request -> NETWORK_CONNECTION_FAILED (retryable) - JiraError::Api -> NETWORK_CONNECTION_FAILED + detail - JiraError::Parse -> VALIDATION_INVALID_FORMAT + detail - JiraError::NotConfigured -> SECURITY_AUTH_FAILED - JiraError::AuthFailed -> auth_failed() (retryable) - JiraError::RateLimited -> NETWORK_RATE_LIMITED (retryable) - JiraError::Timeout -> NETWORK_TIMEOUT (retryable) Other error sites: - HTTPS-required refusal now carries SECURITY_HTTPS_REQUIRED (the https_required() constructor was already defined) - Draft missing response text -> NOT_FOUND_DRAFT (draft_not_found()) - SSRF validation failure -> VALIDATION_INVALID_URL (invalid_url()) - Jira connection not configured -> SECURITY_AUTH_FAILED + detail Bridging: commands/mod.rs has an unrelated, unregistered, dead-code block of 10 duplicate Jira wrappers (~800 LOC) that shadow jira_commands.rs. Four of them delegate to jira_commands::*_impl and so must bridge the new AppError back to String with .map_err(|e| e.to_string()) to keep compiling. The full deletion of that dead block is spun off as a separate task (it's orthogonal to the error-type migration). Verified: - cargo check --all-targets clean - cargo test --lib: 311 pass, 1 ignored - cargo test --test command_contracts: 8 pass - pnpm tsc --noEmit clean - pnpm test: 67 files, 262 tests pass - No frontend Jira error strings are exact-string matched (only one .catch site, which ignores the error)
This was referenced Apr 22, 2026
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
Continuation of ADR 0012 migration. 10 Jira Tauri commands →
Result<T, AppError>plus a richFrom<jira::JiraError>impl inerror.rs.Code mapping via From
JiraErrorvariantRequest(reqwest::Error)NETWORK_CONNECTION_FAILEDApi(msg)NETWORK_CONNECTION_FAILEDParse(msg)VALIDATION_INVALID_FORMATNotConfiguredSECURITY_AUTH_FAILEDAuthFailedSECURITY_AUTH_FAILEDauth_failed()RateLimitedNETWORK_RATE_LIMITEDTimeoutNETWORK_TIMEOUTEach JiraClient call site collapses from
.await.map_err(|e| e.to_string())?to.await?— the cleanest migration so far.Other call-site mappings
SECURITY_HTTPS_REQUIRED(https_required()constructor)NOT_FOUND_DRAFT(draft_not_found())VALIDATION_INVALID_URL(invalid_url())SECURITY_AUTH_FAILEDwith detailCompatibility bridging
commands/mod.rscarries a dead-code block (~800 LOC) of 10 duplicate Jira wrappers that shadowjira_commands.rs. Four of them delegate tojira_commands::*_impland needed a.map_err(|e| e.to_string())bridge to keep compiling. Full deletion of that block is a separate follow-up task.Test plan
cargo check --all-targets— cleancargo test --lib— 311 pass, 1 ignoredcargo test --test command_contracts— 8 passpnpm tsc --noEmit— cleanpnpm test— 67 files, 262 tests pass.catchsite touches Jira errors, and it ignores the payload — zero wire-format risk🤖 Generated with Claude Code