Skip to content

Paginate project item lookup across memberships#2914

Merged
RossTarrant merged 2 commits into
mainfrom
zwick-paginate-project-item-lookup
Jul 21, 2026
Merged

Paginate project item lookup across memberships#2914
RossTarrant merged 2 commits into
mainfrom
zwick-paginate-project-item-lookup

Conversation

@zwick

@zwick zwick commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Paginate issue project-item memberships when resolving an issue to a Project item.

Why

Resolves github/planning-tracking#3696

What changed

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

The existing projects_write issue-reference path now resolves memberships beyond the first 50.

Prompts tested (tool changes only)

  • "Update an issue's project field when the issue belongs to more than 50 projects."

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Pagination remains bounded to 50 memberships per request and stops as soon as the target is found.

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1a67631b-dc18-448a-8be5-81110bfd543a
@zwick
zwick marked this pull request as ready for review July 20, 2026 15:17
@zwick
zwick requested a review from a team as a code owner July 20, 2026 15:17
Copilot AI review requested due to automatic review settings July 20, 2026 15:17
@zwick zwick self-assigned this Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds pagination when resolving an issue’s Project item membership.

Changes:

  • Follows endCursor through all membership pages.
  • Adds success and not-found pagination tests.
Show a summary per file
File Description
pkg/github/projects_resolver.go Implements paginated project-item lookup.
pkg/github/projects_resolver_test.go Tests multi-page resolution and exhaustion.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

zwick added a commit that referenced this pull request Jul 20, 2026
…utations

Rewrite update_project_items to resolve the project, every distinct
field, and every item once up front, then write via chunked, aliased
updateProjectV2ItemFieldValue / clearProjectV2ItemFieldValue GraphQL
mutations built at runtime with reflect.StructOf, instead of one REST
PATCH per item.

- Extend ResolvedField/projectFieldsCache with GraphQL node IDs and
  numeric-ID lookup, alongside existing name-based lookup.
- Add node_id as a third item-reference form (alongside item_id and
  item_owner/item_repo/issue_number), bypassing REST lookup entirely.
- Deduplicate numeric item_id lookups with bounded-concurrency REST
  GETs; extend the #2914 paginated issue resolver to also return the
  item's node ID.
- Convert updated_field.value to the correct ProjectV2FieldValue member
  for TEXT, NUMBER, DATE, SINGLE_SELECT, and ITERATION; route null
  values to the clear mutation instead of an empty update.
- Reject duplicate item+field targets before any writes.
- Isolate the reflection mechanics in projects_batch_mutation.go: a
  cached-by-(kind,size) reflected struct type with positional aliases
  (item0..itemN-1) and positional input variables (, ,
  ...), matching the first-input workaround required by the pinned
  githubv4.Client.Mutate signature.
- Execute updates then clears in sequential chunks of 20 (provisional,
  documented headroom rationale), tracking tri-state per-item results
  (succeeded/failed/unknown); abort remaining chunks after an ambiguous
  transport-level failure or context cancellation without retrying.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d7dc302d-e6f2-41e9-a2c8-ed598de47067
zwick added a commit that referenced this pull request Jul 20, 2026
Extend ResolvedField with the GraphQL node ID alongside the existing
numeric databaseId, and extend the #2914 paginated issue-item resolver
to also return the item's node ID (resolveProjectItemByIssueNumber),
keeping resolveProjectItemIDByIssueNumber as a numeric-only wrapper for
existing callers. These node IDs are what the upcoming aliased
GraphQL mutations need as ItemID/FieldID inputs, in place of the
numeric IDs the REST API takes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d7dc302d-e6f2-41e9-a2c8-ed598de47067
@RossTarrant
RossTarrant merged commit 6a44cf2 into main Jul 21, 2026
19 checks passed
@RossTarrant
RossTarrant deleted the zwick-paginate-project-item-lookup branch July 21, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants