@@ -46,8 +46,11 @@ for (const scenario of [
4646 "keeps a local origin ahead of another local environment" ,
4747 "keeps mutations on an old origin server without retrying them" ,
4848 "skips an old alternate server before dispatching a mutation" ,
49+ "returns a successful mutation when source invalidation stalls" ,
4950] as const ) {
50- it . effect ( scenario , ( ) =>
51+ ( scenario === "returns a successful mutation when source invalidation stalls"
52+ ? it . live
53+ : it . effect ) ( scenario , ( ) =>
5154 Effect . scoped (
5255 Effect . gen ( function * ( ) {
5356 const calls : string [ ] = [ ] ;
@@ -98,8 +101,14 @@ for (const scenario of [
98101 return null ;
99102 } ) ,
100103 [ WS_METHODS . pullRequestsInvalidate ] : ( ) =>
101- Effect . sync ( ( ) => {
104+ Effect . gen ( function * ( ) {
102105 calls . push ( `${ name } :invalidate` ) ;
106+ if (
107+ ! local &&
108+ scenario === "returns a successful mutation when source invalidation stalls"
109+ ) {
110+ return yield * Effect . never ;
111+ }
103112 } ) ,
104113 } as unknown as WsRpcProtocolClient ;
105114 } ;
@@ -316,6 +325,52 @@ for (const source of ["pending", "pending-local", "failed", "offline"] as const)
316325 ) ;
317326}
318327
328+ it . live ( "keeps source workspace metadata when an alternate answers a detail read" , ( ) =>
329+ Effect . scoped (
330+ Effect . gen ( function * ( ) {
331+ const clientFor = ( local : boolean ) =>
332+ ( {
333+ [ WS_METHODS . pullRequestsRouting ] : ( ) =>
334+ Effect . succeed ( {
335+ host : "github.com" ,
336+ provider : "github" ,
337+ viewer : "maria-rcks" ,
338+ accountId : "123" ,
339+ projectTitle : local ? "local project" : "source project" ,
340+ workspaceRoot : local ? "/Users/local/repo" : "/srv/source/repo" ,
341+ } ) ,
342+ [ WS_METHODS . pullRequestsDetail ] : ( ) =>
343+ local
344+ ? Effect . succeed ( {
345+ projectId : "local-project" ,
346+ projectTitle : "local project" ,
347+ workspaceRoot : "/Users/local/repo" ,
348+ title : "github title" ,
349+ } )
350+ : Effect . never ,
351+ } ) as unknown as WsRpcProtocolClient ;
352+ const { environmentRegistry, supervisor } = yield * makeTestRuntime (
353+ clientFor ( false ) ,
354+ clientFor ( true ) ,
355+ ) ;
356+ const result = yield * createPullRequestRouter ( ) ( WS_METHODS . pullRequestsDetail , {
357+ projectId : ProjectId . make ( "project-1" ) ,
358+ repository : "acme/web" ,
359+ number : 7 ,
360+ } ) . pipe (
361+ Effect . provideService ( EnvironmentRegistry . EnvironmentRegistry , environmentRegistry ) ,
362+ Effect . provideService ( EnvironmentSupervisor . EnvironmentSupervisor , supervisor ) ,
363+ ) ;
364+ expect ( result ) . toEqual ( {
365+ projectId : "project-1" ,
366+ projectTitle : "source project" ,
367+ workspaceRoot : "/srv/source/repo" ,
368+ title : "github title" ,
369+ } ) ;
370+ } ) ,
371+ ) ,
372+ ) ;
373+
319374it . live (
320375 "refreshes identity before writes and invalidates prior readers across router instances" ,
321376 ( ) =>
0 commit comments