@@ -218,6 +218,89 @@ func (s *E2EIntegrationSuite) TestLand_HappyPath_ReachesLanded() {
218218 "operating store should show request %s in terminal state landed" , sqid )
219219}
220220
221+ // TestList_ReturnsFilteredPagedSummaries verifies the customer-facing List RPC
222+ // against the full stack. Land writes the initial summary through the gateway,
223+ // later status updates arrive through the request-log topic, and List reads the
224+ // gateway-owned summary read model through the public RPC surface.
225+ func (s * E2EIntegrationSuite ) TestList_ReturnsFilteredPagedSummaries () {
226+ t := s .T ()
227+
228+ startTimeMs := time .Now ().Add (- time .Second ).UnixMilli ()
229+ firstURI := "github://uber/e2e-list/pull/101/abcdef0123456789abcdef0123456789abcdef01"
230+ secondURI := "github://uber/e2e-list/pull/102/abcdef0123456789abcdef0123456789abcdef02"
231+ otherURI := "github://uber/e2e-list-other/pull/201/abcdef0123456789abcdef0123456789abcdef03"
232+
233+ first := s .land ("e2e-list-queue" , firstURI )
234+ second := s .land ("e2e-list-queue" , secondURI )
235+ otherQueue := s .land ("e2e-cancel-queue" , otherURI )
236+ endTimeMs := time .Now ().Add (time .Minute ).UnixMilli ()
237+
238+ resp := s .awaitListContains (& gatewaypb.ListRequest {
239+ Queue : "e2e-list-queue" ,
240+ StartTimeMs : startTimeMs ,
241+ EndTimeMs : endTimeMs ,
242+ PageSize : 10 ,
243+ }, first , second )
244+
245+ assert .NotContains (t , summarySQIDs (resp .Requests ), otherQueue ,
246+ "List should not return requests from a different queue" )
247+
248+ bySQID := make (map [string ]* gatewaypb.RequestSummary , len (resp .Requests ))
249+ for _ , summary := range resp .Requests {
250+ bySQID [summary .Sqid ] = summary
251+ }
252+
253+ firstSummary := bySQID [first ]
254+ require .NotNil (t , firstSummary , "List response should include %s" , first )
255+ assert .Equal (t , "e2e-list-queue" , firstSummary .Queue )
256+ assert .Equal (t , []string {firstURI }, firstSummary .ChangeUris )
257+ assert .NotEmpty (t , firstSummary .Status )
258+ assert .GreaterOrEqual (t , firstSummary .StartedAtMs , startTimeMs )
259+ assert .Less (t , firstSummary .StartedAtMs , endTimeMs )
260+ assert .GreaterOrEqual (t , firstSummary .UpdatedAtMs , firstSummary .StartedAtMs )
261+
262+ s .awaitStatus (first , entity .RequestStatusLanded )
263+ s .awaitStatus (second , entity .RequestStatusLanded )
264+
265+ landedResp := s .awaitListContains (& gatewaypb.ListRequest {
266+ Queue : "e2e-list-queue" ,
267+ StartTimeMs : startTimeMs ,
268+ EndTimeMs : endTimeMs ,
269+ Statuses : []string {string (entity .RequestStatusLanded )},
270+ PageSize : 10 ,
271+ }, first , second )
272+ for _ , summary := range landedResp .Requests {
273+ if summary .Sqid != first && summary .Sqid != second {
274+ continue
275+ }
276+ assert .Equal (t , string (entity .RequestStatusLanded ), summary .Status )
277+ assert .True (t , summary .Terminal , "landed summary %s should be terminal" , summary .Sqid )
278+ assert .Greater (t , summary .CompletedAtMs , int64 (0 ), "landed summary %s should have completion time" , summary .Sqid )
279+ }
280+
281+ page1 := s .list (& gatewaypb.ListRequest {
282+ Queue : "e2e-list-queue" ,
283+ StartTimeMs : startTimeMs ,
284+ EndTimeMs : endTimeMs ,
285+ PageSize : 1 ,
286+ Sort : gatewaypb .ListSort_ADMITTED_DESC ,
287+ })
288+ require .Len (t , page1 .Requests , 1 )
289+ require .NotEmpty (t , page1 .NextPageToken )
290+
291+ page2 := s .list (& gatewaypb.ListRequest {
292+ Queue : "e2e-list-queue" ,
293+ StartTimeMs : startTimeMs ,
294+ EndTimeMs : endTimeMs ,
295+ PageSize : 1 ,
296+ PageToken : page1 .NextPageToken ,
297+ Sort : gatewaypb .ListSort_ADMITTED_DESC ,
298+ })
299+ require .Len (t , page2 .Requests , 1 )
300+ assert .NotEqual (t , page1 .Requests [0 ].Sqid , page2 .Requests [0 ].Sqid )
301+ assert .ElementsMatch (t , []string {first , second }, []string {page1 .Requests [0 ].Sqid , page2 .Requests [0 ].Sqid })
302+ }
303+
221304// TestCancelRequest_InvalidSqid verifies the gateway rejects an empty sqid
222305// synchronously before publishing anything to the cancel queue.
223306func (s * E2EIntegrationSuite ) TestCancelRequest_InvalidSqid () {
0 commit comments