feat(kebab-core): p9-fb-23 task 1 — IngestItemKind::Unchanged + IngestReport.unchanged

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-04 17:43:52 +00:00
parent 6a8d155da9
commit aa2a6ea7fc
5 changed files with 29 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ pub struct AggregateCounts {
pub new: u32,
pub updated: u32,
pub skipped: u32,
/// p9-fb-23: assets whose checksum + all version inputs matched the
/// existing DB record — parse / chunk / embed / vector upsert all
/// skipped.
pub unchanged: u32,
pub errors: u32,
pub chunks_indexed: u32,
pub embeddings_indexed: u32,

View File

@@ -347,6 +347,7 @@ pub fn ingest_with_config_cancellable(
let mut new_count: u32 = 0;
let mut updated_count: u32 = 0;
let mut skipped_count: u32 = 0;
let mut unchanged_count: u32 = 0;
let mut error_count: u32 = 0;
// Aggregate counts surfaced into `ingest_runs` (and tracing). Not
// exposed on `IngestReport` today — `kebab_core::IngestReport` is a
@@ -445,6 +446,9 @@ pub fn ingest_with_config_cancellable(
kebab_core::IngestItemKind::Skipped => {
skipped_count = skipped_count.saturating_add(1)
}
kebab_core::IngestItemKind::Unchanged => {
unchanged_count = unchanged_count.saturating_add(1)
}
kebab_core::IngestItemKind::Error => {
error_count = error_count.saturating_add(1)
}
@@ -585,6 +589,7 @@ pub fn ingest_with_config_cancellable(
new: new_count,
updated: updated_count,
skipped: skipped_count,
unchanged: unchanged_count,
errors: error_count,
chunks_indexed,
embeddings_indexed,
@@ -626,6 +631,7 @@ pub fn ingest_with_config_cancellable(
new: new_count,
updated: updated_count,
skipped: skipped_count,
unchanged: unchanged_count,
errors: error_count,
duration_ms,
items: if summary_only { None } else { Some(items) },

View File

@@ -13,7 +13,11 @@ pub struct IngestReport {
pub scanned: u32,
pub new: u32,
pub updated: u32,
/// Media-type / source filter (`kb://`, unsupported types).
pub skipped: u32,
/// p9-fb-23: assets whose checksum + all version inputs matched —
/// parse / chunk / embed / vector upsert all skipped.
pub unchanged: u32,
pub errors: u32,
pub duration_ms: u32,
/// `None` ↔ wire `items: null` (`--summary-only`).
@@ -40,6 +44,12 @@ pub struct IngestItem {
pub enum IngestItemKind {
New,
Updated,
/// Media-type filter / kb:// URI / non-supported source — never made
/// it into the parse step.
Skipped,
/// p9-fb-23: blake3 checksum + parser_version + chunker_version +
/// embedding_version all matched the existing record. Parse / chunk
/// / embed / vector upsert all skipped.
Unchanged,
Error,
}

View File

@@ -131,6 +131,9 @@ fn apply_event(state: &mut IngestState, event: IngestEvent) {
kebab_core::IngestItemKind::Skipped => {
state.counts.skipped = state.counts.skipped.saturating_add(1);
}
kebab_core::IngestItemKind::Unchanged => {
state.counts.unchanged = state.counts.unchanged.saturating_add(1);
}
kebab_core::IngestItemKind::Error => {
state.counts.errors = state.counts.errors.saturating_add(1);
}

View File

@@ -11,6 +11,7 @@
"new",
"updated",
"skipped",
"unchanged",
"errors",
"duration_ms"
],
@@ -21,6 +22,11 @@
"new": { "type": "integer", "minimum": 0 },
"updated": { "type": "integer", "minimum": 0 },
"skipped": { "type": "integer", "minimum": 0 },
"unchanged": {
"type": "integer",
"minimum": 0,
"description": "p9-fb-23: assets whose checksum + parser_version + chunker_version + embedding_version all matched the existing record. Parse / chunk / embed / vector upsert all skipped."
},
"errors": { "type": "integer", "minimum": 0 },
"duration_ms": { "type": "integer", "minimum": 0 },
"items": { "type": ["array", "null"] }