@@ -158,29 +158,59 @@ describe('meeting MCP provider wire contracts', () => {
158158 await expect ( searchFirefliesMcp ( client , input ) ) . rejects . toThrow ( 'unsupported' )
159159 } )
160160
161- it ( 'diagnoses unsupported Fireflies envelopes without logging private values or arbitrary keys' , async ( ) => {
162- const privateMarker = 'PRIVATE_MEETING_OR_CREDENTIAL'
163- const client : ManagedSearchMcpClient = {
164- async call ( ) {
165- return {
166- text : privateMarker . repeat ( 1000 ) ,
167- data : { error : privateMarker } ,
168- result : { items : [ { title : privateMarker } ] } ,
169- ...Object . fromEntries (
170- Array . from ( { length : 1000 } , ( _ , index ) => [ `${ privateMarker } _${ index } ` , privateMarker ] )
171- ) ,
172- }
173- } ,
161+ it . each ( [ 'text' , 'json' , 'code_fence' , 'oversized' ] as const ) (
162+ 'diagnoses unsupported Fireflies %s envelopes without logging private values or arbitrary keys' ,
163+ async ( format ) => {
164+ const privateMarker = 'PRIVATE_MEETING_OR_CREDENTIAL'
165+ const json = JSON . stringify ( { items : [ { title : privateMarker } ] , [ privateMarker ] : 'secret' } )
166+ const text =
167+ format === 'oversized'
168+ ? JSON . stringify ( { items : [ privateMarker . repeat ( 3000 ) ] } )
169+ : format === 'code_fence'
170+ ? [ '```json' , json , '```' ] . join ( '\n' )
171+ : format === 'json'
172+ ? json
173+ : privateMarker . repeat ( 1000 )
174+ const client : ManagedSearchMcpClient = {
175+ async call ( ) {
176+ return {
177+ text,
178+ data : { error : privateMarker } ,
179+ result : { items : [ { title : privateMarker } ] } ,
180+ ...Object . fromEntries (
181+ Array . from ( { length : 1000 } , ( _ , index ) => [
182+ `${ privateMarker } _${ index } ` ,
183+ privateMarker ,
184+ ] )
185+ ) ,
186+ }
187+ } ,
188+ }
189+ await expect ( searchFirefliesMcp ( client , { ...input , query : privateMarker } ) ) . rejects . toThrow (
190+ 'unsupported'
191+ )
192+ const warnings = getAllMockLoggers ( ) . flatMap ( ( logger ) => logger . warn . mock . calls )
193+ expect ( warnings ) . toHaveLength ( 1 )
194+ expect ( warnings [ 0 ] ?. [ 1 ] ) . toMatchObject ( {
195+ response : { type : 'object' , fields : { text : 'string' , data : 'object' , result : 'object' } } ,
196+ data : { type : 'object' , fields : { error : 'string' } } ,
197+ result : { type : 'object' , fields : { items : 'array' } } ,
198+ text :
199+ format === 'oversized'
200+ ? { length : text . length , inspection : 'skipped_size_limit' }
201+ : {
202+ length : text . length ,
203+ format,
204+ ...( format === 'text'
205+ ? { }
206+ : { jsonShape : { type : 'object' , fields : { items : 'array' } } } ) ,
207+ } ,
208+ } )
209+ const serialized = JSON . stringify ( warnings )
210+ expect ( serialized ) . not . toContain ( privateMarker )
211+ expect ( serialized . length ) . toBeLessThan ( 2000 )
174212 }
175- await expect ( searchFirefliesMcp ( client , { ...input , query : privateMarker } ) ) . rejects . toThrow (
176- 'unsupported'
177- )
178- const warnings = getAllMockLoggers ( ) . flatMap ( ( logger ) => logger . warn . mock . calls )
179- expect ( warnings ) . toHaveLength ( 1 )
180- const serialized = JSON . stringify ( warnings )
181- expect ( serialized ) . not . toContain ( privateMarker )
182- expect ( serialized . length ) . toBeLessThan ( 2000 )
183- } )
213+ )
184214
185215 it ( 'rejects invalid continuation offsets before Fireflies receives a query' , async ( ) => {
186216 const client = {
0 commit comments