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:
Taylor Eernisse
2026-02-05 00:04:32 -05:00
parent 976ad92ef0
commit 65583ed5d6
57 changed files with 143 additions and 1693 deletions

View File

@@ -1,10 +1,8 @@
//! Sync command: unified orchestrator for ingest -> generate-docs -> embed.
use console::style;
use indicatif::{ProgressBar, ProgressStyle};
use serde::Serialize;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use tracing::Instrument;
use tracing::{info, warn};
@@ -16,7 +14,6 @@ use super::embed::run_embed;
use super::generate_docs::run_generate_docs;
use super::ingest::{IngestDisplay, run_ingest};
/// Options for the sync command.
#[derive(Debug, Default)]
pub struct SyncOptions {
pub full: bool,
@@ -27,7 +24,6 @@ pub struct SyncOptions {
pub robot_mode: bool,
}
/// Result of the sync command.
#[derive(Debug, Default, Serialize)]
pub struct SyncResult {
#[serde(skip)]
@@ -41,10 +37,6 @@ pub struct SyncResult {
pub documents_embedded: usize,
}
/// Create a styled spinner for a sync stage.
///
/// Uses `{prefix}` for the `[N/M]` stage label so callers can update `{msg}`
/// independently without losing the stage context.
fn stage_spinner(stage: u8, total: u8, msg: &str, robot_mode: bool) -> ProgressBar {
if robot_mode {
return ProgressBar::hidden();
@@ -61,11 +53,6 @@ fn stage_spinner(stage: u8, total: u8, msg: &str, robot_mode: bool) -> ProgressB
pb
}
/// Run the full sync pipeline: ingest -> generate-docs -> embed.
///
/// `run_id` is an optional correlation ID for log/metrics tracing.
/// When called from `handle_sync_cmd`, this should be the same ID
/// stored in the `sync_runs` table so logs and DB records correlate.
pub async fn run_sync(
config: &Config,
options: SyncOptions,
@@ -102,7 +89,6 @@ pub async fn run_sync(
};
let mut current_stage: u8 = 0;
// Stage 1: Ingest issues
current_stage += 1;
let spinner = stage_spinner(
current_stage,
@@ -127,7 +113,6 @@ pub async fn run_sync(
result.resource_events_failed += issues_result.resource_events_failed;
spinner.finish_and_clear();
// Stage 2: Ingest MRs
current_stage += 1;
let spinner = stage_spinner(
current_stage,
@@ -152,7 +137,6 @@ pub async fn run_sync(
result.resource_events_failed += mrs_result.resource_events_failed;
spinner.finish_and_clear();
// Stage 3: Generate documents (unless --no-docs)
if !options.no_docs {
current_stage += 1;
let spinner = stage_spinner(
@@ -163,7 +147,6 @@ pub async fn run_sync(
);
info!("Sync stage {current_stage}/{total_stages}: generating documents");
// Create a dedicated progress bar matching the ingest stage style
let docs_bar = if options.robot_mode {
ProgressBar::hidden()
} else {
@@ -186,8 +169,6 @@ pub async fn run_sync(
if !tick_started_clone.swap(true, Ordering::Relaxed) {
docs_bar_clone.enable_steady_tick(std::time::Duration::from_millis(100));
}
// Update length every callback — the regenerator's estimated_total
// can grow if new dirty items are queued during processing.
docs_bar_clone.set_length(total as u64);
docs_bar_clone.set_position(processed as u64);
}
@@ -200,7 +181,6 @@ pub async fn run_sync(
info!("Sync: skipping document generation (--no-docs)");
}
// Stage 4: Embed documents (unless --no-embed)
if !options.no_embed {
current_stage += 1;
let spinner = stage_spinner(
@@ -211,7 +191,6 @@ pub async fn run_sync(
);
info!("Sync stage {current_stage}/{total_stages}: embedding documents");
// Create a dedicated progress bar matching the ingest stage style
let embed_bar = if options.robot_mode {
ProgressBar::hidden()
} else {
@@ -245,7 +224,6 @@ pub async fn run_sync(
spinner.finish_and_clear();
}
Err(e) => {
// Graceful degradation: Ollama down is a warning, not an error
embed_bar.finish_and_clear();
spinner.finish_and_clear();
if !options.robot_mode {
@@ -275,7 +253,6 @@ pub async fn run_sync(
.await
}
/// Print human-readable sync summary.
pub fn print_sync(
result: &SyncResult,
elapsed: std::time::Duration,
@@ -307,7 +284,6 @@ pub fn print_sync(
println!(" Documents embedded: {}", result.documents_embedded);
println!(" Elapsed: {:.1}s", elapsed.as_secs_f64());
// Print per-stage timing breakdown if metrics are available
if let Some(metrics) = metrics {
let stages = metrics.extract_timings();
if !stages.is_empty() {
@@ -316,7 +292,6 @@ pub fn print_sync(
}
}
/// Print per-stage timing breakdown for interactive users.
fn print_timing_summary(stages: &[StageTiming]) {
println!();
println!("{}", style("Stage timing:").dim());
@@ -327,7 +302,6 @@ fn print_timing_summary(stages: &[StageTiming]) {
}
}
/// Print a single stage timing line with indentation.
fn print_stage_line(stage: &StageTiming, depth: usize) {
let indent = " ".repeat(depth);
let name = if let Some(ref project) = stage.project {
@@ -367,7 +341,6 @@ fn print_stage_line(stage: &StageTiming, depth: usize) {
}
}
/// JSON output for sync.
#[derive(Serialize)]
struct SyncJsonOutput<'a> {
ok: bool,
@@ -383,7 +356,6 @@ struct SyncMeta {
stages: Vec<StageTiming>,
}
/// Print JSON robot-mode sync output with optional metrics.
pub fn print_sync_json(result: &SyncResult, elapsed_ms: u64, metrics: Option<&MetricsLayer>) {
let stages = metrics.map_or_else(Vec::new, MetricsLayer::extract_timings);
let output = SyncJsonOutput {