fabro/lib/crates/fabro-util/src
Bryan Helmkamp 7bc3fe0dbc
fix: wrap propagated io errors with anyhow context across prod code
A recent CI flake surfaced as bare "error: No such file or directory
(os error 2)" with no chain, because the failing operation lived behind
a raw `?` on a `std::fs::` / `File::create` / `Command::spawn` call. The
error had no verb, no path, no hint at which step in server startup
broke. Retry loops were explicitly rejected -- the goal is to diagnose
the next occurrence, not mask it.

Wraps 50+ such sites across fabro-cli, fabro-server, fabro-workflow,
fabro-util, fabro-vault, fabro-telemetry, fabro-interview, fabro-llm,
and fabro-devcontainer with `.with_context(|| format!("<verb> {path}"))`
so anyhow's error chain carries both the operation and the path when
an io error escapes.

Where the enclosing function returns `io::Result` (fabro-util run_log,
fabro-interview recording, fabro-llm attachment loader), the error is
re-wrapped via `io::Error::new` to keep the signature stable. Where a
crate uses its own thiserror enum, either a new `io_context` helper
was added (fabro-vault) or the path was folded into the existing
`Error::Io(String)` message (fabro-workflow).

No retry loops. No behavior changes. Skipped sites documented:
`.ok()`-swallowed, `match ErrorKind::NotFound`, `let _ = ...`, typed
error variants that already carry the path, and test modules.

Verified: cargo build --workspace, cargo +nightly clippy --workspace
--all-targets -- -D warnings, cargo nextest run --workspace (3991/3991
pass).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 11:44:38 -04:00
..
redact fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
backoff.rs deps: bump rand 0.8 → 0.9 (#163) 2026-04-17 07:57:10 -04:00
check_report.rs Show fabro secret set command in doctor remediation output 2026-04-14 15:22:25 -04:00
dev_token.rs fix: wrap propagated io errors with anyhow context across prod code 2026-04-17 11:44:38 -04:00
env.rs feat(template): unify workflow and config template syntax 2026-04-11 10:58:50 -04:00
home.rs fix(auth): restore local dev-token client coverage 2026-04-13 07:33:35 -04:00
json.rs refactor: remove remaining event json indirection 2026-04-04 13:24:19 -04:00
lib.rs refactor(auth): deduplicate session secret, remove dead code, tighten test helpers 2026-04-13 12:18:01 -04:00
path.rs Improve install command output ordering and path display 2026-04-14 15:16:21 -04:00
printer.rs refactor(cli): route command output through Printer 2026-04-11 14:40:33 -04:00
run_log.rs fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
session_secret.rs deps: bump rand 0.8 → 0.9 (#163) 2026-04-17 07:57:10 -04:00
terminal.rs fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
text.rs Enable 7 additional pedantic clippy lints 2026-03-29 13:47:08 -04:00
version.rs Move git SHA/build date from fabro-util to fabro-cli build.rs 2026-03-13 15:03:12 -04:00
warnings.rs chore: fix warnings and test stability 2026-04-04 13:31:04 -04:00