Skip to content

transcripts_dir uses .expect() for HOME env var — should return an error for this environmental failure #148

@ooloth

Description

@ooloth

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.rsConfig::load() for reference on the anyhow error-propagation pattern

QA plan

  1. Call transcripts_dir() in a context with HOME unset — expect an Err returned, not a panic.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions