From 183cc90e07dda4bdd12e8af2c71f65524973e1a0 Mon Sep 17 00:00:00 2001 From: Jonathan Tsai Date: Fri, 27 Mar 2026 15:49:44 +0800 Subject: [PATCH 1/3] ci: add Node 24 to matrix and remove redundant verify job --- .github/workflows/ci.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aa0728..b3e4366 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,31 +66,12 @@ jobs: sarif_file: 'semgrep.sarif' category: 'sast-semgrep' - verify: - if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') - runs-on: ubuntu-latest - env: - COMPOSE_FILE: docker-compose.ci.yml - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Build and start containers - run: docker compose build --no-cache && docker compose up -d - - - name: Run verify - run: docker compose exec -T app npm run verify - - - name: Tear down - if: always() - run: docker compose down -v --remove-orphans - verify-matrix: if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') strategy: fail-fast: false matrix: - node-version: ['20', '22'] + node-version: ['20', '22', '24'] runs-on: ubuntu-latest env: COMPOSE_FILE: docker-compose.ci.yml From 7aafd1c3752e34746e5cf4f3704922a1e391d7b7 Mon Sep 17 00:00:00 2001 From: Jonathan Tsai Date: Fri, 27 Mar 2026 18:51:08 +0800 Subject: [PATCH 2/3] test: add self-merge fix tests to foundation (issue #25) --- package-lock.json | 4 +- test/foundation/foundation.test.ts | 63 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 02f9a35..a5e9b32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lancedb-opencode-pro", - "version": "0.2.4", + "version": "0.2.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lancedb-opencode-pro", - "version": "0.2.4", + "version": "0.2.5", "license": "MIT", "dependencies": { "@lancedb/lancedb": "^0.27.1", diff --git a/test/foundation/foundation.test.ts b/test/foundation/foundation.test.ts index c3c1fda..3dae6c2 100644 --- a/test/foundation/foundation.test.ts +++ b/test/foundation/foundation.test.ts @@ -726,3 +726,66 @@ test("consolidateDuplicates does not merge records with very low cosine similari await cleanupDbPath(dbPath); } }); + +test("consolidateDuplicates skips self-merge when older.id === newer.id (issue #25)", async () => { + const { store, dbPath } = await createTestStore(); + try { + const scope = "project:self-merge-test"; + const testId = "ebb542a9-dfd2-4d77-aab8-cbecbe2e8998"; + const now = Date.now(); + + await store.put(createTestRecord({ + id: testId, + scope, + text: "test content", + vector: createVector(384, 0.5), + timestamp: now, + lastRecalled: 0, + metadataJson: JSON.stringify({}) + })); + + const result = await store.consolidateDuplicates(scope, 0.95); + + assert.equal(result.mergedPairs, 0, "should not merge self"); + assert.equal(result.updatedRecords, 0, "should not update any records"); + } finally { + await cleanupDbPath(dbPath); + } +}); + +test("consolidateDuplicates merges two similar records correctly after self-merge fix", async () => { + const { store, dbPath } = await createTestStore(); + try { + const scope = "project:merge-test"; + const now = Date.now(); + const sharedText = "This is a test content for duplicate detection"; + const vec = createVector(384, 0.5); + + await store.put(createTestRecord({ + id: "record-old", + scope, + text: sharedText, + vector: vec, + timestamp: now - 10_000, + lastRecalled: 0, + metadataJson: JSON.stringify({}) + })); + + await store.put(createTestRecord({ + id: "record-new", + scope, + text: sharedText, + vector: vec, + timestamp: now, + lastRecalled: 0, + metadataJson: JSON.stringify({}) + })); + + const result = await store.consolidateDuplicates(scope, 0.95); + + assert.equal(result.mergedPairs, 1, "should merge one pair"); + assert.equal(result.updatedRecords, 2, "should update both records"); + } finally { + await cleanupDbPath(dbPath); + } +}); From d8869b5af36f1323040c651b207b60dfb022a730 Mon Sep 17 00:00:00 2001 From: Jonathan Tsai Date: Fri, 27 Mar 2026 18:51:26 +0800 Subject: [PATCH 3/3] chore: bump version to 0.2.6 and update changelog --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed9cb09..94af9fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Format follows [Keep a Changelog](https://keepachangelog.com/). Versions follow --- +## [0.2.6] - 2026-03-27 + +### Fixed + +- Self-merge bug in `consolidateDuplicates`: prevent `mergedFrom` from pointing to own ID when records have identical timestamps (issue #25). + +--- + ## [0.2.5] - 2026-03-27 ### Added diff --git a/package.json b/package.json index c90832b..e1bc68e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lancedb-opencode-pro", - "version": "0.2.5", + "version": "0.2.6", "description": "LanceDB-backed long-term memory provider for OpenCode", "type": "module", "main": "dist/index.js",