Why
transcripts_dir() panics with .expect("HOME not set") when the HOME environment variable is absent. A missing environment variable is an environmental failure (not a programmer error), and the project convention documented in CLAUDE.md is to return anyhow errors for such cases rather than panicking.
Current state
workflows/src/implement.rs line 13: std::env::var("HOME").expect("HOME not set"). If HOME is absent, the process panics rather than propagating a structured error. Config::load() elsewhere in the project reads env vars via anyhow context chains, establishing the expected pattern for this class of failure.
Ideal state
transcripts_dir returns Result<PathBuf> and propagates a missing HOME as anyhow::Error with .context("HOME not set").
- Callers receive a structured error they can propagate or surface with context.
Starting points
workflows/src/implement.rs — line 13, the std::env::var("HOME").expect(...) call
config/src/lib.rs — Config::load() for reference on the anyhow error-propagation pattern
QA plan
- Call
transcripts_dir() in a context with HOME unset — expect an Err returned, not a panic.
- Run
cargo test — expect all tests pass.
Done when
transcripts_dir() returns Result<PathBuf> and propagates a missing HOME as a structured error consistent with the rest of the codebase.
Why
transcripts_dir()panics with.expect("HOME not set")when theHOMEenvironment variable is absent. A missing environment variable is an environmental failure (not a programmer error), and the project convention documented in CLAUDE.md is to returnanyhowerrors for such cases rather than panicking.Current state
workflows/src/implement.rsline 13:std::env::var("HOME").expect("HOME not set"). IfHOMEis absent, the process panics rather than propagating a structured error.Config::load()elsewhere in the project reads env vars viaanyhowcontext chains, establishing the expected pattern for this class of failure.Ideal state
transcripts_dirreturnsResult<PathBuf>and propagates a missingHOMEasanyhow::Errorwith.context("HOME not set").Starting points
workflows/src/implement.rs— line 13, thestd::env::var("HOME").expect(...)callconfig/src/lib.rs—Config::load()for reference on theanyhowerror-propagation patternQA plan
transcripts_dir()in a context withHOMEunset — expect anErrreturned, not a panic.cargo test— expect all tests pass.Done when
transcripts_dir()returnsResult<PathBuf>and propagates a missingHOMEas a structured error consistent with the rest of the codebase.