Skip to content

M15.1: tracing infra + LogTracer bridge (FR-65, FR-69)#19

Merged
UnbreakableMJ merged 1 commit into
mainfrom
feature/m15-1-tracing-infra
May 4, 2026
Merged

M15.1: tracing infra + LogTracer bridge (FR-65, FR-69)#19
UnbreakableMJ merged 1 commit into
mainfrom
feature/m15-1-tracing-infra

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

First slice of M15 (PRD §5.8.4 — -vv / -vvv / JSONL debug). Adds the
structured-tracing scaffold so M15.2 can layer FR-66 instrumentation
on top, and so M15.4 (Gitway-side) can wire one subscriber that sees
both the new structured events and the ~59 existing log::*! calls.

  • New deps: tracing = 0.1, tracing-log = 0.2 (MSRV-1.88-clean).
  • New module anvil_ssh::log: category constants (CAT_KEX, CAT_AUTH, CAT_CHANNEL, CAT_CONFIG) + pub fn install_log_bridge() wrapping tracing_log::LogTracer::init().
  • 4 unit tests covering prefix invariant, slice/constants consistency, uniqueness, and idempotency.

Anvil itself does NOT install a subscriber — that policy belongs to the consumer (Gitway CLI in M15.4). The bridge stays in place permanently for russh and other reverse-deps that stay on log.

Public API: pure additions. Version bump to 0.6.0 lands in M15.3.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features --locked -- -D warnings
  • cargo test --lib --tests --locked — all green, including 4 new log::* tests
  • CI matrix on this PR (Linux/macOS/Windows + MSRV 1.88)

🤖 Generated with Claude Code

Adds the structured-tracing scaffold for the M15 verbose / JSONL
debug surface (PRD §5.8.4).  Anvil itself does NOT install a
subscriber — the consumer (Gitway CLI in M15.4) decides whether
output is human-formatted, JSONL, file-rotated, etc.  M15.1 just
provides the category constants + the log/tracing bridge so a
single subscriber sees both the ~59 existing log::*! calls (from
Anvil + russh + ssh-key) AND the new structured tracing events
M15.2 will add.

Cargo.toml:
- `tracing = 0.1` and `tracing-log = 0.2` (MSRV-1.88-clean).

src/log.rs (new, ~140 lines):
- pub const CAT_KEX     = anvil_ssh::kex
- pub const CAT_AUTH    = anvil_ssh::auth
- pub const CAT_CHANNEL = anvil_ssh::channel
- pub const CAT_CONFIG  = anvil_ssh::config
- pub const CATEGORIES: &[&str] — used by Gitway's
  --debug-categories flag to validate user input.
- pub fn install_log_bridge() -> Result<(), SetLoggerError>
  wraps tracing_log::LogTracer::init() with module-level
  documentation about the `log::*!` -> tracing forwarding,
  idempotency semantics, and the must-call-before-Cli::parse()
  ordering trap.
- 4 unit tests: prefix invariant, slice/constants consistency,
  uniqueness, idempotency.

src/lib.rs:
- pub mod log;

Public API audit: only additions (new pub mod, no breaking
changes).  Bumps to 0.6.0 land in M15.3.

Plan: M15.1 of anvil-gitway-milestone-plan.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 28f3c3e into main May 4, 2026
5 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the feature/m15-1-tracing-infra branch May 4, 2026 15:17
UnbreakableMJ added a commit that referenced this pull request May 4, 2026
…instrumentation) (#21)

Bumps anvil-ssh from 0.5.0 to 0.6.0 to publish the M15.1 + M15.2
work as a single crates.io release.  M15 is a multi-PR milestone
(PRD §5.8.4 — `-vv`/`-vvv`/JSONL debug, FR-65..FR-69); this release
ships the library-side scaffold (categories + `tracing-log` bridge
+ FR-66 instrumentation across session/auth/resolver/proxy
modules) and the Gitway-side flag wiring (FR-65, FR-67, FR-68,
FR-69) lands in M15.4 + M15.5 against this 0.6.0.

Highlights (full text in CHANGELOG.md):

- new public module `anvil_ssh::log` with category constants
  (CAT_KEX, CAT_AUTH, CAT_CHANNEL, CAT_CONFIG) and the
  `install_log_bridge()` entry point that wraps
  `tracing_log::LogTracer::init()`;
- structured `tracing::*!` events across the host-key /
  authentication / ssh_config-resolution / proxy-jump paths.
  Every applied `~/.ssh/config` directive emits a
  `(file, line, directive, value)` event under CAT_CONFIG;
  every check_server_key outcome emits a same-shaped
  `{host, fp, verdict, ...}` event under CAT_KEX/CAT_AUTH so
  JSONL consumers can group/count;
- `log::*!` call sites preserved verbatim — the bridge funnels
  them through the consumer's tracing subscriber so M15.4 sees
  one event stream regardless of macro flavor.

Anvil does NOT install a subscriber — that policy belongs to
the consumer (Gitway CLI in M15.4).  The bridge stays in place
permanently for russh and other reverse-deps that stay on `log`.

Public-API additions only.  Existing `log::*!` consumers keep
working unchanged.

Lib tests: 207 passed, 5 ignored (pre-existing).
Integration tests: 4 (test_known_hosts_cert.rs).

Plan: M15.3 of anvil-gitway-milestone-plan.md.  Stacked after
M15.1 (#19), M15.2 (#20), both merged to main.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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