docs(gateway): gateway 剩余文件注释改中文(逐行 1:1,代码零字节改动)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

主人 2026-10-03 拍板「注释一律中文」;gateway 至此整包注释中文化完成(本会话共 3 批:
已推库 16 个文件 + 本批剩余文件)。
校验:机械校验(非注释改动行)= 空;剥注释后代码文本逐行比对全等(不一致文件数 0);
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:25 +08:00
1 parent 91e8d7a029
commit 074ffc4ebf
73 files changed
+2529 -2529

No files matched your search

+22 -22
View File
@@ -12,9 +12,9 @@ import (
personareg "git.yeij.top/AskaEth/Cyrene_v2/internal/persona/registry"
)
// moodRegistry builds a real persona registry (the production PersonaStore, which
// also owns each role's emotion machine) from the given personas, registering the
// matching character too.
// moodRegistry 从给定人格构建真实人格注册表(生产
// PersonaStore,它同时持有每个角色的情绪机),并一并注册
// 匹配的角色。
func moodRegistry(t *testing.T, personas ...*loader.Persona) *personareg.Registry {
t.Helper()
reg := personareg.New()
@@ -29,8 +29,8 @@ func moodRegistry(t *testing.T, personas ...*loader.Persona) *personareg.Registr
return reg
}
// personaList fetches a persona list endpoint and returns each row as a raw map,
// so the test can tell a missing key from a present null/false.
// personaList 拉取人格列表端点并把每行作为原始 map 返回,
// 使测试能区分键缺失与存在且为 null/false。
func personaList(t *testing.T, ts *httptest.Server, jwt *auth.JWTService, path string) []map[string]any {
t.Helper()
resp, body := doReq(t, http.MethodGet, ts.URL+path, nil, mustSign(t, jwt))
@@ -44,17 +44,17 @@ func personaList(t *testing.T, ts *httptest.Server, jwt *auth.JWTService, path s
return rows
}
// mustSign mints an owner token for the read endpoints.
// mustSign 为这些读端点铸造一个 owner token。
func mustSign(t *testing.T, jwt *auth.JWTService) string {
t.Helper()
return signAny(t, jwt, "acct", auth.RoleOwner)
}
// TestAdminListPersonasThinkingKeepShowToUserTriState pins the read-side contract
// of the panel's `thinking` block: an unconfigured persona carries NO `thinking`
// key (nil, not an all-zero object), an explicitly false `showToUser` stays
// `false`, and an unset one stays `null` — never flattened into false, which is
// the distinction the write side keeps with *bool.
// TestAdminListPersonasThinkingKeepShowToUserTriState 钉住面板 `thinking`
// 块的读侧契约:未配置的人格不携带 `thinking`
// 键(nil,而不是全零对象),显式为 false 的 `showToUser` 保持
// `false`,未设置的保持 `null` —— 绝不被压平成 false,这正是
// 写侧用 *bool 保持的区分。
func TestAdminListPersonasThinkingKeepShowToUserTriState(t *testing.T) {
t.Parallel()
@@ -118,9 +118,9 @@ func TestAdminListPersonasThinkingKeepShowToUserTriState(t *testing.T) {
}
}
// TestUserListPersonasReportsRoleMoodOnly pins the user-side shape: the role-level
// mood rides along (the frontend seeds its badge from it), while the admin-only
// thinking knobs stay out of the user contract.
// TestUserListPersonasReportsRoleMoodOnly 钉住用户侧形状:角色级
// mood 一并带上(前端从它给角标播种),而仅管理的
// thinking 开关留在用户契约之外。
func TestUserListPersonasReportsRoleMoodOnly(t *testing.T) {
t.Parallel()
@@ -150,10 +150,10 @@ func TestUserListPersonasReportsRoleMoodOnly(t *testing.T) {
}
}
// TestPersonaMoodFollowsTheRole is the "mood is role-level, not per-session" rule:
// it reads the live emotion machine, so a transition on one role's machine shows
// up for that role and leaves every other role untouched, with no session input
// anywhere in the path.
// TestPersonaMoodFollowsTheRole 是「mood 是角色级、不是每会话」规则:
// 它读取活的情绪机,因此一个角色机器上的转移会为该角色
// 体现出来,且不触碰其他任何角色,路径中
// 任何地方都没有会话输入。
func TestPersonaMoodFollowsTheRole(t *testing.T) {
t.Parallel()
@@ -175,7 +175,7 @@ func TestPersonaMoodFollowsTheRole(t *testing.T) {
if x, y := readMoods(); x != "calm" || y != "calm" {
t.Fatalf("initial moods = (%q, %q), want (calm, calm)", x, y)
}
// Move only 昔涟's machine (the machine a settled turn's observer would move).
// 只移动昔涟的机器(一个已结算回合的观察者会移动的机器)。
if err := reg.Emotions().Transition("xilian", emotion.Happy); err != nil {
t.Fatalf("Transition: %v", err)
}
@@ -184,9 +184,9 @@ func TestPersonaMoodFollowsTheRole(t *testing.T) {
}
}
// TestPersonaMoodEmptyWithoutEmotionStore is the honest degrade: a persona store
// that does not own emotion (it only lists personas) reports an empty mood rather
// than inventing one.
// TestPersonaMoodEmptyWithoutEmotionStore 是诚实的退化:不持有情绪
// 的人格存储(它只列出人格)报告空 mood,而不是
// 编造一个。
func TestPersonaMoodEmptyWithoutEmotionStore(t *testing.T) {
t.Parallel()