@@ -643,6 +643,7 @@ describe("PullRequestSyncReactor", () => {
643643 yield * TestClock . setTime ( Date . parse ( NOW ) ) ;
644644 const fixture = yield * makeHarness ( {
645645 snapshot : makeSnapshot ( [ makeThread ( "one" , { pullRequests : [ makeLink ( 42 ) ] } ) ] ) ,
646+ summary : ( input ) => Effect . succeed ( makeSummary ( input , { updatedAt : NOW } ) ) ,
646647 } ) ;
647648
648649 yield * Effect . gen ( function * ( ) {
@@ -855,6 +856,39 @@ describe("PullRequestSyncReactor", () => {
855856 ) ,
856857 ) ;
857858
859+ it . effect ( "reads a quiet open pull request every five minutes until it changes" , ( ) =>
860+ Effect . scoped (
861+ Effect . gen ( function * ( ) {
862+ yield * TestClock . setTime ( Date . parse ( NOW ) ) ;
863+ const updatedAt = yield * Ref . make ( "2026-08-27T00:00:00.000Z" ) ;
864+ const fixture = yield * makeHarness ( {
865+ snapshot : makeSnapshot ( [ makeThread ( "quiet" , { pullRequests : [ makeLink ( 5 ) ] } ) ] ) ,
866+ summary : ( input ) =>
867+ Ref . get ( updatedAt ) . pipe ( Effect . map ( ( updatedAt ) => makeSummary ( input , { updatedAt } ) ) ) ,
868+ } ) ;
869+ yield * Effect . gen ( function * ( ) {
870+ const reactor = yield * startAndSweep ( fixture ) ;
871+ const applySyncs = Effect . flatMap ( Ref . get ( fixture . syncCommands ) , ( commands ) =>
872+ Ref . update ( fixture . snapshots , ( snapshot ) => applySync ( snapshot , commands ) ) ,
873+ ) ;
874+ yield * applySyncs ;
875+ const reads = Ref . get ( fixture . summaryCalls ) . pipe ( Effect . map ( ( calls ) => calls . length ) ) ;
876+ assert . strictEqual ( yield * reads , 1 ) ;
877+ for ( let index = 0 ; index < 4 ; index += 1 ) yield * sweepAgain ( fixture , reactor ) ;
878+ assert . strictEqual ( yield * reads , 1 ) ;
879+
880+ // Someone comments: the five-minute read sees it, and the next sweep reads it again.
881+ yield * Ref . set ( updatedAt , "2026-08-28T12:04:00.000Z" ) ;
882+ yield * sweepAgain ( fixture , reactor ) ;
883+ assert . strictEqual ( yield * reads , 2 ) ;
884+ yield * applySyncs ;
885+ yield * sweepAgain ( fixture , reactor ) ;
886+ assert . strictEqual ( yield * reads , 3 ) ;
887+ } ) . pipe ( Effect . provide ( fixture . layer ) ) ;
888+ } ) ,
889+ ) ,
890+ ) ;
891+
858892 it . effect ( "preserves a refresh requested while an older host read is in flight" , ( ) =>
859893 Effect . scoped (
860894 Effect . gen ( function * ( ) {
@@ -1116,13 +1150,15 @@ describe("PullRequestSyncReactor", () => {
11161150 yield * TestClock . setTime ( Date . parse ( NOW ) ) ;
11171151 const fixture = yield * makeHarness ( {
11181152 snapshot : makeSnapshot ( [
1119- makeThread ( "first" , { pullRequests : [ makeLink ( 7 , { state : "open" } ) ] } ) ,
1120- makeThread ( "second" , { pullRequests : [ makeLink ( 8 , { state : "open" } ) ] } ) ,
1153+ makeThread ( "first" , { pullRequests : [ makeLink ( 7 , { state : "open" , updatedAt : NOW } ) ] } ) ,
1154+ makeThread ( "second" , {
1155+ pullRequests : [ makeLink ( 8 , { state : "open" , updatedAt : NOW } ) ] ,
1156+ } ) ,
11211157 makeThread ( "third" , {
11221158 pullRequests : [
11231159 makeLink (
11241160 9 ,
1125- { state : "open" } ,
1161+ { state : "open" , updatedAt : NOW } ,
11261162 { host : "forge.example" , url : "https://forge.example/owner/repository/pulls/9" } ,
11271163 ) ,
11281164 ] ,
0 commit comments