refactor(src): migrate 3 small command files to AppError#78
Merged
Conversation
Continue the ADR 0012 migration. Three small self-contained files land together to keep the cadence brisk without bloating the PR: 1. app_core_commands.rs (4 commands: check_fts5_enabled, check_db_integrity, get_vector_consent, set_vector_consent) — all database-backed one-liners, now using AppError::db_lock_failed, db_not_initialized, and db_query_failed. 2. pilot_feedback.rs (6 commands + require_pilot_logging_enabled helper): logging-policy refusals now carry SECURITY_PERMISSION_DENIED with retention of the env-var hint. Added a small feedback_err helper so the three analytics commands surface DB_QUERY_FAILED with detail, and export_pilot_data routes validation outcomes through the matching AppError constructors (path_traversal, invalid_path, sensitive_path). 3. decision_tree_runtime.rs (2 impls, 2 call sites in model_commands.rs). The two Tauri wrappers list_decision_trees / get_decision_tree in model_commands.rs migrate alongside so no bridge calls are needed. Verified: cargo check --all-targets clean, cargo test --lib 311 passed, 1 ignored (unchanged). AppError-typed signatures grew from 16 → 23 by the ADR methodology grep. Remaining runway (per ADR 0012): 10 command files on Result<T, String>. Next bites: startup_commands (3), backup.rs (4), search_api.rs (7).
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. Three small self-contained files, bundled to keep cadence brisk without bloating PRs.
Migrated
app_core_commands.rs(4 commands):check_fts5_enabled,check_db_integrity,get_vector_consent,set_vector_consent. All DB-backed one-liners →AppError::db_lock_failed/db_not_initialized/db_query_failed.pilot_feedback.rs(6 commands +require_pilot_logging_enabledhelper): policy-refusal now carriesSECURITY_PERMISSION_DENIED; a smallfeedback_errhelper routes the three analytics commands throughDB_QUERY_FAILED;export_pilot_dataroutes validation outcomes through matched constructors (path_traversal,invalid_path,sensitive_path).decision_tree_runtime.rs(2 impls) + its 2 Tauri wrappers (list_decision_trees/get_decision_tree) inmodel_commands.rs. Migrated together to avoid bridge calls.Progress
AppError-typed signatures: 16 → 23 by the ADR 0012 methodology grep (under-counts nested-generic return types, so real progress is higher).
Remaining runway per ADR 0012: 10 command files still on
Result<T, String>. Next sensible bites:startup_commands(3 cmds),backup.rs(4),search_api.rs(7).Test plan
cargo check --all-targets— cleancargo test --lib— 311 pass, 1 ignored (pre-existing)backend-testsgreenbuildgreen🤖 Generated with Claude Code