docs(comments): 注释中文化 · internal/runtime/history(15 文件,纯替换)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 只翻注释/文档字符串:剥离注释后代码行逐字节不变(机械校验只剩 4 条行尾注释的翻译,代码前缀全等)
- 交叉引用(design/16 §4.6、D4/B3、0010 迁移文件名)逐字保留
- 保留未译技术词:DDL/rowid/LIKE/LEFT JOIN/DTO/rune/WS/actor 及全部标识符与表名
- 顺带副作用:store.go、session_persona_test.go 由注释文字改变而变得 gofmt 干净(未运行 gofmt -w)
This commit is contained in:
AskaEth committed 2026-10-04 12:28:48 +08:00
1 parent b0fbb8bc0d
commit 09fba77f87
15 files changed
+430 -516

No files matched your search

@@ -6,8 +6,7 @@ import (
"testing"
)
// sessionOf returns the SessionMeta of one session from ListSessions, failing the test
// when the session is absent.
// sessionOf 从 ListSessions 里返回某个会话的 SessionMeta,会话缺失时使测试失败。
func sessionOf(t *testing.T, st *Store, id string) SessionMeta {
t.Helper()
sessions, err := st.ListSessions(context.Background())
@@ -28,7 +27,7 @@ func TestListSessionsLastMessagePreview(t *testing.T) {
st := newStore(t)
ctx := context.Background()
// The empty main session has no preview.
// 空的主会话没有预览。
if got := sessionOf(t, st, MainSessionID); got.LastMessage != nil {
t.Fatalf("empty main LastMessage = %+v, want nil", got.LastMessage)
}
@@ -47,7 +46,7 @@ func TestListSessionsLastMessagePreview(t *testing.T) {
t.Fatalf("append sub: %v", err)
}
// Main stays first and carries its newest message, not the first one.
// 主会话仍在最前,携带它最新的消息,而不是第一条。
sessions, err := st.ListSessions(ctx)
if err != nil {
t.Fatalf("list sessions: %v", err)
@@ -64,7 +63,7 @@ func TestListSessionsLastMessagePreview(t *testing.T) {
t.Fatalf("sub LastMessage = %+v, want user/sub question/1500", subPreview)
}
// A sub session created after the main one but never written has no preview.
// 在主会话之后创建、但从未写入的子会话没有预览。
empty, err := st.NewSubSession(ctx, "owner")
if err != nil {
t.Fatalf("new empty sub: %v", err)
@@ -88,8 +87,7 @@ func TestListSessionsLastMessageTruncatesAndCollapses(t *testing.T) {
t.Fatalf("truncated preview = %+v, want %q", got, want)
}
// Whitespace runs (including newlines) collapse to single spaces, and a short
// message is returned whole.
// 连续空白(含换行)折叠为单个空格,短消息原样返回。
sub, err := st.NewSubSession(ctx, "owner")
if err != nil {
t.Fatalf("new sub: %v", err)
@@ -107,7 +105,7 @@ func TestListSessionsLastMessageTieBreaksByInsertion(t *testing.T) {
st := newStore(t)
ctx := context.Background()
// Two messages sharing a millisecond timestamp: the later insert is the newest.
// 两条消息共享同一毫秒时间戳:后插入的是最新的。
for _, content := range []string{"older", "newer"} {
if err := st.Append(ctx, Message{SessionID: MainSessionID, Role: RoleAssistant, Content: content, CreatedAt: 5000}); err != nil {
t.Fatalf("append %s: %v", content, err)