Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat: add explicit skip reasons to ingest results
riley02271ad8c7d437a4
diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.tsindex 6a4b0230..0ac46e19 100644--- a/ix-cli/src/cli/commands/ingest.ts+++ b/ix-cli/src/cli/commands/ingest.ts@@ -1,4 +1,5 @@import type { Command } from "commander";+import chalk from "chalk";import { IxClient } from "../../client/api.js";import { getEndpoint } from "../config.js";@@ -16,11 +17,26 @@ export function registerIngestCommand(program: Command): void {if (opts.format === "json") {console.log(JSON.stringify({ ...result, elapsedSeconds: parseFloat(elapsed) }, null, 2));} else {- console.log(`Ingested: ${result.filesProcessed} files, ${result.patchesApplied} patches applied (${elapsed}s)`);- if (result.filesSkipped) {- console.log(`Skipped: ${result.filesSkipped} unchanged files`);+ console.log(chalk.bold("\nIngest summary"));+ console.log(` processed: ${result.patchesApplied} files (${elapsed}s)`);+ console.log(` discovered: ${result.filesProcessed} files`);+ if (result.skipReasons) {+ const sr = result.skipReasons;+ if (sr.unchanged > 0) console.log(` ${chalk.dim("skipped unchanged:")} ${sr.unchanged}`);+ if (sr.emptyFile > 0) console.log(` ${chalk.dim("skipped empty:")} ${sr.emptyFile}`);+ if (sr.parseError > 0) console.log(` ${chalk.red("parse errors:")} ${sr.parseError}`);+ } else if (result.filesSkipped) {+ console.log(` ${chalk.dim("skipped:")} ${result.filesSkipped} unchanged files`);}- console.log(`Rev: ${result.latestRev}`);+ console.log(` rev: ${result.latestRev}`);++ if (result.patchesApplied === 0 && result.filesProcessed === 0) {+ console.log(chalk.yellow("\n ⚠ No files ingested. The path may be outside the project root,"));+ console.log(chalk.yellow(" contain no supported file types, or not exist."));+ } else if (result.patchesApplied === 0 && result.filesProcessed > 0) {+ console.log(chalk.dim("\n All files unchanged since last ingest."));+ }+ console.log();}});}diff --git a/ix-cli/src/client/types.ts b/ix-cli/src/client/types.tsindex e18e1a2b..10fd41b7 100644--- a/ix-cli/src/client/types.ts+++ b/ix-cli/src/client/types.ts@@ -131,12 +131,19 @@ export interface PatchSummary {timestamp?: string;}+export interface SkipReasons {+ unchanged: number;+ emptyFile: number;+ parseError: number;+}+export interface IngestResult {filesProcessed: number;patchesApplied: number;filesSkipped?: number;entitiesCreated: number;latestRev: number;+ skipReasons?: SkipReasons;}export interface HealthResponse {diff --git a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala b/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scalaindex e9a62fa3..f4c66272 100644--- a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala+++ b/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala@@ -18,7 +18,15 @@ object IngestRequest {implicit val encoder: Encoder[IngestRequest] = deriveEncoder[IngestRequest]}-case class IngestResponse(filesProcessed: Int, patchesApplied: Int, filesSkipped: Int, entitiesCreated: Int, latestRev: Long)+case class SkipReasonsResponse(unchanged: Int, emptyFile: Int, parseError: Int)++object SkipReasonsResponse {+ implicit val encoder: Encoder[SkipReasonsResponse] = deriveEncoder[SkipReasonsResponse]+ implicit val decoder: Decoder[SkipReasonsResponse] = deriveDecoder[SkipReasonsResponse]+}++case class IngestResponse(filesProcessed: Int, patchesApplied: Int, filesSkipped: Int,+ entitiesCreated: Int, latestRev: Long, skipReasons: SkipReasonsResponse)object IngestResponse {implicit val encoder: Encoder[IngestResponse] = deriveEncoder[IngestResponse]@@ -41,7 +49,12 @@ class IngestionRoutes(ingestionService: IngestionService, bulkIngestionService:patchesApplied = result.patchesApplied,filesSkipped = result.filesSkipped,entitiesCreated = result.entitiesCreated,- latestRev = result.latestRev.value+ latestRev = result.latestRev.value,+ skipReasons = SkipReasonsResponse(+ result.skipReasons.unchanged,+ result.skipReasons.emptyFile,+ result.skipReasons.parseError+ )))} yield resp).handleErrorWith(ErrorHandler.handle(_))}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scala b/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scalaindex 44c93dcb..f863e2ca 100644--- a/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scala+++ b/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scala@@ -11,6 +11,10 @@ import io.circe.syntax._import ix.memory.db.{BulkWriteApi, CommitResult, CommitStatus, FileBatch, GraphQueryApi}import ix.memory.model._+private[ingestion] sealed trait ParseOutcome+private[ingestion] case class Parsed(batch: FileBatch) extends ParseOutcome+private[ingestion] case class Skipped(reason: String) extends ParseOutcome+/*** High-performance ingestion service that:* 1. Discovers files (with optional language filter)@@ -41,11 +45,11 @@ class BulkIngestionService(batches <- files.parTraverseN(parallelism) { f =>parseFile(f, hashMap).attempt}- validBatches = batches.collect { case Right(Some(b)) => b }- skippedCount = batches.count {- case Right(None) => true- case _ => false- }+ validBatches = batches.collect { case Right(Parsed(b)) => b }+ unchangedCount = batches.count { case Right(Skipped("unchanged")) => true; case _ => false }+ emptyCount = batches.count { case Right(Skipped("emptyFile")) => true; case _ => false }+ errorCount = batches.count { case Left(_) => true; case _ => false }+ skippedCount = unchangedCount + emptyCount + errorCountlatestRev <- queryApi.getLatestRevresult <- if (validBatches.isEmpty) IO.pure(CommitResult(latestRev, CommitStatus.Ok))else bulkWriteApi.commitBatch(validBatches.toVector, latestRev.value)@@ -54,22 +58,23 @@ class BulkIngestionService(patchesApplied = validBatches.size,filesSkipped = skippedCount,entitiesCreated = validBatches.flatMap(_.patch.ops.collect { case _: PatchOp.UpsertNode => 1 }).size,- latestRev = result.newRev+ latestRev = result.newRev,+ skipReasons = SkipReasons(unchanged = unchangedCount, emptyFile = emptyCount, parseError = errorCount))}/*** Parse a single file into a FileBatch (or None if unchanged).*/- private def parseFile(filePath: Path, hashMap: Map[String, String]): IO[Option[FileBatch]] = {+ private def parseFile(filePath: Path, hashMap: Map[String, String]): IO[ParseOutcome] = {for {bytes <- IO.blocking(Files.readAllBytes(filePath))- result <- if (bytes.isEmpty) IO.pure(None)+ result <- if (bytes.isEmpty) IO.pure(Skipped("emptyFile"): ParseOutcome)else {val hash = sha256Bytes(bytes)hashMap.get(filePath.toString) match {case Some(existingHash) if existingHash == hash =>- IO.pure(None)+ IO.pure(Skipped("unchanged"): ParseOutcome)case _ =>for {source <- IO.blocking {@@ -84,7 +89,7 @@ class BulkIngestionService(patch = GraphPatchBuilder.build(filePath.toString, Some(hash), parseResult)_ <- IO.fromEither(PatchValidator.validate(patch).left.map(msg => new IllegalStateException(msg)))provenance = buildProvenanceMap(patch)- } yield Some(FileBatch(filePath.toString, Some(hash), patch, provenance))+ } yield Parsed(FileBatch(filePath.toString, Some(hash), patch, provenance)): ParseOutcome}}} yield resultdiff --git a/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scala b/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scalaindex 710fff1c..49dce4f8 100644--- a/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scala+++ b/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scala@@ -185,10 +185,17 @@ class IngestionService(parserRouter: ParserRouter, writeApi: GraphWriteApi, quer}}+case class SkipReasons(+ unchanged: Int = 0,+ emptyFile: Int = 0,+ parseError: Int = 0+)+case class IngestionResult(filesProcessed: Int,patchesApplied: Int,filesSkipped: Int,entitiesCreated: Int,- latestRev: Rev+ latestRev: Rev,+ skipReasons: SkipReasons = SkipReasons())