Repository navigation
Preserve label id in typed list_label output - #3925
Open
Shanmukh-l33t wants to merge 1 commit into
Open
Shanmukh-l33t wants to merge 1 commit into
Shanmukh-l33t wants to merge 1 commit into
Conversation
MinimalLabel carried only name, color and description, so the typed ListLabelsOutput decode silently dropped the id that list_label emits (a GraphQL node id string). Typed output now round-trips the legacy payload, and get_label keeps the id as well since it decodes into the same struct. Adds TestListLabelsOutputPreservesLabelID covering a legacy payload with an id and one without, and refreshes the get_label and list_label tool snapshots for the new output schema field.
Shanmukh-l33t
force-pushed
the
fix/3923-label-id
branch
from
November 22, 2026 15:15
c9fdac3 to
a604bd4
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change consistently adds label IDs to the shared typed model, includes round-trip and backward-compatible decoding coverage, and updates both affected output schemas.
No open issues 🎉
What changed in this PR
This PR preserves GraphQL label IDs in typed get_label and list_label outputs by adding the identity field to the shared MinimalLabel model.
Changes:
- Added
ID stringtoMinimalLabel. - Added round-trip and backward-compatible decoding coverage for label IDs.
- Regenerated
get_labelandlist_labeloutput schema snapshots to include the required string ID.
| File | Description |
|---|---|
| pkg/github/typed_governance_outputs.go | Adds the label ID field to the shared typed output model. |
| pkg/github/typed_governance_outputs_test.go | Verifies label ID preservation during typed decoding and updates wire projections. |
| pkg/github/__toolsnaps__/list_label.snap | Updates the list_label output schema to include the required string ID. |
| pkg/github/__toolsnaps__/get_label.snap | Updates the get_label output schema to include the required string ID. |
Review effort: Lite (adaptive)
shiva57anp-cmd
approved these changes
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The typed
ListLabelsOutput(andget_label, which decodes into the same struct) dropped every labelid.MinimalLabelnow carries the identity field, so the typed output round-trips the legacy payload losslessly.Why
Fixes #3923
list_labelemits each label as{"id": ..., "name": ..., "color": ..., "description": ...}, butMinimalLabelonly declared name, color and description.encoding/jsonsilently discardedid, so any client using the typed output lost label identity.What changed
pkg/github/typed_governance_outputs.go: addID stringjson:"id"`` as the first field ofMinimalLabel. No other structs touched.pkg/github/typed_governance_outputs_test.go: addTestListLabelsOutputPreservesLabelID(round-trip of a legacy payload withid, plus a decode of a payload without one) and update the two wire projection expectations that asserted the id-dropped shape.pkg/github/__toolsnaps__/get_label.snap,list_label.snap: regenerated withUPDATE_TOOLSNAPS=true; the output schema gainsidas a required string.Field type differs from the issue's suggestion
The issue proposes
ID int64. The producer does not emit a REST numeric id:pkg/github/labels.gowrites"id": fmt.Sprintf("%v", labelNode.ID), a GraphQL node id string such asL1. Anint64field would make decode fail on every real response.stringis also what the other typed label models already use (UIGetLabelOutputandIssueLabelOutputboth declareID string json:"id"), so this keeps the typed outputs consistent. Checked the remaining typed label structs for the same lossy pattern; both of those already keepid, so no other struct needs the change.MCP impact
get_labelandlist_labeloutput schemas now includeid. Tool inputs and names are unchanged; legacy text output was already emittingidand is unchanged.Test evidence
Regression test on unmodified
upstream/main(RED):env -u PYTHONPATH go test ./pkg/github -run TestListLabelsOutputPreservesLabelID -count=1 -vAfter the fix (GREEN):
Full package run:
env -u PYTHONPATH go test ./pkg/github -count=1 -p 2Verbose run of the same package: 725 tests PASS, 2 SKIP (
TestNewMCPServer_RegistersUIResources,TestRegisterUIResources_ReadableViaClient), 0 FAIL.Static checks: