rouse-context/core
Jason Monk 793091b8b5 Fix #146: Replace message-prefix log routing with typed LogLevel lambda
AppModule was routing `Log.e` vs `Log.w` vs `Log.i` by string-matching
message prefixes ("Audit:", "TunnelClient: disconnected:"). Severity is
known at the call site, not at wiring. Renaming a log string silently
downgraded severity, and "frame arrived after disconnect" landed as WARN
despite the spec calling for DEBUG.

Introduce `LogLevel { DEBUG, INFO, WARN, ERROR }` in both `:core:mcp` and
`:core:tunnel` (duplicated to avoid a cross-module dependency on a
four-value enum). Change `log: (String) -> Unit` to
`log: (LogLevel, String) -> Unit` on `ConnectionStateMachine`,
`TunnelClientImpl`, `MuxDemux`, `configureMcpRouting`, `McpSession`, and
the audit-emission helpers. Each call site declares its own severity.

AppModule's lambda becomes a simple `when (level)` switch onto
`android.util.Log`. The emitted log tags and severities are unchanged
for existing events; "frame arrived after disconnect" now correctly
lands at DEBUG.

Tests capture `Pair<LogLevel, String>` and assert the expected level.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 19:57:27 -04:00
..
bridge Replace remaining fully qualified names with imports in production code 2026-04-14 16:06:27 -04:00
mcp Fix #146: Replace message-prefix log routing with typed LogLevel lambda 2026-04-14 19:57:27 -04:00
tunnel Fix #146: Replace message-prefix log routing with typed LogLevel lambda 2026-04-14 19:57:27 -04:00