@@ -163,6 +163,40 @@ describe("gatherRoutedModels single-flight", () => {
163163 expect ( a2 ) . toEqual ( a1 ) ;
164164 } ) ;
165165
166+ test ( "an omitted registry-static setting never shares a flight with explicit live discovery" , async ( ) => {
167+ let fetchCount = 0 ;
168+ globalThis . fetch = ( async ( ) => {
169+ fetchCount += 1 ;
170+ return new Response ( JSON . stringify ( { data : [ { id : "live-only" } ] } ) , {
171+ status : 200 ,
172+ headers : { "content-type" : "application/json" } ,
173+ } ) ;
174+ } ) as typeof fetch ;
175+
176+ const config = ( liveModels ?: true ) : OcxConfig => ( {
177+ port : 10100 ,
178+ defaultProvider : "alibaba-token-plan" ,
179+ providers : {
180+ "alibaba-token-plan" : {
181+ adapter : "openai-chat" ,
182+ baseUrl : "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1" ,
183+ apiKey : "test-key" ,
184+ models : [ "configured-static" ] ,
185+ ...( liveModels === undefined ? { } : { liveModels } ) ,
186+ } ,
187+ } ,
188+ } ) ;
189+
190+ const [ registryStatic , explicitLive ] = await Promise . all ( [
191+ gatherRoutedModels ( config ( ) ) ,
192+ gatherRoutedModels ( config ( true ) ) ,
193+ ] ) ;
194+
195+ expect ( fetchCount ) . toBe ( 1 ) ;
196+ expect ( registryStatic . map ( model => model . id ) ) . toEqual ( [ "configured-static" ] ) ;
197+ expect ( explicitLive . map ( model => model . id ) ) . toEqual ( [ "live-only" ] ) ;
198+ } ) ;
199+
166200 test ( "concurrent distinct keys keep flight-local combo omissions" , async ( ) => {
167201 globalThis . fetch = ( async ( ) =>
168202 new Response ( JSON . stringify ( { data : [ { id : "m1" } ] } ) , {
0 commit comments