memorix icon indicating copy to clipboard operation
memorix copied to clipboard

[Bug] `memorix ingest log` creates duplicate git records on repeated runs

Open FurryWolfX opened this issue 7 months ago • 1 comments

Description

Running memorix ingest log multiple times ingests the same commits repeatedly, creating duplicate git-memory records in observations.json. Each duplicate has the same commitHash, title, narrative, facts, and filesModified.

Expected Behavior

Repeated runs of memorix ingest log should skip commits that have already been ingested (same commitHash), similar to how memorix ingest commit works.

Actual Behavior

Every time memorix ingest log is executed, all commits (including previously ingested ones) are stored again, resulting in duplicate entries.

Root Cause

ingest-log.ts lacks deduplication logic, while ingest-commit.ts has it at lines 84-85:

// ingest-commit.ts ✅ Has dedup
const existingObs = await loadObservationsJson(dataDir) as Array<{ commitHash?: string }>;
if (existingObs.some(o => o.commitHash === commit.hash)) { ... }
// ingest-log.ts ❌ Missing dedup check
for (const commit of commits) {
  const result = ingestCommit(commit);
  await storeObservation({  // No check if commit.hash already exists
    ...
    commitHash: commit.hash,
  });
}

Steps to Reproduce

  1. Run memorix ingest log --count 10 in a git project
  2. Run memorix ingest log --count 10 again
  3. Observe: all 10 commits are ingested again (marked ✅), not skipped

FurryWolfX avatar Apr 04 '26 15:04 FurryWolfX

Fixed in #50 and now merged into main.\n\nThis update adds commitHash dedup to the CLI memorix ingest log path, so repeated runs now skip already-ingested commits instead of creating duplicate git-backed observations. It also aligns the CLI batch behavior with the existing single-ingest and TUI ingest flows, and adds regression tests for repeat-run / mixed-batch cases.\n\nThanks for the report — this one is now resolved.

AVIDS2 avatar Apr 04 '26 16:04 AVIDS2