@@ -120,7 +120,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
120120 RETURN NEW;
121121 END $$` )
122122 )
123- for ( const projection of [ 'embedding_search' , 'embedding_keyword_tin' ] ) {
123+ for ( const projection of [ 'embedding_search' ] ) {
124124 await db . execute (
125125 sql . raw ( `DROP TRIGGER IF EXISTS log_lease_page_projection_write ON ${ projection } ` )
126126 )
@@ -151,7 +151,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
151151 await db . execute ( sql `DROP FUNCTION IF EXISTS log_lease_page_acl_write()` )
152152 await db . execute ( sql `DROP FUNCTION IF EXISTS fail_after_acl_writes()` )
153153 await db . execute ( sql `DROP TABLE IF EXISTS lease_page_acl_writes` )
154- for ( const projection of [ 'embedding_search' , 'embedding_keyword_tin' ] )
154+ for ( const projection of [ 'embedding_search' ] )
155155 await db . execute (
156156 sql . raw ( `DROP TRIGGER IF EXISTS log_lease_page_projection_write ON ${ projection } ` )
157157 )
@@ -300,25 +300,14 @@ describe('connector lease ACL pages in PostgreSQL', () => {
300300 )
301301 for ( let offset = 0 ; offset < rows . length ; offset += 200 )
302302 await db . insert ( embedding ) . values ( rows . slice ( offset , offset + 200 ) )
303- /**
304- * Each chunk's projection rows, filled from its document as the backfill leaves them. The
305- * embedding insert writes the vector projection's row; the keyword projection's own sync
306- * trigger ships with the Tin migration, which a database without Tin skips. The fixture sets
307- * the filled state itself, whatever triggers an earlier suite left behind; what is under
308- * test is the document trigger that rewrites these rows.
309- */
303+ /** Seeds the filled vector state whose ACL updates must stay bounded. */
310304 const chunkIds = sql . join (
311305 documents . map ( ( entry ) => sql `${ entry . id } ` ) ,
312306 sql `, `
313307 )
314308 await db . execute ( sql `
315309 UPDATE embedding_search p SET enabled = true, connector_id = d.connector_id, acl = d.acl
316310 FROM document d WHERE d.id = p.document_id AND d.id IN (${ chunkIds } )` )
317- await db . execute ( sql `
318- INSERT INTO embedding_keyword_tin (id, knowledge_base_id, document_id, enabled, content, connector_id, acl)
319- SELECT e.id, e.knowledge_base_id, e.document_id, true, e.content, d.connector_id, d.acl
320- FROM embedding e JOIN document d ON d.id = e.document_id WHERE e.document_id IN (${ chunkIds } )
321- ON CONFLICT (id) DO UPDATE SET enabled = true, connector_id = EXCLUDED.connector_id, acl = EXCLUDED.acl` )
322311 /** Only writes made by the code under test are counted. */
323312 await db . execute ( sql `DELETE FROM lease_page_projection_writes` )
324313 await db
@@ -337,10 +326,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
337326 db . execute < { projection : string ; acl : string | null ; expected : string } > ( sql `
338327 SELECT 'embedding_search' AS projection, array_to_string(p.acl, ',') AS acl,
339328 array_to_string(d.acl, ',') AS expected
340- FROM embedding_search p JOIN document d ON d.id = p.document_id WHERE d.connector_id = ${ connectorId }
341- UNION ALL
342- SELECT 'embedding_keyword_tin', array_to_string(p.acl, ','), array_to_string(d.acl, ',')
343- FROM embedding_keyword_tin p JOIN document d ON d.id = p.document_id WHERE d.connector_id = ${ connectorId } ` )
329+ FROM embedding_search p JOIN document d ON d.id = p.document_id WHERE d.connector_id = ${ connectorId } ` )
344330
345331 /** Projection rows each transaction rewrote, per table. */
346332 const projectionRowsPerTransaction = async ( ) =>
@@ -354,7 +340,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
354340 const seeded = await seedDocuments ( ids . connectorId , [ alice ( ) ] , 30 )
355341 await seedChunks ( seeded )
356342 const before = [ ...( await projectionAcls ( ids . connectorId ) ) ]
357- expect ( before ) . toHaveLength ( 2 * 30 * CHUNKS )
343+ expect ( before ) . toHaveLength ( 30 * CHUNKS )
358344
359345 await expect (
360346 persistDocumentAcls (
@@ -367,7 +353,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
367353 const after = [ ...( await projectionAcls ( ids . connectorId ) ) ]
368354 expect ( after . filter ( ( row ) => row . acl !== bob ( ) || row . expected !== bob ( ) ) ) . toEqual ( [ ] )
369355 const perTransaction = await projectionRowsPerTransaction ( )
370- expect ( perTransaction . reduce ( ( total , rows ) => total + rows , 0 ) ) . toBe ( 2 * 30 * CHUNKS )
356+ expect ( perTransaction . reduce ( ( total , rows ) => total + rows , 0 ) ) . toBe ( 30 * CHUNKS )
371357 expect ( Math . max ( ...perTransaction ) ) . toBeLessThanOrEqual ( PROJECTION_ROW_BATCH_SIZE )
372358 } )
373359
@@ -384,7 +370,7 @@ describe('connector lease ACL pages in PostgreSQL', () => {
384370 ) . resolves . toBe ( true )
385371
386372 const after = [ ...( await projectionAcls ( members . connectorId ) ) ]
387- expect ( after ) . toHaveLength ( 2 * 30 * CHUNKS )
373+ expect ( after ) . toHaveLength ( 30 * CHUNKS )
388374 expect ( after . filter ( ( row ) => row . acl !== '' || row . expected !== '' ) ) . toEqual ( [ ] )
389375 expect ( Math . max ( ...( await projectionRowsPerTransaction ( ) ) ) ) . toBeLessThanOrEqual (
390376 PROJECTION_ROW_BATCH_SIZE
0 commit comments