File tree Expand file tree Collapse file tree
extensions/qa-lab/src/live-transports/matrix/substrate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -514,4 +514,36 @@ describe("matrix sync helpers", () => {
514514 } ) ,
515515 ) . rejects . toThrow ( "invalid access token" ) ;
516516 } ) ;
517+
518+ it ( "preserves response-body failures raised after its long-poll deadline fires" , async ( ) => {
519+ const deadline = new AbortController ( ) ;
520+ const timeoutSpy = vi . spyOn ( AbortSignal , "timeout" ) . mockReturnValue ( deadline . signal ) ;
521+ const bodyError = new Error ( "late Matrix response body failure" ) ;
522+ const observer = createMatrixQaRoomObserver ( {
523+ baseUrl : "http://127.0.0.1:28008/" ,
524+ fetchImpl : async ( ) =>
525+ new Response (
526+ new ReadableStream ( {
527+ start ( controller ) {
528+ deadline . abort ( ) ;
529+ controller . error ( bodyError ) ;
530+ } ,
531+ } ) ,
532+ ) ,
533+ observedEvents : [ ] ,
534+ since : "start-batch" ,
535+ } ) ;
536+
537+ try {
538+ await expect (
539+ observer . waitForOptionalRoomEvent ( {
540+ predicate : ( ) => false ,
541+ roomId : "!room:matrix-qa.test" ,
542+ timeoutMs : 1_000 ,
543+ } ) ,
544+ ) . rejects . toBe ( bodyError ) ;
545+ } finally {
546+ timeoutSpy . mockRestore ( ) ;
547+ }
548+ } ) ;
517549} ) ;
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ async function pollMatrixQaRoomObserver(
109109 } catch ( error ) {
110110 // An empty long-poll is expected at this observer-owned boundary. Other
111111 // request failures stay terminal so auth and protocol defects remain visible.
112- if ( deadlineSignal . aborted ) {
112+ if ( deadlineSignal . aborted && error === deadlineSignal . reason ) {
113113 return ;
114114 }
115115 throw error ;
You can’t perform that action at this time.
0 commit comments