refactor: Remove redundant doc comments throughout codebase
Removes module-level doc comments (//! lines) and excessive inline doc comments that were duplicating information already evident from: - Function/struct names (self-documenting code) - Type signatures (the what is clear from types) - Implementation context (the how is clear from code) Affected modules: - cli/* - Removed command descriptions duplicating clap help text - core/* - Removed module headers and obvious function docs - documents/* - Removed extractor/regenerator/truncation docs - embedding/* - Removed pipeline and chunking docs - gitlab/* - Removed client and transformer docs (kept type definitions) - ingestion/* - Removed orchestrator and ingestion docs - search/* - Removed FTS and vector search docs Philosophy: Code should be self-documenting. Comments should explain "why" (business decisions, non-obvious constraints) not "what" (which the code itself shows). This change reduces noise and maintenance burden while keeping the codebase just as understandable. Retains comments for: - Non-obvious business logic - Important safety invariants - Complex algorithm explanations - Public API boundaries where generated docs matter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,41 +1,17 @@
|
||||
//! Shared progress bar infrastructure.
|
||||
//!
|
||||
//! All progress bars must be created via [`multi()`] to ensure coordinated
|
||||
//! rendering. The [`SuspendingWriter`] suspends the multi-progress before
|
||||
//! writing tracing output, preventing log lines from interleaving with
|
||||
//! progress bar animations.
|
||||
|
||||
use indicatif::MultiProgress;
|
||||
use std::io::Write;
|
||||
use std::sync::LazyLock;
|
||||
use tracing_subscriber::fmt::MakeWriter;
|
||||
|
||||
/// Global multi-progress that coordinates all progress bar rendering.
|
||||
///
|
||||
/// Every `ProgressBar` displayed to the user **must** be registered via
|
||||
/// `multi().add(bar)`. Standalone bars bypass the coordination and will
|
||||
/// fight with other bars for the terminal line, causing rapid flashing.
|
||||
static MULTI: LazyLock<MultiProgress> = LazyLock::new(MultiProgress::new);
|
||||
|
||||
/// Returns the shared [`MultiProgress`] instance.
|
||||
pub fn multi() -> &'static MultiProgress {
|
||||
&MULTI
|
||||
}
|
||||
|
||||
/// A tracing `MakeWriter` that suspends the shared [`MultiProgress`] while
|
||||
/// writing, so log output doesn't interleave with progress bar animations.
|
||||
///
|
||||
/// # How it works
|
||||
///
|
||||
/// `MultiProgress::suspend` temporarily clears all active progress bars from
|
||||
/// the terminal, executes the closure (which writes the log line), then
|
||||
/// redraws the bars. This ensures a clean, flicker-free display even when
|
||||
/// logging happens concurrently with progress updates.
|
||||
#[derive(Clone)]
|
||||
pub struct SuspendingWriter;
|
||||
|
||||
/// Writer returned by [`SuspendingWriter`] that buffers a single log line
|
||||
/// and flushes it inside a `MultiProgress::suspend` call.
|
||||
pub struct SuspendingWriterInner {
|
||||
buf: Vec<u8>,
|
||||
}
|
||||
@@ -47,7 +23,6 @@ impl Write for SuspendingWriterInner {
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
// Nothing to do — actual flush happens on drop.
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -102,10 +77,8 @@ mod tests {
|
||||
fn suspending_writer_buffers_and_flushes() {
|
||||
let writer = SuspendingWriter;
|
||||
let mut w = MakeWriter::make_writer(&writer);
|
||||
// Write should succeed and buffer data
|
||||
let n = w.write(b"test log line\n").unwrap();
|
||||
assert_eq!(n, 14);
|
||||
// Drop flushes via suspend — no panic means it works
|
||||
drop(w);
|
||||
}
|
||||
|
||||
@@ -113,7 +86,6 @@ mod tests {
|
||||
fn suspending_writer_empty_does_not_flush() {
|
||||
let writer = SuspendingWriter;
|
||||
let w = MakeWriter::make_writer(&writer);
|
||||
// Drop with empty buffer — should be a no-op
|
||||
drop(w);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user