ListLabelsOutput drops every label id from the typed response
維護者通常 4 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
打開 pkg/github/typed_governance_outputs.go,閱讀第 16 行附近的 MinimalLabel 以及第 461 行附近填充 ListLabelsOutput 的解碼位置。給 MinimalLabel 新增帶 json:"id" tag 的 ID int64 欄位,使舊有 identity 在解碼與重新編碼後仍能保留,並檢查輸出 schema 是否需要相同的欄位。接著新增一個往返測試(類似所回報的 TestListLabelsDropsID),斷言 id 會被保留,並執行 go test ./pkg/github。
由索引模型根據 Issue 內容生成。
描述
ListLabelsOutput drops every label id from the typed response
Summary
The legacy list_label producer serializes each label's id, but the typed ListLabelsOutput decodes into MinimalLabel, which has no id field. A round-trip through the typed output therefore removes every label id.
Location
- Repository:
github/github-mcp-server - File:
pkg/github/typed_governance_outputs.go - Line: 16 (
MinimalLabel; decode at 461) - Revision:
e3809fe91c75
Affected code
type MinimalLabel struct {
Name string `json:"name"`
Color string `json:"color" jsonschema:"Hex RGB without leading #."`
Description string `json:"description"`
}
type ListLabelsOutput struct {
Labels []MinimalLabel `json:"labels"`
TotalCount int `json:"totalCount" jsonschema:"Total labels in the repository."`
PageInfo MinimalPageInfo `json:"pageInfo"`
}
The legacy JSON carries id, but the typed struct has no destination for it.
Expected behavior
A typed ListLabelsOutput preserves the legacy label identity. Round-tripping:
{"labels":[{"id":123,"name":"bug","color":"ff0000","description":""}],"totalCount":1,"pageInfo":{}}
must keep id: 123, or the typed output must not be used for a lossless interpretation of the legacy response.
Actual behavior
Running a round-trip test in Docker:
docker run --rm -v "$PWD:/app" -v /tmp/gomod:/go/pkg/mod -v /tmp/gocache:/root/.cache/go-build -w /app -e GOFLAGS=-mod=mod golang:1.26 bash -c 'go mod download && go test ./pkg/github -run TestListLabelsDropsID -v'
Observed:
roundtrip={"labels":[{"name":"bug","color":"ff0000","description":""}],"totalCount":1,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false}}
--- PASS: TestListLabelsDropsID
id is gone after the typed decode/encode.
Root cause
MinimalLabel declares only name, color, and description. encoding/json silently ignores the legacy id field, and re-encoding the typed value emits no id.
The current default branch still has the same MinimalLabel definition.
Suggested fix
Add the identity field to the typed model:
type MinimalLabel struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color" jsonschema:"Hex RGB without leading #."`
Description string `json:"description"`
}
and include it in the output schema. Add a round-trip test asserting id survives.
- 主要語言
- Go
- 星號
- 34.4k
- 分支
- 5.3k
- 平均合併
- 4 天 1 小時
- 30 天內合併 PR
- 30
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/github-mcp-server 的其他 Issue
-
create_or_update_file rejects explicitly empty file content可能已有人在做 @Elon-Jiang 於 4 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
github/github-mcp-server#3883 ·
維護者通常 4 天內回覆
-
csv_output silently overwrites distinct fields when flattened keys collide可能已有人在做 @Mystery01092000 於 5 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
github/github-mcp-server#3865 ·
維護者通常 4 天內回覆
-
update_issue_labels is annotated destructiveHint: false but replaces (removes) existing labels可能已有人在做 @shhhhhhjokerist 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 69/100
github/github-mcp-server#3760 · 1 則留言 ·
維護者通常 4 天內回覆
-
docs(install-claude): "environment variable" examples put the PAT in argv and the saved config可能已有人在做 @shhhhhhjokerist 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
github/github-mcp-server#3758 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 69/100
github/github-mcp-server#3729 ·
維護者通常 4 天內回覆
查看 github/github-mcp-server 的全部 Issue
相似的 Issue
-
otelc go test fails for .go file targets with 'multiple packages found for file targets'可能已有人在做 @Aryanbhargava18 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
open-telemetry/opentelemetry-go-compile-instrumentation#1877 ·
維護者通常 1 天內回覆
-
[Bug]: Hybrid search silently caps the BM25 candidate pool at 20 even with a higher --limit可能已有人在做 @aloneangel45 今天認領。 未關閉bug
難度 1/5 1 小時以內 新手友好度 84/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
channel/http: constructRequest produces double slashes when baseAddress or HTTPEndpoint BaseURL has a trailing slash可能已有人在做 @patelshivani2283-lab 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 半天 新手友好度 74/100
維護者通常 1 天內回覆