@@ -179,6 +179,68 @@ describe("worker selector", () => {
179179 ) ;
180180 } ) ;
181181
182+ test ( "keeps workerless Message-ID detail lookups unfiltered" , async ( {
183+ expect,
184+ } ) => {
185+ const requestedWorkers : Array < string | null > = [ ] ;
186+ const requestedEmailIds : Array < string | null > = [ ] ;
187+ await page . route ( EMAIL_ROUTING_DETAIL_ROUTE , async ( route ) => {
188+ const search = new URL ( route . request ( ) . url ( ) ) . searchParams ;
189+ const emailId = search . get ( "email_id" ) ;
190+ if ( emailId !== null ) {
191+ requestedWorkers . push ( search . get ( "worker" ) ) ;
192+ requestedEmailIds . push ( emailId ) ;
193+ }
194+ await route . fulfill ( {
195+ contentType : "application/json" ,
196+ body : JSON . stringify ( {
197+ errors : [ ] ,
198+ messages : [ ] ,
199+ result :
200+ emailId === null
201+ ? [ ]
202+ : {
203+ attachments : [ ] ,
204+ events : [ ] ,
205+ forwards : [ ] ,
206+ from : "legacy@example.com" ,
207+ headers : { } ,
208+ messageId : emailId ,
209+ outcome : "ok" ,
210+ raw : "Content-Type: text/plain\r\n\r\nLegacy body" ,
211+ rawSize : 11 ,
212+ receivedAt : "2026-09-11T00:00:00.000Z" ,
213+ replies : [ ] ,
214+ subject : "Legacy detail" ,
215+ text : "Legacy body" ,
216+ to : "recipient@example.com" ,
217+ worker : "worker-2" ,
218+ } ,
219+ result_info :
220+ emailId === null
221+ ? { count : 0 , has_more : false , per_page : 10 }
222+ : undefined ,
223+ success : true ,
224+ } ) ,
225+ } ) ;
226+ } ) ;
227+ await loadWorkers ( 2 ) ;
228+
229+ const messageId = "<legacy@example.com>" ;
230+ await page . goto (
231+ new URL (
232+ `/cdn-cgi/local/explorer/email/routing/${ encodeURIComponent ( messageId ) } ?lookup=message-id` ,
233+ viteUrl
234+ ) . toString ( )
235+ ) ;
236+
237+ await page . getByText ( "Legacy detail" ) . last ( ) . waitFor ( ) ;
238+ expect ( new URL ( page . url ( ) ) . searchParams . get ( "worker" ) ) . toBeNull ( ) ;
239+ await expect . poll ( ( ) => requestedEmailIds . length ) . toBeGreaterThan ( 0 ) ;
240+ expect ( requestedEmailIds . every ( ( id ) => id === messageId ) ) . toBe ( true ) ;
241+ expect ( requestedWorkers . every ( ( worker ) => worker === null ) ) . toBe ( true ) ;
242+ } ) ;
243+
182244 test ( "discards stale email lists after switching workers" , async ( {
183245 expect,
184246 } ) => {
0 commit comments