From 50b5cbd226e7dc1a49867136b16fe24364476759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 11 May 2026 20:20:09 +0200 Subject: [PATCH] catalog-backend: remove redundant direct-duplicate-insert test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'silently rejects a direct duplicate insert' test inserted a row via raw Knex onConflict().ignore(), which has no corresponding production code path (syncSearchRows uses ON CONFLICT DO UPDATE, not DO NOTHING). The idempotency behaviour it was intended to verify is already covered by 'leaves unchanged rows untouched'. Signed-off-by: Fredrik Adelöw Co-authored-by: Cursor --- .../stitcher/syncSearchRows.test.ts | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts index 6981af177b..5a46608e7d 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts @@ -225,26 +225,6 @@ describe.each(databases.eachSupportedId())('syncSearchRows, %p', databaseId => { expect(rows.map(r => r.value).sort()).toEqual(['java', 'python', 'rust']); }); - it('silently rejects a direct duplicate insert via the UNIQUE constraint', async () => { - await syncSearchRows(knex, 'e1', [row('a', 'x'), row('b', 'y')]); - - // Simulate a concurrent process inserting a duplicate directly — - // the UNIQUE constraint on (entity_id, key, value) should reject it - // silently. ON CONFLICT without a column list covers any unique - // constraint on the table, which is safe since (entity_id, key, value) - // is the only one. - await knex('search') - .insert({ entity_id: 'e1', key: 'a', value: 'x', original_value: 'x' }) - .onConflict() - .ignore(); - - const rows = await getSearchRows(); - expect(rows).toHaveLength(2); - expect(rows.find(r => r.key === 'a')).toEqual( - expect.objectContaining({ key: 'a', value: 'x' }), - ); - }); - it('restores original_value when re-syncing after it was corrupted', async () => { await syncSearchRows(knex, 'e1', [row('a', 'x', 'X')]);