Skip to content

Read logs.dir from the User config to set where session logs go - #117

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-112
Sep 29, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-112

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

A [logs] dir setting in the User config sets where session logs go. It is resolved once, when the config loads, and a Run logs there.

 main
   UserConfig::load                 # needs $HOME now; reads ~/.thirdshift/config.toml
+    logs.dir: "~/x" → $HOME/x, "/abs" → /abs, "rel" → error before any work
+    default → $HOME/.thirdshift/logs
-  run::run(issue, goal)
+  run::run(issue, goal, &config.logs_dir)
-    session::log_path(issue, timestamp, kind)   # hard-coded ~/.thirdshift/logs
+    Logs { issue, dir, timestamp }.path(kind)   # same filename scheme
[logs]
dir = "~/elsewhere/logs"

The README and help document logs.dir. ~ on its own, ~/… and absolute paths are accepted. Relative paths, ~other/… and "" are rejected, with an error naming logs.dir and the config file.

Evidence

  • Before: tests/user_config.rs failed: [logs] was an unknown section, and ~/elsewhere/logs and absolute dirs were never written to.
    After: these tests pass: without_logs_dir_session_logs_go_to_the_default_directory, a_logs_dir_under_tilde_is_under_home_and_created_if_missing, an_absolute_logs_dir_is_used_as_is (each checks that the Failed run's session log: line points into the directory) and a_relative_or_mistyped_logs_dir_stops_the_run_naming_the_setting (checked with assert_rejected_before_any_work). The full cargo test run passes and cargo clippy --all-targets is clean.

Merge Danger

Door: two-way

Blast Radius: small

Existing configs behave as before, and the default logs location is unchanged. One behaviour change: a Run with HOME unset or empty now stops before any work with HOME is not set. Before, it got past preflight and then failed at the first log path.

Unaddressed findings

Standards

  • Repeated Switches: section names appear in both matches!(…"merge" | "logs") and the key match arms. Skipped because the first check exists to give its own errors ("unknown section" vs "must be the section [logs]"). With two sections, merging the checks would make the code harder to read.
  • implement takes both &Logs and &mut PathBuf log. Skipped because this pattern predates the change (it used to be timestamp). log is the most recent session's log for the Failed run path, not part of where logs go.

Spec

  • Scope creep: help now documents logs.dir. Kept, to match how help already documents merge.always.
  • Scope creep: a bare ~ is accepted. Kept and documented in the README and the error message, because ~ is $HOME, an absolute path.
  • Behaviour change: an unset HOME now stops the Run in main before any work. Kept because the logs directory is resolved when the config loads, and failing before any work is better than failing later with a worktree already created.

Closes #112

🤖 Generated with Claude Code

JacobStephens2 and others added 2 commits September 29, 2026 19:31
A leading ~ expands to $HOME; a relative path stops the Run before any
work, naming the setting. Without it, logs stay in ~/.thirdshift/logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UserConfig now holds the logs directory itself, defaulting under the
same HOME it read the file from, and Logs carries the issue its paths
are named for. A bare ~ is documented as accepted, and the relative
logs.dir test checks the exact error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 85bd773 into main Sep 29, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-112 branch September 29, 2026 19:38
JacobStephens2 added a commit that referenced this pull request Sep 29, 2026
Combines main's logs.dir setting (#117) with this branch's [email]
section: the User config now knows the merge, logs and email sections,
holds both the resolved logs directory and the email settings, and the
README and help text document both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logs.dir in the User config

1 participant