Skip to content

Logger {now} names each file of a run, not the run itself (task 165 phase 3) - #560

Draft
thebhef wants to merge 1 commit into
task165-date-settingfrom
fix-logger-now-per-file
Draft

thebhef wants to merge 1 commit into
task165-date-settingfrom
fix-logger-now-per-file

Conversation

@thebhef

@thebhef thebhef commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Owner ruling (2026-10-08): "{now} should be per file, {start} the
capture's start — that's the behavior I had intuited from both
existing, so if they're the same today by design that's even more
confusing than I expected." resolve_run_path picked one Local::now()
per run and LogWriter reused that base for every split; the panel's
preview only re-asked the host when a template, the project, the
logger's name, or the capture's start changed. So {now} read as a
timestamp frozen at the run's start, identical to {start} whenever a
capture had no wall-clock anchor of its own.

LogWriter now opens through a FileNamer closure — called once to
open the run and again at every roll — instead of holding a fixed
base. The production namer (make_run_namer) resolves the folder
once, rooted and read before the run starts (nothing in a folder
template has reason to differ file to file), closes over the capture's
wall-clock start once, and resolves the file template fresh against
Local::now() on every call. {start} therefore stays the capture's
start across every split; {now} names each file's own creation. The
collision rule is unchanged and is now the only reason a suffix
appears: a resolved name already on disk — because the template has no
{now} at all, or a {now} pattern repeated within its own precision
— takes the next -002, -003… the same way at the run's first file
and at every later split (first_free_part/split_path, now always
scanned from part 1 since each open supplies its own fresh base rather
than a running part counter).

The logger panel's preview ticks once a second while mounted and a
template holds {now} — the interval DateTimePatternEditor already
runs for the date_time_pattern setting — skipped entirely when
neither template carries the token, so an unaffected logger issues no
extra IPC.

Docs: export_template.rs's {now} doc, logger.rs's module doc and
the LogWriter / FileNamer / make_run_namer rustdoc, README's
logger section (per-file {now}, the unchanged {start}, the
collision rule, the preview tick). No ADR states the logger
run-naming rule — ADR 0062 covers only the date-pattern notation, not
when a logger evaluates it — so none is amended.

Verified: cargo test -p cannet-gui (1449 passed, two new — a roll
resolves the file template from its own fresh instant; {start} stays
fixed across a roll while {now} advances), cargo clippy -p cannet-gui --all-targets -- -D warnings, cargo fmt --all -- --check,
rustdoc -D warnings; pnpm --dir apps/gui test (3875 passed, three
new on the preview tick), pnpm --dir apps/gui build; pnpm --dir apps/gui tauri build --no-bundle (release host, runs). Python lanes
skipped — the diff cannot reach them.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

This was referenced Oct 15, 2026

thebhef commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

…hase 3)

Owner ruling (2026-10-08): "{now} should be per file, {start} the
capture's start — that's the behavior I had intuited from both
existing, so if they're the same today by design that's even more
confusing than I expected." `resolve_run_path` picked one `Local::now()`
per run and `LogWriter` reused that `base` for every split; the panel's
preview only re-asked the host when a template, the project, the
logger's name, or the capture's start changed. So `{now}` read as a
timestamp frozen at the run's start, identical to `{start}` whenever a
capture had no wall-clock anchor of its own.

`LogWriter` now opens through a `FileNamer` closure — called once to
open the run and again at every roll — instead of holding a fixed
`base`. The production namer (`make_run_namer`) resolves the folder
once, rooted and read before the run starts (nothing in a folder
template has reason to differ file to file), closes over the capture's
wall-clock start once, and resolves the *file* template fresh against
`Local::now()` on every call. `{start}` therefore stays the capture's
start across every split; `{now}` names each file's own creation. The
collision rule is unchanged and is now the only reason a suffix
appears: a resolved name already on disk — because the template has no
`{now}` at all, or a `{now}` pattern repeated within its own precision
— takes the next `-002`, `-003`… the same way at the run's first file
and at every later split (`first_free_part`/`split_path`, now always
scanned from part 1 since each open supplies its own fresh base rather
than a running part counter).

The logger panel's preview ticks once a second while mounted and a
template holds `{now}` — the interval `DateTimePatternEditor` already
runs for the `date_time_pattern` setting — skipped entirely when
neither template carries the token, so an unaffected logger issues no
extra IPC.

Docs: `export_template.rs`'s `{now}` doc, `logger.rs`'s module doc and
the `LogWriter` / `FileNamer` / `make_run_namer` rustdoc, README's
logger section (per-file `{now}`, the unchanged `{start}`, the
collision rule, the preview tick). No ADR states the logger
run-naming rule — ADR 0062 covers only the date-pattern notation, not
when a logger evaluates it — so none is amended.

Verified: `cargo test -p cannet-gui` (1449 passed, two new — a roll
resolves the file template from its own fresh instant; `{start}` stays
fixed across a roll while `{now}` advances), `cargo clippy -p
cannet-gui --all-targets -- -D warnings`, `cargo fmt --all -- --check`,
rustdoc `-D warnings`; `pnpm --dir apps/gui test` (3875 passed, three
new on the preview tick), `pnpm --dir apps/gui build`; `pnpm --dir
apps/gui tauri build --no-bundle` (release host, runs). Python lanes
skipped — the diff cannot reach them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thebhef
thebhef force-pushed the task165-date-setting branch from 807f610 to c41cbe4 Compare October 26, 2026 22:42
@thebhef
thebhef force-pushed the fix-logger-now-per-file branch from 32fdbd9 to 989268e Compare October 26, 2026 22:42
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.

1 participant