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

- 只翻注释/文档字符串:820 增 / 820 删 严格 1:1;剥掉整行注释与行尾注释尾巴后,
  逐文件与 HEAD 比对「代码部分差异 = 0」;裁决/design 编号计数逐项与 HEAD 一致
- 保留可执行 SQL 样例、SQLite 报错原文、pgvector/HNSW/ANN/BLOB 等技术词原文
- 复核:go build 绿 + memory/projectindex/vector 三包测试绿;gofmt 仅剩 2 个既有未格式化文件(改动前即如此,未顺手修)
This commit is contained in:
AskaEth committed 2026-10-04 13:32:54 +08:00
1 parent eb1828ee7a
commit 61cf80d5ee
31 files changed
+820 -820

No files matched your search

+9 -9
View File
@@ -20,7 +20,7 @@ func TestStore_ListScope_User_全局共享(t *testing.T) {
}
}
// persona.a sees both personas' user-scope items (globally shared).
// persona.a 能看到两个角色的用户作用域条目(全局共享)。
items, err := s.ListScope(ctx, ScopeUser, "persona.a")
if err != nil {
t.Fatalf("ListScope user: %v", err)
@@ -41,7 +41,7 @@ func TestStore_ListScope_Persona_其他角色只读(t *testing.T) {
t.Fatalf("AddScoped persona.a: %v", err)
}
// persona.b may READ persona.a's persona-scope item (read-only rule).
// persona.b 可以读 persona.a 的角色作用域条目(只读规则)。
items, err := s.ListScope(ctx, ScopePersona, "persona.b")
if err != nil {
t.Fatalf("ListScope persona for b: %v", err)
@@ -49,7 +49,7 @@ func TestStore_ListScope_Persona_其他角色只读(t *testing.T) {
if len(items) != 1 || items[0].PersonaID != "persona.a" {
t.Fatalf("ListScope(persona) for persona.b = %+v, want persona.a's item", items)
}
// AddScoped auto-filled PersonaID from the acting actor.
// AddScoped 用实施动作者自动填充了 PersonaID。
if items[0].PersonaID != "persona.a" {
t.Errorf("owner persona = %q, want persona.a", items[0].PersonaID)
}
@@ -66,7 +66,7 @@ func TestStore_AddScoped_Persona_跨角色写_异常(t *testing.T) {
t.Fatalf("AddScoped persona.a: %v", err)
}
// persona.b cannot WRITE persona.a's persona-scope item.
// persona.b 不能写 persona.a 的角色作用域条目。
_, err := s.AddScoped(ctx, "persona.b", MemoryItem{
PersonaID: "persona.a", Scope: ScopePersona, Kind: KindRelationship,
Content: "b想改a的日常",
@@ -81,7 +81,7 @@ func TestStore_AddScoped_UserProject_人人写(t *testing.T) {
ctx := context.Background()
s := newTestStore(t)
// Any persona may write a user- or project-scope item.
// 任何角色都可以写用户或项目作用域的条目。
for _, sc := range []Scope{ScopeUser, ScopeProject} {
item, err := s.AddScoped(ctx, "persona.b", MemoryItem{
Scope: sc, Kind: KindWorldEvent, Content: "共享-" + string(sc),
@@ -89,7 +89,7 @@ func TestStore_AddScoped_UserProject_人人写(t *testing.T) {
if err != nil {
t.Fatalf("AddScoped %s: %v", sc, err)
}
// PersonaID was auto-filled with the acting actor.
// PersonaID 已用实施动作者自动填充。
if item.PersonaID != "persona.b" {
t.Errorf("AddScoped %s owner = %q, want persona.b", sc, item.PersonaID)
}
@@ -145,12 +145,12 @@ func TestStore_DeleteScoped_跨角色_异常(t *testing.T) {
t.Fatalf("AddScoped persona.a: %v", err)
}
// persona.a deletes its own item.
// persona.a 删除自己的条目。
if err := s.DeleteScoped(ctx, "persona.a", stored.ID); err != nil {
t.Fatalf("DeleteScoped owner: %v", err)
}
// Re-add, then persona.b cannot delete persona.a's item.
// 重新添加,然后 persona.b 不能删除 persona.a 的条目。
stored2, err := s.AddScoped(ctx, "persona.a", MemoryItem{
Scope: ScopePersona, Kind: KindRelationship, Content: "a的日常2",
})
@@ -160,7 +160,7 @@ func TestStore_DeleteScoped_跨角色_异常(t *testing.T) {
if err := s.DeleteScoped(ctx, "persona.b", stored2.ID); !errors.Is(err, ErrReadOnly) {
t.Fatalf("DeleteScoped cross-persona err = %v, want ErrReadOnly", err)
}
// The foreign item survives.
// 他人的条目依然存在。
if _, err := s.Get(ctx, stored2.ID); err != nil {
t.Fatalf("foreign item removed: %v", err)
}