fix(app): log hub masks dotted tokens, keeps worker errors and drops the oldest lines by time

- redact: a token with sentence dots around it is masked too.
- Worker error messages are always logged (code and id), so the log screen
  and the error report show them without debug logging.
- The voice worker logs with stt, llm and tts categories, so its lines land
  in those tabs.
- The zip leaves out the oldest lines by the time they were logged, across
  every tab's file, not by file name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 13:43:01 +09:00
parent 390f6f0b86
commit eb0fa2f159
13 changed files with 143 additions and 37 deletions

View File

@@ -210,6 +210,25 @@ async fn a_refused_tts_request_ends_as_failed() {
c.close();
}
#[tokio::test]
async fn a_worker_error_reaches_the_log_hub_without_debug_logging() {
assert_ne!(std::env::var("JARVIS_DEBUG").as_deref(), Ok("1"), "run without debug logging");
let hub = jarvis_app::logs::LogHub::new(None);
jarvis_app::logs::install(hub.clone());
let hub = jarvis_app::logs::installed().unwrap();
let w = FakeWorker::start(0).await;
let (c, mut rx) = client(&w.url(), json!({}));
c.start();
c.wait_ready(Duration::from_secs(2)).await.unwrap();
w.send(Message::text(json!({"type": "error", "code": "tts_failed", "message": "engine broke", "id": "r7"}).to_string()));
next_matching(&mut rx, |e| matches!(e, WorkerEvent::Error(_))).await;
let errors = hub.query(Some("worker"), jarvis_app::logs::Level::Error, Some("tts_failed"), None, 10);
assert_eq!(errors.len(), 1, "{errors:?}");
assert!(errors[0].text.contains("r7"));
assert!(hub.recent_error_report("test").unwrap().contains("tts_failed"));
c.close();
}
#[tokio::test]
async fn reconnects_after_a_restart_and_fails_the_tts_in_flight() {
let w = FakeWorker::start(0).await;