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:
1 parent
355f81d04a
commit
91e8d7a029
44 files changed
+1315
-1315
No files matched your search
@@ -10,8 +10,8 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// seedMemories fills the store with one memory per scope so a test can assert the
|
||||
// scope filtering of the memory gate.
|
||||
// seedMemories 为每个作用域各填一条记忆到 store,使测试能断言
|
||||
// 记忆门的作用域过滤。
|
||||
func seedMemories(t *testing.T, store *memory.Store) {
|
||||
t.Helper()
|
||||
ctx := context.Background()
|
||||
@@ -27,8 +27,8 @@ func seedMemories(t *testing.T, store *memory.Store) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestInjectMemory_OwnerEnv_InjectsAllScopes proves the owner-full env keeps the
|
||||
// pre-existing full recall: user, persona and project memories are all injected.
|
||||
// TestInjectMemory_OwnerEnv_InjectsAllScopes 证明 owner 全权限环境保持
|
||||
// 既有的完整召回:用户、角色与项目记忆都被注入。
|
||||
func TestInjectMemory_OwnerEnv_InjectsAllScopes(t *testing.T) {
|
||||
t.Parallel()
|
||||
store := newTestMemoryStore(t)
|
||||
@@ -49,9 +49,9 @@ func TestInjectMemory_OwnerEnv_InjectsAllScopes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestInjectMemory_RestrictedEnv_OnlyProject proves the group-chat/stranger env is
|
||||
// read-only isolation: only the non-owner-private project memory is injected, the
|
||||
// owner's user/persona memory is excluded, and the block is marked 群聊隔离.
|
||||
// TestInjectMemory_RestrictedEnv_OnlyProject 证明群聊/陌生人环境是
|
||||
// 只读隔离:只注入非主人私有的项目记忆,
|
||||
// 主人的用户/角色记忆被排除,且该块被标记为 群聊隔离。
|
||||
func TestInjectMemory_RestrictedEnv_OnlyProject(t *testing.T) {
|
||||
t.Parallel()
|
||||
store := newTestMemoryStore(t)
|
||||
@@ -75,13 +75,13 @@ func TestInjectMemory_RestrictedEnv_OnlyProject(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestInjectMemory_Restricted_NoProjectMemory_NoInject proves that when a group
|
||||
// or stranger context has no non-owner-private (project) memory, nothing is
|
||||
// injected — the conversation is not seeded with owner context.
|
||||
// TestInjectMemory_Restricted_NoProjectMemory_NoInject 证明当群聊
|
||||
// 或陌生人上下文没有非主人私有(项目)记忆时,什么也不
|
||||
// 注入 —— 该对话不会用主人的上下文来播种。
|
||||
func TestInjectMemory_Restricted_NoProjectMemory_NoInject(t *testing.T) {
|
||||
t.Parallel()
|
||||
store := newTestMemoryStore(t)
|
||||
// Only owner-private (user/persona) memory exists.
|
||||
// 只存在主人私有(用户/角色)记忆。
|
||||
for _, it := range []memory.MemoryItem{
|
||||
{PersonaID: "persona-a", Content: "用户习惯:喜欢冰美式", Scope: memory.ScopeUser, Kind: memory.KindRelationship},
|
||||
} {
|
||||
@@ -99,8 +99,8 @@ func TestInjectMemory_Restricted_NoProjectMemory_NoInject(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractMemory_OwnerEnv_Writes proves the owner-full env persists extracted
|
||||
// memory as before.
|
||||
// TestExtractMemory_OwnerEnv_Writes 证明 owner 全权限环境像从前
|
||||
// 一样持久化提取出的记忆。
|
||||
func TestExtractMemory_OwnerEnv_Writes(t *testing.T) {
|
||||
t.Parallel()
|
||||
store := newTestMemoryStore(t)
|
||||
@@ -118,8 +118,8 @@ func TestExtractMemory_OwnerEnv_Writes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractMemory_RestrictedEnv_SkipsWrite proves the group-chat/stranger env
|
||||
// never writes shared memory: extraction is skipped, the store stays empty.
|
||||
// TestExtractMemory_RestrictedEnv_SkipsWrite 证明群聊/陌生人环境
|
||||
// 绝不写共享记忆:提取被跳过,store 保持为空。
|
||||
func TestExtractMemory_RestrictedEnv_SkipsWrite(t *testing.T) {
|
||||
t.Parallel()
|
||||
store := newTestMemoryStore(t)
|
||||
@@ -137,10 +137,10 @@ func TestExtractMemory_RestrictedEnv_SkipsWrite(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSessionEnvFrom_DefaultOwnerFull locks the backward-compatible default: a
|
||||
// context with no attached env resolves to the owner-full environment, so callers
|
||||
// that do not set an env (Web main session, internal automated tasks) keep full
|
||||
// memory read+write.
|
||||
// TestSessionEnvFrom_DefaultOwnerFull 钉住向后兼容的默认值:未挂载
|
||||
// env 的 context 解析为 owner 全权限环境,因此未设置 env 的
|
||||
// 调用方(Web 主会话、内部自动化任务)保持完整的
|
||||
// 记忆读写。
|
||||
func TestSessionEnvFrom_DefaultOwnerFull(t *testing.T) {
|
||||
t.Parallel()
|
||||
env := sessionEnvFrom(context.Background())
|
||||
|
||||
Reference in new issue
Block a user