docs(runtime): internal/runtime/loop 44 个文件注释改中文(逐行 1:1,代码零字节改动)

主人 2026-10-03 拍板「注释一律中文」;本模块按长期分批协议(一个模块一次派工)执行。
注释行数 1329 → 1329 逐行 1:1(含中文 33 → 1304);行尾注释 5 条一并译。
校验:机械校验(非注释改动行)= 空;独立 Go AST 程序(剥注释复渲)证明 44/44 文件代码全等;
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
gofmt:capacity_loop_test.go / flow.go 改动前即未格式化,按铁律保留原样未动。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:21 +08:00
1 parent 355f81d04a
commit 91e8d7a029
44 files changed
+1315 -1315

No files matched your search

+14 -14
View File
@@ -9,10 +9,10 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
)
// TestRunCallsOnTurnEndOnce locks the turn boundary: a settled turn is reported
// exactly once — with the turn's own user text, the persona the loop is bound to
// and the answer — and the label the hook returns is recorded on Result.Mood so
// the persistence layer can tag the assistant message.
// TestRunCallsOnTurnEndOnce 钉住 turn 边界:一个落定的 turn 恰好
// 上报一次 —— 携带该 turn 自己的用户文本、循环绑定的角色
// 以及答案 —— 钩子返回的标签记录在 Result.Mood 上,
// 使持久化层能标记 assistant 消息。
func TestRunCallsOnTurnEndOnce(t *testing.T) {
t.Parallel()
ad := &mockAdapter{chat: []mgResp{{resp: model.Response{Content: "在的呀♪"}}}}
@@ -56,8 +56,8 @@ func TestRunCallsOnTurnEndOnce(t *testing.T) {
}
}
// TestRunPassesRestrictedEnvToTurnEnd locks that the conversation's isolation
// environment reaches the hook, so a group/stranger turn can be kept read-only.
// TestRunPassesRestrictedEnvToTurnEnd 钉住会话的隔离
// 环境到达钩子,使群聊/陌生人 turn 能被保持只读。
func TestRunPassesRestrictedEnvToTurnEnd(t *testing.T) {
t.Parallel()
ad := &mockAdapter{chat: []mgResp{{resp: model.Response{Content: "好的"}}}}
@@ -81,10 +81,10 @@ func TestRunPassesRestrictedEnvToTurnEnd(t *testing.T) {
}
}
// TestRunTurnEndOnceForMultiStepTurn locks "once per turn, not per step": a
// tool-loop turn (model → tool call → final answer) reports its boundary once,
// and the reported user text stays the turn's user message rather than a
// fed-back tool result.
// TestRunTurnEndOnceForMultiStepTurn 钉住「每 turn 一次,而非每步
// 一次」:一个工具循环 turn(模型 → 工具调用 → 最终答案)只上报其边界
// 一次,且上报的用户文本仍是该 turn 的用户消息,而不是
// 回灌的工具结果。
func TestRunTurnEndOnceForMultiStepTurn(t *testing.T) {
t.Parallel()
call := `{"tool_calls":[{"name":"echo","args":{"q":"hi"}}]}`
@@ -123,8 +123,8 @@ func TestRunTurnEndOnceForMultiStepTurn(t *testing.T) {
}
}
// TestRunNoTurnEndOnError locks that a failed turn is not reported: nothing
// settled, so persona state must not advance.
// TestRunNoTurnEndOnError 钉住失败的 turn 不上报:什么都没
// 落定,因此人格状态不得推进。
func TestRunNoTurnEndOnError(t *testing.T) {
t.Parallel()
ad := &mockAdapter{chat: []mgResp{{err: errors.New("model down")}}}
@@ -143,8 +143,8 @@ func TestRunNoTurnEndOnError(t *testing.T) {
}
}
// TestRunWithoutTurnEndHook locks the nil-tolerance: an unwired hook leaves the
// mood empty and Run behaves exactly as before.
// TestRunWithoutTurnEndHook 钉住 nil 容忍:未接线的钩子让
// 情绪保持为空,Run 的行为与从前完全一致。
func TestRunWithoutTurnEndHook(t *testing.T) {
t.Parallel()
ad := &mockAdapter{chat: []mgResp{{resp: model.Response{Content: "hi"}}}}