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
@@ -6,17 +6,17 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/contract/enums"
|
||||
)
|
||||
|
||||
// This file owns the read-only client metadata surface: GET /api/v1/meta/enums,
|
||||
// which publishes the authoritative platform/mood/mode tables (Android
|
||||
// collaboration B4, design/07 §6). Clients (Web, Android, an IM bridge) read the
|
||||
// tables instead of hardcoding their own id → label mapping, so a source badge or
|
||||
// a mood label cannot drift per client. The tables themselves live in
|
||||
// internal/contract/enums; this handler only serves them, so there is one source
|
||||
// of truth rather than a copy per consumer.
|
||||
// 本文件拥有只读的客户端元数据表面:GET /api/v1/meta/enums,
|
||||
// 它发布权威的 platform/mood/mode 表(Android
|
||||
// 协作 B4,design/07 §6)。客户端(Web、Android、IM bridge)读这些
|
||||
// 表,而不是各自硬编码 id → 标签映射,因此来源徽标或
|
||||
// 情绪标签不会逐客户端漂移。这些表本身位于
|
||||
// internal/contract/enums;本 handler 只负责提供它们,因此只有
|
||||
// 一个事实来源,而不是每个消费方一份副本。
|
||||
|
||||
// metaEnums is the GET /api/v1/meta/enums payload. `unknown` carries the
|
||||
// machine-readable fallback policy (enums.UnknownFallback) so a client reads the
|
||||
// tables and the rule for an unlisted value from the same response.
|
||||
// metaEnums 是 GET /api/v1/meta/enums 的载荷。`unknown` 携带
|
||||
// 机器可读的回退策略(enums.UnknownFallback),使客户端从同一
|
||||
// 响应中读到表以及对未列出取值的规则。
|
||||
type metaEnums struct {
|
||||
Platforms []enums.Item `json:"platforms"`
|
||||
Moods []enums.Item `json:"moods"`
|
||||
@@ -24,14 +24,14 @@ type metaEnums struct {
|
||||
Unknown string `json:"unknown"`
|
||||
}
|
||||
|
||||
// handleListEnums serves the shared client enum tables. It is a pure projection
|
||||
// of the Go-side authority (no store, no error path) and contains nothing
|
||||
// sensitive, so it is gated like GET /api/v1/sessions: any authenticated role may
|
||||
// read it.
|
||||
// handleListEnums 提供共享的客户端枚举表。它是 Go 侧权威的
|
||||
// 纯投影(无存储、无错误路径),不含任何
|
||||
// 敏感内容,因此像 GET /api/v1/sessions 一样门控:任何已认证角色都可以
|
||||
// 读取它。
|
||||
//
|
||||
// Adding a value to a table is a non-breaking change for existing clients, which
|
||||
// must display an unlisted value raw (see enums.UnknownFallback) rather than
|
||||
// dropping it or erroring.
|
||||
// 向表中新增取值对既有客户端是非破坏性变更,客户端
|
||||
// 必须原样展示未列出的取值(见 enums.UnknownFallback),而不是
|
||||
// 丢弃它或报错。
|
||||
func (s *Server) handleListEnums(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, http.StatusOK, metaEnums{
|
||||
Platforms: enums.Platforms(),
|
||||
|
||||
Reference in new issue
Block a user