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,9 +1,6 @@
|
||||
//! Merge request transformer: converts GitLabMergeRequest to local schema.
|
||||
|
||||
use crate::core::time::{iso_to_ms_opt_strict, iso_to_ms_strict, now_ms};
|
||||
use crate::gitlab::types::GitLabMergeRequest;
|
||||
|
||||
/// Local schema representation of a merge request row.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NormalizedMergeRequest {
|
||||
pub gitlab_id: i64,
|
||||
@@ -21,15 +18,14 @@ pub struct NormalizedMergeRequest {
|
||||
pub references_full: Option<String>,
|
||||
pub detailed_merge_status: Option<String>,
|
||||
pub merge_user_username: Option<String>,
|
||||
pub created_at: i64, // ms epoch UTC
|
||||
pub updated_at: i64, // ms epoch UTC
|
||||
pub merged_at: Option<i64>, // ms epoch UTC
|
||||
pub closed_at: Option<i64>, // ms epoch UTC
|
||||
pub last_seen_at: i64, // ms epoch UTC
|
||||
pub created_at: i64,
|
||||
pub updated_at: i64,
|
||||
pub merged_at: Option<i64>,
|
||||
pub closed_at: Option<i64>,
|
||||
pub last_seen_at: i64,
|
||||
pub web_url: String,
|
||||
}
|
||||
|
||||
/// Merge request bundled with extracted metadata.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MergeRequestWithMetadata {
|
||||
pub merge_request: NormalizedMergeRequest,
|
||||
@@ -38,61 +34,43 @@ pub struct MergeRequestWithMetadata {
|
||||
pub reviewer_usernames: Vec<String>,
|
||||
}
|
||||
|
||||
/// Transform a GitLab merge request into local schema format.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `gitlab_mr` - The GitLab MR API response
|
||||
/// * `local_project_id` - The local database project ID (not GitLab's project_id)
|
||||
///
|
||||
/// # Returns
|
||||
/// * `Ok(MergeRequestWithMetadata)` - Transformed MR with extracted metadata
|
||||
/// * `Err(String)` - Error message if transformation fails (e.g., invalid timestamps)
|
||||
pub fn transform_merge_request(
|
||||
gitlab_mr: &GitLabMergeRequest,
|
||||
local_project_id: i64,
|
||||
) -> Result<MergeRequestWithMetadata, String> {
|
||||
// Parse required timestamps
|
||||
let created_at = iso_to_ms_strict(&gitlab_mr.created_at)?;
|
||||
let updated_at = iso_to_ms_strict(&gitlab_mr.updated_at)?;
|
||||
|
||||
// Parse optional timestamps
|
||||
let merged_at = iso_to_ms_opt_strict(&gitlab_mr.merged_at)?;
|
||||
let closed_at = iso_to_ms_opt_strict(&gitlab_mr.closed_at)?;
|
||||
|
||||
// Draft: prefer draft, fallback to work_in_progress
|
||||
let is_draft = gitlab_mr.draft || gitlab_mr.work_in_progress;
|
||||
|
||||
// Merge status: prefer detailed_merge_status over legacy
|
||||
let detailed_merge_status = gitlab_mr
|
||||
.detailed_merge_status
|
||||
.clone()
|
||||
.or_else(|| gitlab_mr.merge_status_legacy.clone());
|
||||
|
||||
// Merge user: prefer merge_user over merged_by
|
||||
let merge_user_username = gitlab_mr
|
||||
.merge_user
|
||||
.as_ref()
|
||||
.map(|u| u.username.clone())
|
||||
.or_else(|| gitlab_mr.merged_by.as_ref().map(|u| u.username.clone()));
|
||||
|
||||
// References extraction
|
||||
let (references_short, references_full) = gitlab_mr
|
||||
.references
|
||||
.as_ref()
|
||||
.map(|r| (Some(r.short.clone()), Some(r.full.clone())))
|
||||
.unwrap_or((None, None));
|
||||
|
||||
// Head SHA
|
||||
let head_sha = gitlab_mr.sha.clone();
|
||||
|
||||
// Extract assignee usernames
|
||||
let assignee_usernames: Vec<String> = gitlab_mr
|
||||
.assignees
|
||||
.iter()
|
||||
.map(|a| a.username.clone())
|
||||
.collect();
|
||||
|
||||
// Extract reviewer usernames
|
||||
let reviewer_usernames: Vec<String> = gitlab_mr
|
||||
.reviewers
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user