docs(gateway): gateway 第 2 批 5 个文件注释改中文(只改注释,代码零字节改动)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

主人 2026-10-03 拍板「注释一律中文」。本批 = WS 上行门与握手回放那批文件:
ws_hub.go / ws_history.go / ws_route.go / ws_role_gate_test.go / voice_signal_test.go
含中文的整行注释 6 → 148;无行尾注释。

校验(判据 = "只改注释、零代码字节改动"):
- git diff -U0 | 排除 +++/--- / 注释行 / 空行 / 行尾注释 → 为空
  (含"把纯空行变动也视为违规"的更严变体,同样为空)
- 独立实现:两侧剥掉注释后逐行比对代码文本 → 5/5 全等
- gofmt -l 干净(改动前同样干净,不存在"顺手格式化")
- go test ./... 全绿;go build/vet 绿;linux/amd64 + darwin/arm64 交叉编译绿
安全约束强度逐句保留:ws_route.go 的「默认拒(非黑名单)/ 删掉它等于放开一切」、
ws_history.go 的「门在 replayHistory 第一条语句 / 扩角色须先登记 design/11 §7.2 /
回放不含 thinking」、ws_role_gate_test.go 的测试名与断言字面量一字符未改。
This commit is contained in:
AskaEth committed 2026-10-03 22:10:33 +08:00
1 parent fe1ff33115
commit 355f81d04a
5 files changed
+149 -181

No files matched your search

@@ -12,8 +12,8 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/multimodal/voice"
)
// signalVoice is a VoiceService that also implements voiceProviderReporter, so a
// test can control both the STT/TTS result and the reported provider rung.
// signalVoice 是同时实现 voiceProviderReporter 的 VoiceService,使测试既能
// 控制 STT/TTS 结果,也能控制所上报的 provider 档位。
type signalVoice struct {
text string
audio voice.Audio
@@ -65,8 +65,8 @@ func TestHandleTranscribe_SilentSignal(t *testing.T) {
func TestHandleTranscribe_SilentFallbackWithoutReporter(t *testing.T) {
env := newEnv(t, nil, false)
// audioStubVoice does not implement voiceProviderReporter, so the handler
// must still flag an empty transcription as silent.
// audioStubVoice 没有实现 voiceProviderReporter,因此处理函数仍须把
// 空转写标为 silent。
env.srv.SetVoice(&audioStubVoice{})
token := env.token(t, auth.RoleOwner)
@@ -138,8 +138,8 @@ func TestHubVoiceOutput_SilentSignal(t *testing.T) {
t.Parallel()
hb := newTestHub(&stubRunner{res: &loop.Result{Text: "你好", Steps: 1, StopReason: "stop"}}, nil)
hb.voice = &signalVoice{text: "你好", rung: "silent"}
// voice_input is an owner-facing instruction since design/11 §7.2 B, so the
// connection that drives it has to carry owner/admin claims.
// 自 design/11 §7.2 B 起 voice_input 是面向主人的指令,因此驱动它的连接
// 必须携带 owner/admin claims。
c := newOwnerConn(hb, 32)
hb.register(c)