Skip to content

Commit 047505f

Browse files
zwickCopilot
andcommitted
Replace update_project_items REST loop with chunked aliased mutations
Rewire update_project_items to resolve the project, every distinct field, and every item once up front, then write via the projects_batch_mutation.go aliased-mutation builder, chunked into sequential requests of 20, instead of one REST PATCH per item. - projects_batch_resolve.go: field/item resolution. Adds node_id as a third item-reference form (alongside item_id and item_owner+item_repo+issue_number, exactly one required per item), bypassing REST lookup entirely. Numeric item_id values are deduplicated and resolved to node IDs via bounded-concurrency REST GETs; issue refs are deduplicated and resolved via the paginated resolver from the previous commit. updated_field.value is converted to the matching ProjectV2FieldValue member for TEXT, NUMBER, DATE, SINGLE_SELECT, and ITERATION; null routes to the clear mutation. - projects_batch.go: orchestration. Rejects duplicate item+field targets before any writes, partitions into update/clear chunks, and tracks tri-state per-item results (succeeded/failed/unknown). After an ambiguous transport-level failure or context cancellation, no further chunks are sent. - projects.go: removed the old REST-loop implementation and its helpers; added node_id to the update_project_items item schema. - Removed the stale comment claiming the pinned client couldn't build dynamic aliases. - Updated/added tests accordingly, including toolsnap and README regeneration for the schema change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d7dc302d-e6f2-41e9-a2c8-ed598de47067
1 parent 4338107 commit 047505f

9 files changed

Lines changed: 1843 additions & 812 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ The following sets of tools are available:
11011101
- `item_owner`: The owner (user or organization) of the repository containing the issue or pull request. Required for 'add_project_item' method. Also accepted by 'update_project_item' when resolving the item by issue number. (string, optional)
11021102
- `item_repo`: The name of the repository containing the issue or pull request. Required for 'add_project_item' method. Also accepted by 'update_project_item' when resolving the item by issue number. (string, optional)
11031103
- `item_type`: The item's type, either issue or pull_request. Required for 'add_project_item' method. (string, optional)
1104-
- `items`: The set of items to update. Required for 'update_project_items'. Each entry references either an existing item by 'item_id', or by (item_owner + item_repo + issue_number). Each entry may optionally include its own 'updated_field'; if omitted, the top-level 'updated_field' is applied. Limit: 100 items per call. (object[], optional)
1104+
- `items`: The set of items to update. Required for 'update_project_items'. Each entry references an existing item by exactly one of: 'node_id' (the item's GraphQL node ID, e.g. as returned by 'list_project_items' or 'add_project_item'), 'item_id' (the numeric project item ID), or (item_owner + item_repo + issue_number). Each entry may optionally include its own 'updated_field'; if omitted, the top-level 'updated_field' is applied. Limit: 100 items per call. (object[], optional)
11051105
- `iteration_duration`: Duration in days for iterations of the field (e.g. 7 for weekly, 14 for bi-weekly). Required for 'create_iteration_field' method. (number, optional)
11061106
- `iterations`: Custom iterations for 'create_iteration_field' method. Only set this when you need iterations with varying durations, breaks between them, or specific titles. Otherwise omit it: GitHub auto-creates three iterations of 'iteration_duration' days starting on 'start_date', which is the right choice for most cases. (object[], optional)
11071107
- `method`: The method to execute (string, required)

pkg/github/__toolsnaps__/projects_write.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"type": "string"
4242
},
4343
"items": {
44-
"description": "The set of items to update. Required for 'update_project_items'. Each entry references either an existing item by 'item_id', or by (item_owner + item_repo + issue_number). Each entry may optionally include its own 'updated_field'; if omitted, the top-level 'updated_field' is applied. Limit: 100 items per call.",
44+
"description": "The set of items to update. Required for 'update_project_items'. Each entry references an existing item by exactly one of: 'node_id' (the item's GraphQL node ID, e.g. as returned by 'list_project_items' or 'add_project_item'), 'item_id' (the numeric project item ID), or (item_owner + item_repo + issue_number). Each entry may optionally include its own 'updated_field'; if omitted, the top-level 'updated_field' is applied. Limit: 100 items per call.",
4545
"items": {
4646
"additionalProperties": false,
4747
"properties": {
@@ -50,7 +50,7 @@
5050
"type": "number"
5151
},
5252
"item_id": {
53-
"description": "The project item ID. Provide either item_id, or (item_owner + item_repo + issue_number).",
53+
"description": "The project item ID. Provide exactly one of node_id, item_id, or (item_owner + item_repo + issue_number).",
5454
"type": "number"
5555
},
5656
"item_owner": {
@@ -61,6 +61,10 @@
6161
"description": "Repository containing the issue or pull request. Combine with item_owner and issue_number to resolve the item.",
6262
"type": "string"
6363
},
64+
"node_id": {
65+
"description": "The project item's GraphQL node ID. Provide exactly one of node_id, item_id, or (item_owner + item_repo + issue_number).",
66+
"type": "string"
67+
},
6468
"updated_field": {
6569
"description": "Per-item field update. Overrides the top-level 'updated_field'. Same shape as the top-level 'updated_field'.",
6670
"type": "object"

0 commit comments

Comments
 (0)