@@ -1075,6 +1075,81 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
10751075 expect ( inheritedAccount ?. config ?. token ) . not . toBe ( "prototype-token" ) ;
10761076 } ) ;
10771077
1078+ it ( "ignores manifest account keys that normalize to blocked object keys" , ( ) => {
1079+ const { pluginDir } = writeExternalSetupChannelPlugin ( {
1080+ setupEntry : false ,
1081+ pluginId : "external-chat-plugin" ,
1082+ channelId : "external-chat" ,
1083+ manifestChannelConfig : true ,
1084+ } ) ;
1085+ const cfg = {
1086+ channels : {
1087+ "external-chat" : {
1088+ accounts : {
1089+ "constructor " : {
1090+ token : "blocked-token" ,
1091+ } ,
1092+ } ,
1093+ } ,
1094+ } ,
1095+ plugins : {
1096+ load : { paths : [ pluginDir ] } ,
1097+ allow : [ "external-chat-plugin" ] ,
1098+ } ,
1099+ } as never ;
1100+ const plugin = listReadOnlyChannelPluginsForConfig ( cfg , {
1101+ env : { ...process . env } ,
1102+ includePersistedAuthState : false ,
1103+ } ) . find ( ( entry ) => entry . id === "external-chat" ) ;
1104+
1105+ expect ( plugin ?. config . listAccountIds ( cfg ) ) . toEqual ( [ ] ) ;
1106+ const account = plugin ?. config . resolveAccount ( cfg , "default" ) ;
1107+ const accountFields = expectRecordFields ( account , {
1108+ accountId : "default" ,
1109+ } ) ;
1110+ const configFields = expectRecordFields ( accountFields . config , { } ) ;
1111+ expect ( configFields . token ) . toBeUndefined ( ) ;
1112+ } ) ;
1113+
1114+ it ( "resolves manifest channel account config from raw account keys with opaque provider ids" , ( ) => {
1115+ const { pluginDir } = writeExternalSetupChannelPlugin ( {
1116+ setupEntry : false ,
1117+ pluginId : "external-chat-plugin" ,
1118+ channelId : "external-chat" ,
1119+ manifestChannelConfig : true ,
1120+ } ) ;
1121+ const cfg = {
1122+ channels : {
1123+ "external-chat" : {
1124+ accounts : {
1125+ 1126+ enabled : true ,
1127+ baseUrl : "https://ilinkai.weixin.qq.com" ,
1128+ } ,
1129+ } ,
1130+ } ,
1131+ } ,
1132+ plugins : {
1133+ load : { paths : [ pluginDir ] } ,
1134+ allow : [ "external-chat-plugin" ] ,
1135+ } ,
1136+ } as never ;
1137+ const plugin = listReadOnlyChannelPluginsForConfig ( cfg , {
1138+ env : { ...process . env } ,
1139+ includePersistedAuthState : false ,
1140+ } ) . find ( ( entry ) => entry . id === "external-chat" ) ;
1141+
1142+ expect ( plugin ?. config . listAccountIds ( cfg ) ) . toEqual ( [ "59000514e8ad-im-bot" ] ) ;
1143+ const account = plugin ?. config . resolveAccount ( cfg , "59000514e8ad-im-bot" ) ;
1144+ const fields = expectRecordFields ( account , {
1145+ accountId : "59000514e8ad-im-bot" ,
1146+ } ) ;
1147+ expectRecordFields ( fields . config , {
1148+ enabled : true ,
1149+ baseUrl : "https://ilinkai.weixin.qq.com" ,
1150+ } ) ;
1151+ } ) ;
1152+
10781153 it ( "keeps setup-entry precedence when channel config descriptors are not runtime cutoffs" , ( ) => {
10791154 const { pluginDir, fullMarker, setupMarker } = writeExternalSetupChannelPlugin ( {
10801155 pluginId : "external-chat-plugin" ,
0 commit comments