catalog-backend: remove redundant direct-duplicate-insert test

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 <freben@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fredrik Adelöw
2026-05-11 20:20:09 +02:00
parent cdf38bd8db
commit 50b5cbd226
@@ -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<DbSearchRow>('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')]);