review(회차1): nit 3건 — 의도 문서화 (best-effort IO 의도 + bar invariant + display join)

회차 1 actionable 모두 동작 변경 없음, 의도 명시.

- progress.rs handle_human: doc-comment 한 단락 — `let _ = writeln!`
  의 IO error swallow 와 `bar.as_ref()` None 분기 silent skip 의
  두 best-effort 의도 + §2.4a ordering invariant (ScanStarted 가
  bar 를 lazy 초기화) 명시.
- main.rs Cmd::Ingest: `let _ = display_handle.join();` 위에 한 줄
  trailing comment — Result<Result<(), anyhow::Error>, Box<dyn Any>>
  를 모두 discard 하는 이유 (display thread 의 에러 / panic 이
  ingest exit code 에 영향 없어야 함).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 20:00:54 +00:00
parent e613236d60
commit 1a8fd08f6c
2 changed files with 12 additions and 0 deletions

View File

@@ -306,6 +306,9 @@ fn run(cli: &Cli) -> anyhow::Result<()> {
// Join the display thread *before* surfacing the ingest
// outcome so the spinner / final newline is flushed
// regardless of whether ingest returned Ok or Err.
// join() returns Result<Result<(), anyhow::Error>, Box<dyn Any>>;
// we discard both — display thread errors / panics are
// best-effort and must not change ingest's exit code.
let _ = display_handle.join();
let report = ingest_result?;

View File

@@ -87,6 +87,15 @@ impl ProgressDisplay {
}
}
/// Render an event in human mode. **Best-effort**: every
/// `writeln!` into stderr swallows IO errors (`let _ = ...`)
/// because the progress display must not fail the ingest run if
/// the terminal is closed mid-stream. Likewise the
/// `self.bar.as_ref()` / `as_mut()` branches treat a missing
/// bar as silent skip — the bar is initialized lazily in the
/// `ScanStarted` arm and §2.4a's ordering invariant
/// (`ScanStarted` < everything else) guarantees it is `Some` by
/// the time later events arrive.
fn handle_human(&mut self, event: &IngestEvent, tty: bool) -> anyhow::Result<()> {
match event {
IngestEvent::ScanStarted { root } => {