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
+7
View File
@@ -19,6 +19,8 @@ use std::fs;
use std::io::Write as _;
use std::path::{Path, PathBuf};
use tracing::debug;
use crate::dsl::action::ReferentialAction;
use crate::dsl::types::Type;
use crate::mode::Mode;
@@ -338,6 +340,7 @@ impl Persistence {
/// renames over the destination.
pub fn write_schema(&self, schema: &SchemaSnapshot) -> Result<(), PersistenceError> {
let body = yaml::serialize_schema(schema);
debug!(bytes = body.len(), "persist: write project.yaml (atomic)");
atomic_write(&self.project_path.join(PROJECT_YAML), body.as_bytes())
}
@@ -355,8 +358,10 @@ impl Persistence {
/// with files they didn't ask for.
pub fn write_table_data(&self, table: &TableSnapshot) -> Result<(), PersistenceError> {
if table.rows.is_empty() {
debug!(table = %table.name, "persist: table empty -> removing CSV (no data, no CSV)");
return self.delete_table_data(&table.name);
}
debug!(table = %table.name, rows = table.rows.len(), "persist: write data/<table>.csv (atomic)");
let data_dir = self.project_path.join(DATA_DIR);
fs::create_dir_all(&data_dir).map_err(|source| PersistenceError::Io {
operation: "create",
@@ -394,6 +399,7 @@ impl Persistence {
pub fn append_history(&self, command_text: &str) -> Result<(), PersistenceError> {
let path = self.project_path.join(HISTORY_LOG);
let line = history::format_record(command_text, history::utc_iso8601_now());
debug!(len = command_text.len(), "persist: append ok record to history.log");
history::append(&path, &line)
}
@@ -411,6 +417,7 @@ impl Persistence {
history::utc_iso8601_now(),
history::STATUS_ERR,
);
debug!(len = command_text.len(), "persist: append err record to history.log");
history::append(&path, &line)
}