Skip to content

Add batched update_project_items writes via GraphQL#2903

Open
veralizeth wants to merge 3 commits into
mainfrom
veralizeth/mcp-batch-bulk-field-value
Open

Add batched update_project_items writes via GraphQL#2903
veralizeth wants to merge 3 commits into
mainfrom
veralizeth/mcp-batch-bulk-field-value

Conversation

@veralizeth

@veralizeth veralizeth commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds batched field-value writes to update_project_items using chunked, aliased GraphQL mutations with input-ordered succeeded, failed, or unknown results. One required top-level updated_field applies to every item in the batch.

Why

Implements the MCP portion of github/planning-tracking#3331. It builds on the issue-membership pagination merged in #2914; CLI support will follow separately.

What changed

  • Models items[] as three closed oneOf reference variants: node_id, numeric item_id, or item_owner + item_repo + issue_number. The top-level field is a closed ID-or-name variant; null clears it for all items. Tool guidance directs bulk callers here instead of looping update_project_item.
  • Resolves the project, shared field, and deduplicated item references before writing. Converts TEXT, NUMBER, DATE, SINGLE_SELECT, and ITERATION values once and rejects duplicate resolved items.
  • Sends one mutation kind in sequential chunks of 20 through the existing authenticated githubv4.Client, with a 50-item call cap (at most three requests) and no automatic retries or per-item fallbacks.
  • Preserves confirmed partial successes and marks unconfirmed writes unknown when mutation outcomes are ambiguous.

Review guide

  1. 101563c0 — internal batch engine and direct parsing, resolution, conversion, and execution tests.
  2. 9928ec60 — public projects_write contract/routing, handler and schema coverage, toolsnap, and README.
  3. 86810292 — neutral resolution-failure classification with focused fallback and structured-error coverage.

Automated tests are 1,378 of 2,336 added lines; production code is 859 and generated output is 99.

MCP impact

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

update_project_items adds reference-only batch items, one shared field/value, node_id references, and structured tri-state results. Existing single-item runtime behavior is unchanged.

Prompts tested (tool changes only)

No live prompts were run. Automated handler tests cover equivalent scenarios:

  • Apply one shared update or clear across node, numeric, and paginated issue references, including deduplicated lookups and duplicate-target handling.
  • Update 20, 21, and the maximum 50 project items, verifying one, two, and three sequential mutation requests.
  • Preserve partial successes and ordered mixed outcomes across GraphQL errors, transport failures, cancellation, and GHES client wiring.

Security / limits

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

The implementation uses the existing injected REST and GraphQL clients and their permissions. The tool is capped at 50 items; numeric reads use at most five concurrent lookups, and writes remain sequential in chunks of 20 with no automatic retry.

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

Focused schema, field conversion/resolution, item resolution, mutation execution, and handler tests also pass.

Docs

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

@Swastiksrijan

Copy link
Copy Markdown

go

@zwick zwick self-assigned this Jul 20, 2026
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from 15ca2ee to b8f5ca9 Compare July 20, 2026 19:43
@zwick
zwick changed the base branch from main to zwick-paginate-project-item-lookup July 20, 2026 19:43
@zwick zwick changed the title Adding an initial draft of batch/bulk field-value writes Adding an initial draft of batch/bulk field-value writes Jul 20, 2026
@zwick zwick changed the title Adding an initial draft of batch/bulk field-value writes Add update_project_items batch/bulk field-value writes via aliased GraphQL mutations Jul 20, 2026
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from 983d5f4 to 047505f Compare July 20, 2026 20:26
Base automatically changed from zwick-paginate-project-item-lookup to main July 21, 2026 08:25
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from 5ff24d6 to 669974c Compare July 21, 2026 12:50
@zwick zwick changed the title Add update_project_items batch/bulk field-value writes via aliased GraphQL mutations Add batched update_project_items writes via GraphQL Jul 21, 2026
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch 3 times, most recently from ad9f0e4 to 85ec9ef Compare July 21, 2026 14:04
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from e55769d to ef236d5 Compare July 21, 2026 19:40
@zwick
zwick changed the base branch from main to zwick-extract-projects-resolver-refactor July 21, 2026 19:40
@zwick
zwick changed the base branch from zwick-extract-projects-resolver-refactor to zwick-extract-projects-batch-mutation July 21, 2026 20:04
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from ef236d5 to f1a291e Compare July 21, 2026 20:04
@zwick
zwick force-pushed the zwick-extract-projects-batch-mutation branch from a69dd2d to a7b9cf3 Compare July 21, 2026 20:32
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from f1a291e to 03efb11 Compare July 21, 2026 20:33
SamMorrowDrums pushed a commit that referenced this pull request Jul 22, 2026
Split out of #2903 as a small prerequisite refactor.

- Add a NodeID field to ResolvedField, populated for all three field
  variants in listAllProjectFields.
- Refactor resolveProjectItemIDByIssueNumber into a thin wrapper over a
  new resolveProjectItemByIssueNumber that also returns the item node ID,
  delegating to resolveProjectItemByIssueNumberWithProjectID for an
  already-resolved project ID. The projectItems query now selects the
  item node ID alongside its full database ID.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 89f897b0-115f-4435-a071-46fb6c49be86
@zwick
zwick force-pushed the zwick-extract-projects-batch-mutation branch from a7b9cf3 to b9ecc1a Compare July 22, 2026 13:25
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch 2 times, most recently from 264d81d to ee77343 Compare July 22, 2026 14:18
Base automatically changed from zwick-extract-projects-batch-mutation to main July 22, 2026 14:52
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch 2 times, most recently from baf940c to aaad1b0 Compare July 22, 2026 17:02
Resolve and validate shared field updates and item references before executing ordered, chunked GraphQL writes with explicit ambiguous outcomes.

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

Copilot-Session: 7ae767ff-c1d0-46a9-b126-2e91403993a0
Add the public projects_write contract, routing, handler coverage, and generated documentation for shared field updates across batches of up to 50 items.

Co-authored-by: Lizeth Vera <47796851+veralizeth@users.noreply.github.com>

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

Copilot-Session: 7ae767ff-c1d0-46a9-b126-2e91403993a0
@zwick
zwick force-pushed the veralizeth/mcp-batch-bulk-field-value branch from aaad1b0 to 9928ec6 Compare July 22, 2026 17:08
@zwick
zwick requested a review from Copilot July 22, 2026 18:00
@zwick
zwick marked this pull request as ready for review July 22, 2026 18:00
@zwick
zwick requested a review from a team as a code owner July 22, 2026 18:00

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 batched Project item field updates with ordered tri-state results.

Changes:

  • Adds resolution, conversion, deduplication, and chunked GraphQL writes for up to 50 items.
  • Extends the projects_write schema and routing.
  • Adds comprehensive tests, documentation, and toolsnap updates.
Show a summary per file
File Description
README.md Documents batch-update parameters.
pkg/github/projects.go Adds schema and handler routing.
pkg/github/projects_batch.go Implements batch processing.
pkg/github/projects_batch_test.go Tests batch behavior and failures.
pkg/github/projects_test.go Tests the public schema.
pkg/github/__toolsnaps__/projects_write.snap Updates the tool snapshot.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread pkg/github/projects_batch.go Outdated
Use a neutral code for non-structured lookup failures while preserving structured resolution details.

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

Copilot-Session: 7ae767ff-c1d0-46a9-b126-2e91403993a0
@zwick
zwick marked this pull request as draft July 22, 2026 18:11
@zwick
zwick marked this pull request as ready for review July 22, 2026 18:30
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.

5 participants