docs(gateway): gateway 剩余文件注释改中文(逐行 1:1,代码零字节改动)
主人 2026-10-03 拍板「注释一律中文」;gateway 至此整包注释中文化完成(本会话共 3 批: 已推库 16 个文件 + 本批剩余文件)。 校验:机械校验(非注释改动行)= 空;剥注释后代码文本逐行比对全等(不一致文件数 0); 全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
This commit is contained in:
1 parent
91e8d7a029
commit
074ffc4ebf
73 files changed
+2529
-2529
No files matched your search
@@ -9,21 +9,21 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/auth"
|
||||
)
|
||||
|
||||
// These tests cover the shared client enum endpoint (Android collaboration B4,
|
||||
// design/07 §6): the wire shape of GET /api/v1/meta/enums, the values it
|
||||
// publishes, and the fact that it is readable by any authenticated role. They
|
||||
// assert the JSON contract with literals rather than by comparing against
|
||||
// internal/contract/enums, so the client-facing shape is pinned independently of
|
||||
// the Go table (the table's own drift tests live in that package).
|
||||
// 这些测试覆盖共享的客户端枚举端点(Android 协作 B4,
|
||||
// design/07 §6):GET /api/v1/meta/enums 的线上结构、它发布的
|
||||
// 取值,以及任何已认证角色都可读这一点。它们
|
||||
// 用字面量断言 JSON 契约,而不是与
|
||||
// internal/contract/enums 对比,因此面向客户端的形状独立于
|
||||
// Go 表被钉住(表自身的漂移测试在该包内)。
|
||||
|
||||
// enumEntry is the wire shape of one published enum item.
|
||||
// enumEntry 是一个已发布枚举项的线上结构。
|
||||
type enumEntry struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// metaEnumsWire decodes GET /api/v1/meta/enums and asserts the envelope and the
|
||||
// per-item shape, returning the ids of each table for value assertions.
|
||||
// metaEnumsWire 解码 GET /api/v1/meta/enums 并断言信封与
|
||||
// 逐项形状,返回每个表的 id 供取值断言。
|
||||
func metaEnumsWire(t *testing.T, ts *httptest.Server, tok string) (platforms, moods, modes []string, unknown string) {
|
||||
t.Helper()
|
||||
resp, body := doReq(t, http.MethodGet, ts.URL+"/api/v1/meta/enums", nil, tok)
|
||||
@@ -67,9 +67,9 @@ func entryIDs(items []enumEntry) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
// TestMetaEnumsShape pins the published contract: the three tables name the real
|
||||
// platform/mood/mode values and the response carries the unknown-value fallback
|
||||
// policy.
|
||||
// TestMetaEnumsShape 钉住已发布的契约:三张表列出真实的
|
||||
// platform/mood/mode 取值,且响应携带未知取值回退
|
||||
// 策略。
|
||||
func TestMetaEnumsShape(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, ts, jwt := buildEnv(t, cfgDefault(), Deps{})
|
||||
@@ -94,9 +94,9 @@ func TestMetaEnumsShape(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMetaEnumsAnyAuthenticatedRole asserts the endpoint is a read-only,
|
||||
// non-sensitive table: every role may read it, and anonymous callers get 401
|
||||
// rather than the data.
|
||||
// TestMetaEnumsAnyAuthenticatedRole 断言该端点是只读、非敏感的
|
||||
// 表:每个角色都可读它,匿名调用方得到 401
|
||||
// 而不是数据。
|
||||
func TestMetaEnumsAnyAuthenticatedRole(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, ts, jwt := buildEnv(t, cfgDefault(), Deps{})
|
||||
@@ -117,7 +117,7 @@ func TestMetaEnumsAnyAuthenticatedRole(t *testing.T) {
|
||||
wantErrorShape(t, body)
|
||||
}
|
||||
|
||||
// sameStringSet reports whether got and want hold the same values, ignoring order.
|
||||
// sameStringSet 报告 got 与 want 是否持有相同取值(忽略顺序)。
|
||||
func sameStringSet(got, want []string) bool {
|
||||
if len(got) != len(want) {
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user