feat: comprehensive logging across parser, app, persistence, runtime (X1)

Completes the X1 full sweep started in a8ad0c6 (db.rs). Closes X1 -> [x].

- persistence/mod.rs: debug! on every yaml/CSV/history write -- the
  silent-failure-prone disk paths (write_schema, write_table_data incl.
  the empty->delete branch, append_history/_failure).
- runtime.rs: debug! on execute_command_typed dispatch (one per executed
  command, complements the db.rs executor logs).
- app.rs: debug! on submit (route + submission mode), dispatch_app_command,
  and the ADR-0044 diagram-vs-prose render-mode choice.
- dsl/parser.rs: trace! on parse begin/outcome at the parse_command_inner
  choke point -- trace, not debug, because the live overlay/completion
  re-parse per keystroke (hot path).
- logging.rs: documented level discipline (error/warn/info/debug/trace) so
  the convention survives across sessions.

Levels verified end-to-end through the real worker thread + logging::init.
~75 -> 135 tracing sites total. Tests: 2207 pass / 0 fail / 1 ignored.
Clippy clean.
This commit is contained in:
claude@clouddev1
2026-06-10 11:38:22 +00:00
parent a8ad0c6cc3
commit 0a7612efe2
6 changed files with 87 additions and 12 deletions
+19 -3
View File
@@ -12,6 +12,8 @@
//! synthetic "unknown command" error when the input's first
//! identifier-shape token isn't a registered entry word.
use tracing::trace;
use crate::dsl::command::Command;
use crate::mode::Mode;
@@ -150,13 +152,27 @@ fn parse_command_inner(
schema: Option<&crate::completion::SchemaCache>,
mode: Mode,
) -> Result<Command, ParseError> {
// `trace`, not `debug`: parsing is a hot path — the live overlay /
// completion (completion.rs) re-parse per keystroke, probing
// candidates in a loop, so a per-parse `debug` line would flood. The
// executed-command story lives at `debug` in db.rs (one per submit).
trace!(
len = input.len(),
mode = ?mode,
schema_aware = schema.is_some(),
"parse: begin"
);
if input.trim().is_empty() {
trace!("parse: empty input");
return Err(ParseError::Empty);
}
if let Some(result) = try_walker_route(input, schema, mode) {
return result;
let result =
try_walker_route(input, schema, mode).unwrap_or_else(|| Err(unknown_command_error(input)));
match &result {
Ok(cmd) => trace!(command = cmd.verb(), "parse: ok"),
Err(e) => trace!(error = %e, "parse: rejected"),
}
Err(unknown_command_error(input))
result
}
/// Synthetic ParseError for inputs whose first identifier-shape