-
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
hasNextPage
istrue
, we should fire additional requests to fetch the remaining items. - This should repeat until
hasNextPage
isfalse
.
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.ts
to accept and use anafter
variable in theprojectV2Items
connection
- Modify
-
Implement Pagination Logic
-
In
src/infrastructure/github/functions/fetchProjectItems.ts
, update the logic to:- Track the
endCursor
returned from each page - Use
hasNextPage
to 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.ts
for 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
-
projectV2Items
query insrc/github/graphql/projectV2Items.ts
uses theafter
parameter to support pagination - Logic in
fetchProjectItems.ts
handles pagination usinghasNextPage
andendCursor
- 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