- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
Description
As a developer, I want to ensure all GitHub ProjectV2 items are fetched—even when there are more than 100—so that reminder tasks always include the full list of project items.
🧠 Context
GitHub's GraphQL API has a pagination limit of 100 items per request when querying projectV2Items. This is fine for now since our project has fewer than 100 items, but we will eventually exceed this limit. If we don’t handle pagination, some project items will be excluded from reminder logic.
Currently, we fire the query in
src/infrastructure/github/functions/fetchProjectItems.ts,
which uses the GraphQL document defined in
src/github/graphql/projectV2Items.ts.
The GraphQL response includes a pageInfo.hasNextPage field, which indicates whether more items are available.
To support pagination:
- If 
hasNextPageistrue, we should fire additional requests to fetch the remaining items. - This should repeat until 
hasNextPageisfalse. 
To paginate properly, we need to update our GraphQL query to use the after parameter (and optionally before), in addition to the first parameter (currently defined on line 5):
There’s no need to introduce a new GraphQL client—existing examples of how to pass query variables can be found in
src/infrastructure/github/functions/updateProjectItemAssignee.ts.
🛠️ Implementation Plan
- 
Update the GraphQL Query
- Modify 
src/github/graphql/projectV2Items.tsto accept and use anaftervariable in theprojectV2Itemsconnection 
 - Modify 
 - 
Implement Pagination Logic
- 
In
src/infrastructure/github/functions/fetchProjectItems.ts, update the logic to:- Track the 
endCursorreturned from each page - Use 
hasNextPageto continue fetching pages - Accumulate all items across pages into a single array
 
 - Track the 
 
 - 
 - 
Follow Existing Variable Patterns
- Refer to 
src/infrastructure/github/functions/updateProjectItemAssignee.tsfor how to pass variables into GraphQL queries with our current setup 
 - Refer to 
 - 
Write Tests
- Mock paginated GraphQL responses
 - Verify that multiple pages are fetched and merged correctly
 - Ensure all items are returned even when more than 100 exist
 
 
✅ Acceptance Criteria
-  
projectV2Itemsquery insrc/github/graphql/projectV2Items.tsuses theafterparameter to support pagination -  Logic in 
fetchProjectItems.tshandles pagination usinghasNextPageandendCursor - No new GraphQL client is introduced; variable handling follows existing code patterns
 - Pagination logic is tested using mocked GraphQL responses
 - All project items are fetched and included in reminders, even when the count exceeds 100
 
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
