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 天内回复