diff --git a/docs/superpowers/plans/2026-07-31-xy-start-on-login.md b/docs/superpowers/plans/2026-07-31-xy-start-on-login.md index 6f36b39..a91e852 100644 --- a/docs/superpowers/plans/2026-07-31-xy-start-on-login.md +++ b/docs/superpowers/plans/2026-07-31-xy-start-on-login.md @@ -168,9 +168,11 @@ The daemon currently logs only to stderr, which launchd discards. Give it `log_d **Interfaces:** - Consumes: `impl io::Write for RotatingLogWriter` from Task 1. -- Produces: `pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result>>`. No later task depends on this. +- Produces: `pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result>`. No later task depends on this. -`tracing-subscriber` 0.3 already implements `MakeWriter` for `Mutex where W: io::Write` and for `Arc`, so `Arc>` satisfies `with_writer` directly. No adapter type is needed. +`tracing-subscriber` 0.3 implements `MakeWriter` for `Mutex where W: io::Write` (`fmt/writer.rs:808`), so a plain `Mutex` satisfies `with_writer` directly. No adapter type is needed. + +**Corrected 2026-08-01.** This step originally specified `Arc>`, on the false premise that `impl MakeWriter for Arc` would cover it. That impl requires `&'a W: io::Write`, and `&Mutex` does not implement `io::Write`. The error was caught during implementation and cost one fix round; the shipped code uses a bare `Mutex`. - [ ] **Step 1: Write the failing test** @@ -215,16 +217,16 @@ Prepend to `crates/xy/src/logging.rs`, above the test module: ```rust use std::path::Path; -use std::sync::{Arc, Mutex}; +use std::sync::Mutex; use xy_supervisor::logs::RotatingLogWriter; const LOG_FILE_MAX_BYTES: u64 = 10 * 1024 * 1024; const LOG_FILE_KEEP: usize = 5; -pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result>> { +pub(crate) fn daemon_writer(log_dir: &Path) -> std::io::Result> { let writer = RotatingLogWriter::open(&log_dir.join("xy.log"), LOG_FILE_MAX_BYTES, LOG_FILE_KEEP)?; - Ok(Arc::new(Mutex::new(writer))) + Ok(Mutex::new(writer)) } ``` diff --git a/docs/superpowers/specs/2026-07-31-xy-start-on-login-design.md b/docs/superpowers/specs/2026-07-31-xy-start-on-login-design.md index 9fe4461..b576e4e 100644 --- a/docs/superpowers/specs/2026-07-31-xy-start-on-login-design.md +++ b/docs/superpowers/specs/2026-07-31-xy-start-on-login-design.md @@ -154,11 +154,17 @@ which is too late to open a log file for the logger itself. For the `Cmd::Daemon` arm only, the subscriber writes to `stderr.and(file)` via `MakeWriterExt`, where the file half is `log_dir/xy.log` backed by the existing `xy_supervisor::logs::RotatingLogWriter` (10 MB × 5, the same rotation used for -per-server logs). No adapter type is needed: `tracing-subscriber` 0.3 already -implements `MakeWriter` for `Mutex where W: io::Write` (`fmt/writer.rs:808`) -and for `Arc where W: MakeWriter` (`fmt/writer.rs:694`), so -`Arc>` satisfies the bound once Task 1 lands the -`io::Write` impl. +per-server logs). No adapter type is needed: `tracing-subscriber` 0.3 +implements `MakeWriter` for `Mutex where W: io::Write` +(`fmt/writer.rs:808`), so a plain `Mutex` satisfies +`with_writer` once the `io::Write` impl lands. + +**Corrected 2026-08-01.** An earlier draft of this section claimed +`Arc>` also satisfied the bound, via +`impl MakeWriter for Arc`. That is false: the `Arc` impl +(`fmt/writer.rs:694`) requires `&'a W: io::Write`, and `&Mutex` does not +implement `io::Write`. The claim survived into the implementation plan and cost +a fix round before being caught. The shipped code uses a bare `Mutex`. Every other subcommand keeps stderr-only logging; CLI output does not belong in the daemon's log.