Skip to main content

resolve_active

Function resolve_active 

Source
pub fn resolve_active(args: &[String]) -> Result<PathBuf, String>
Expand description

Active-session resolver consolidating the patterns used by replay.rs / summary.rs / report_cmd.rs / metricsql_cmd.rs / plot_metrics.rs / completion.rs.

Resolves to an existing session directory in this order:

  1. --session / --session-path / --session-name from args (via read_session_dir).
  2. The logs/latest symlink, when it exists and points at a session directory with the expected artifacts (metrics.db or session.log).
  3. Err with a remediation message naming the flags that would have worked.

Read-only — no filesystem mutation. Use this anywhere a post-run command needs to operate on an existing session.

Why a separate function from read_session_dir. read_session_dir returns Option (no opinion on what to do when nothing’s set); resolve_active makes that the call site’s failure mode, with a single canonical error message.