Skip to content

feat(logging): route all core binaries to shared native log dir#315

Merged
githubrobbi merged 2 commits into
mainfrom
feat/shared-native-log-dir
May 29, 2026
Merged

feat(logging): route all core binaries to shared native log dir#315
githubrobbi merged 2 commits into
mainfrom
feat/shared-native-log-dir

Conversation

@githubrobbi
Copy link
Copy Markdown
Collaborator

Summary

Replaces three independent, divergent log-directory implementations in the core binaries with a single shared helper, uffs_security::log_dir. Fixes the broken ~/bin/uffs/logs default (writing logs/ under the installed uffs binary file failed with Not a directory), and moves all binaries onto per-OS native log locations.

Binary Old default New default
uffs-mft ~/bin/uffs/logs shared native dir
uffsd <data_local_dir>/uffs/uffsd.log <native>/uffsd.log
uffsmcp <data_local_dir>/uffs/uffs_mcp.log <native>/uffs_mcp.log
uffs-mcp-http <data_local_dir>/uffs/mcp-gateway.log <native>/mcp-gateway.log

Native per-OS locations (the directory each OS expects for logs):

  • macOS: ~/Library/Logs/uffs (read by Console.app)
  • Windows: %LOCALAPPDATA%\uffs\logs (== dirs data_local_dir)
  • Linux: $XDG_STATE_HOME/uffs/logs, else ~/.local/state/uffs/logs

Design

  • Helper home: uffs-security — the sole common dependency of all three log writers, already owns platform-path logic (keystore, runtime_dir) and the dirs_next dep. No new dependency edges except uffs-mcp swapping its now-unused direct dirs-next for a direct uffs-security.
  • One shared base dir, per-tool filenames — logs co-locate in Console.app / journald.
  • Env override: UFFS_LOG_DIR overrides the directory for every binary (identical to the products-repo TUI). MCP's explicit UFFS_LOG_FILE (a full file path) still takes precedence as a finer-grained knob. Precedence: UFFS_LOG_FILE > UFFS_LOG_DIR > native > ./logs.
  • Linux XDG resolved by hand (no dirs_next::state_dir()), honoring absolute XDG_STATE_HOME only, per the XDG spec. The pure decision is split into a testable xdg_state_home(raw, home) to avoid unsafe env mutation in tests.

Verification

  • cargo clippy --workspace --all-features clean
  • 424 tests pass (incl. new log_dir tests asserting the exact ~/Library/Logs/uffs path)
  • Runtime check on macOS: uffsd writes ~/Library/Logs/uffs/uffsd.log; data/PID files correctly stay in App Support; UFFS_LOG_DIR redirects as expected.

Note: unrelated doc commit included

This branch carries one unrelated commit — docs(soak): record 7 consecutive both-platforms-green bake-days — a pre-existing uncommitted working-tree change for the memory-tiering bake gate that was sitting in the repo when this work started. It is intentionally a separate, clearly-labeled commit; it does not touch any code.

🤖 Generated with Claude Code

githubrobbi and others added 2 commits May 29, 2026 03:10
Replace three independent log-dir implementations with one shared
helper, `uffs_security::log_dir`. Fixes the broken `~/bin/uffs/logs`
default in uffs-mft (writing logs under the installed `uffs` binary
file failed with "Not a directory"), and moves uffsd / uffsmcp /
mcp-gateway off the cache dir onto per-OS native log locations:

  - macOS:   ~/Library/Logs/uffs           (read by Console.app)
  - Windows: %LOCALAPPDATA%\uffs\logs       (== data_local_dir)
  - Linux:   $XDG_STATE_HOME/uffs/logs, else ~/.local/state/uffs/logs

`UFFS_LOG_DIR` overrides the directory for every binary (matches the
products-repo TUI); MCP's explicit `UFFS_LOG_FILE` still takes
precedence as a finer-grained knob. All binaries share one base dir,
each keeping its distinct filename, so logs co-locate in Console.app /
journald.

The helper lives in uffs-security because it is the sole common
dependency of all three log writers and already owns platform-path
logic (keystore, runtime_dir) plus the dirs_next dep. uffs-mcp drops
its now-unused direct dirs-next dep and gains a direct uffs-security
dep. Linux XDG state home is resolved by hand (no dirs_next state_dir),
honoring absolute XDG_STATE_HOME only, per the XDG spec.

Verified: workspace clippy --all-features clean; 424 tests pass
(incl. new log_dir tests); runtime check on macOS confirms uffsd writes
~/Library/Logs/uffs/uffsd.log, data/PID files stay in App Support, and
UFFS_LOG_DIR redirects as expected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ut criterion met)

Flip the first §3 cut criterion to checked and fill the bake-day log
table (Day 1–14, 2026-05-15 → 05-28) with per-day Mac/Windows results
and RPC-timing means. Two single-step transient flakes (05-16 mac N6
tier, 05-17 win forget) logged-and-continued per §2; neither repeated,
so the bake clock held. Seven both-platforms-green days reached
(05-18, 19, 22, 24, 25, 27, 28).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@githubrobbi githubrobbi enabled auto-merge (squash) May 29, 2026 10:13
@githubrobbi githubrobbi merged commit 4736702 into main May 29, 2026
22 checks passed
@githubrobbi githubrobbi deleted the feat/shared-native-log-dir branch May 29, 2026 10:30
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