@@ -591,21 +591,32 @@ describe('McpService best-effort discovery', () => {
591591 expect ( tools . map ( ( t ) => t . name ) ) . toEqual ( [ 'a1' ] )
592592 } )
593593
594- it ( 'skips an OAuth server nobody authorized without creating its OAuth row or marking it pending' , async ( ) => {
595- mockGetWorkspaceServersRows . mockResolvedValue ( [ dbRow ( 'mcp-a' , 'A' , { authType : 'oauth' } ) ] )
596- mcpOauthMockFns . mockHasDecryptableOauthTokens . mockResolvedValue ( false )
594+ it . each ( [
595+ [ 'a best-effort' , { bestEffort : true } ] ,
596+ [ 'a read-only' , { readOnly : true } ] ,
597+ ] ) (
598+ 'skips an OAuth server nobody authorized in %s discovery without creating its OAuth row or marking it pending' ,
599+ async ( _kind , options ) => {
600+ mockGetWorkspaceServersRows . mockResolvedValue ( [ dbRow ( 'mcp-a' , 'A' , { authType : 'oauth' } ) ] )
601+ mcpOauthMockFns . mockHasDecryptableOauthTokens . mockResolvedValue ( false )
597602
598- await expect (
599- mcpService . discoverServerTools ( MEMBER_B , 'mcp-a' , WORKSPACE_ID , 'cache-aside' , undefined , {
600- bestEffort : true ,
601- } )
602- ) . rejects . toBeInstanceOf ( McpOauthAuthorizationRequiredError )
603- expect ( mcpOauthMockFns . mockGetOrCreateOauthRow ) . not . toHaveBeenCalled ( )
604- // loadOauthRow clears a column it cannot decrypt; the gate must not risk that.
605- expect ( mcpOauthMockFns . mockLoadOauthRow ) . not . toHaveBeenCalled ( )
606- expect ( mockConnect ) . not . toHaveBeenCalled ( )
607- expectNoSharedStateWrites ( )
608- } )
603+ await expect (
604+ mcpService . discoverServerTools (
605+ MEMBER_B ,
606+ 'mcp-a' ,
607+ WORKSPACE_ID ,
608+ 'cache-aside' ,
609+ undefined ,
610+ options
611+ )
612+ ) . rejects . toBeInstanceOf ( McpOauthAuthorizationRequiredError )
613+ expect ( mcpOauthMockFns . mockGetOrCreateOauthRow ) . not . toHaveBeenCalled ( )
614+ // loadOauthRow clears a column it cannot decrypt; the gate must not risk that.
615+ expect ( mcpOauthMockFns . mockLoadOauthRow ) . not . toHaveBeenCalled ( )
616+ expect ( mockConnect ) . not . toHaveBeenCalled ( )
617+ expectNoSharedStateWrites ( )
618+ }
619+ )
609620
610621 it . each ( [
611622 [ 'a best-effort' , { bestEffort : true } ] ,
0 commit comments