feat(ingestion): Mark entities dirty on ingest for document regeneration
Integrates the dirty tracking system into all four ingestion paths (issues, MRs, issue discussions, MR discussions). After each entity is upserted within its transaction, a corresponding dirty_queue entry is inserted so the document regenerator knows which documents need rebuilding. This ensures that document generation stays transactionally consistent with data changes: if the ingest transaction rolls back, the dirty marker rolls back too, preventing stale document regeneration attempts. Also updates GiError references to LoreError in these files as part of the codebase-wide rename, and adjusts issue discussion logging from info to debug level to reduce noise during normal sync runs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,11 @@ use rusqlite::{Connection, Transaction};
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
use crate::Config;
|
||||
use crate::core::error::{GiError, Result};
|
||||
use crate::core::error::{LoreError, Result};
|
||||
use crate::core::payloads::{StorePayloadOptions, store_payload};
|
||||
use crate::core::time::now_ms;
|
||||
use crate::documents::SourceType;
|
||||
use crate::ingestion::dirty_tracker;
|
||||
use crate::gitlab::GitLabClient;
|
||||
use crate::gitlab::transformers::{MilestoneRow, transform_issue};
|
||||
use crate::gitlab::types::GitLabIssue;
|
||||
@@ -297,6 +299,9 @@ fn process_issue_in_transaction(
|
||||
|row| row.get(0),
|
||||
)?;
|
||||
|
||||
// Mark dirty for document regeneration (inside transaction)
|
||||
dirty_tracker::mark_dirty_tx(tx, SourceType::Issue, local_issue_id)?;
|
||||
|
||||
// Clear existing label links (stale removal)
|
||||
tx.execute(
|
||||
"DELETE FROM issue_labels WHERE issue_id = ?",
|
||||
@@ -470,7 +475,7 @@ fn get_issues_needing_discussion_sync(
|
||||
fn parse_timestamp(ts: &str) -> Result<i64> {
|
||||
chrono::DateTime::parse_from_rfc3339(ts)
|
||||
.map(|dt| dt.timestamp_millis())
|
||||
.map_err(|e| GiError::Other(format!("Failed to parse timestamp '{}': {}", ts, e)))
|
||||
.map_err(|e| LoreError::Other(format!("Failed to parse timestamp '{}': {}", ts, e)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user