docs(gateway): WS 帧门相关 11 个文件的注释改中文(只改注释,代码零字节改动)
主人 2026-10-03 拍板「注释一律中文」。本次先把本会话动过的文件就地翻; 不做全仓一次性翻译,存量按包分批排期(见 工作小结.md 待办)。 范围:ws_frame_scope.go / ws_frame_scope_test.go / broadcast.go / ws_hub_turn.go / ws_hub_message_event.go / session_read.go / server.go / ws_hub_stream_scope_test.go / history_write_broadcast_test.go / mood_test.go / extra_test.go 含中文的整行注释 18 → 382。 校验(判据 = "只改注释、零代码字节改动"): - `git diff -U0 | 排除 +++/--- | 排除注释行/空行/行尾注释` → 为空 - 独立实现:两侧剥掉注释后逐行比对代码文本 → 11/11 文件全等,不一致数 0 - 行尾注释 7 行逐条列出,代码列与原文逐字节相同(gofmt 未要求重排) - gofmt -l 干净;全树 go build/vet 绿;go test ./... = 58 包 ok / 0 FAIL; linux/amd64 + darwin/arm64 交叉编译绿 语义未删减:部分折行英文长句合并为更少行,故整行注释数 438 → 399。
This commit is contained in:
1 parent
770a83c3fb
commit
fe1ff33115
11 files changed
+392
-431
No files matched your search
@@ -11,8 +11,8 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// moodRunner is a TurnRunner that settles one turn with a fixed result, so the
|
||||
// test can assert the mood the loop reported is what gets persisted.
|
||||
// moodRunner 是一个 TurnRunner,以固定结果结算一轮,使测试能断言
|
||||
// 被持久化的正是 loop 报告的心情。
|
||||
type moodRunner struct {
|
||||
mood string
|
||||
}
|
||||
@@ -21,12 +21,11 @@ func (m moodRunner) Run(_ context.Context, _ string, _ []model.Message, _ loop.S
|
||||
return &loop.Result{Text: "在的呀♪", Steps: 1, StopReason: "stop", Mood: m.mood}, nil
|
||||
}
|
||||
|
||||
// TestOrchestratorPersistsTurnMood locks the mood column end to end on the Web
|
||||
// path: the mood the loop's turn-boundary hook reported lands on the persisted
|
||||
// assistant message (design/16 §3.3 `mode/mood/thinking`), so the DTO,
|
||||
// `message_persisted` and history replay carry real data instead of an always
|
||||
// empty mood. The user message keeps an empty mood (design/16 §3.3 assigns the
|
||||
// mood to the assistant reply).
|
||||
// TestOrchestratorPersistsTurnMood 在 Web 路径上端到端锁住 mood 列:
|
||||
// loop 轮次边界钩子报告的心情落到持久化的助手消息上
|
||||
// (design/16 §3.3 `mode/mood/thinking`),因此 DTO、`message_persisted`
|
||||
// 与历史回放携带真实数据,而不是永远为空的心情。用户消息保持空
|
||||
// 心情(design/16 §3.3 把心情分配给助手回复)。
|
||||
func TestOrchestratorPersistsTurnMood(t *testing.T) {
|
||||
t.Parallel()
|
||||
hist := &fakeHistory{}
|
||||
@@ -56,9 +55,9 @@ func TestOrchestratorPersistsTurnMood(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestOrchestratorPersistsEmptyMoodWhenUntracked locks the honest degrade: with no
|
||||
// emotion tracking (no hook wired, so Result.Mood is empty) the stored mood stays
|
||||
// empty rather than being fabricated.
|
||||
// TestOrchestratorPersistsEmptyMoodWhenUntracked 锁住诚实的降级:没有
|
||||
// 情绪跟踪时(未接钩子,因此 Result.Mood 为空)存储的心情保持为空,
|
||||
// 而不是被编造。
|
||||
func TestOrchestratorPersistsEmptyMoodWhenUntracked(t *testing.T) {
|
||||
t.Parallel()
|
||||
hist := &fakeHistory{}
|
||||
@@ -79,9 +78,9 @@ func TestOrchestratorPersistsEmptyMoodWhenUntracked(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestServerBroadcastMood locks the `mood` frame the frontend's mood handler reads
|
||||
// (design/07 §3): the type is `mood`, data.mood is the label, and the persona id /
|
||||
// affection ride along as extra detail.
|
||||
// TestServerBroadcastMood 锁住前端 mood 处理器读取的 `mood` 帧
|
||||
// (design/07 §3):类型是 `mood`,data.mood 是标签,角色 id / 好感度
|
||||
// 作为额外细节一同携带。
|
||||
func TestServerBroadcastMood(t *testing.T) {
|
||||
t.Parallel()
|
||||
env := newEnv(t, nil, false)
|
||||
|
||||
Reference in new issue
Block a user