fix(memory): 读侧过 status 闸 —— 软删行不再被检索、不再进面板
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

整理(tidy)与入库前审查(D3)都只做软动作:status 改 merged/archived,
正文一个字不改、行一行不删。因此只要有一条「能看到什么记忆」的读路径
漏了 status 闸,清理就等于白清 —— 生产库上那 10 条 merged 行就是反例。

- store.go:ListByPersona / List 加 status='active'
- rules.go:ListScope / ListProject 加 status='active'
- Get 刻意不过闸(撤销软合并要先读得到被吸收的行),并在注释里写明
- gateway/admin.go collectMemories 只加注释:口径只有一处,不重复过滤

验证:go build ./... + go vet 绿;memory 包全量测试绿;
新增 status_gate_test.go(4 条读路径逐条断言 + Retriever 端到端
「内容逐字相同的两条,软合并后只召回一条」+ Get 反向护栏);
用 -overlay 把闸门变异成恒真 ⇒ 5 个读路径用例与检索端到端用例全红。
This commit is contained in:
AskaEth committed 2026-10-07 09:48:37 +08:00
1 parent c2e413ec38
commit 9126d653e5
4 files changed
+233 -11

No files matched your search

+4
View File
@@ -211,6 +211,10 @@ func (s *Server) collectSessions(ctx context.Context) []SessionSummary {
}
// collectMemories 从已配置的存储返回非 nil 的记忆切片。
//
// 存储层的 List 已经过 status 闸(只给在册条目),因此面板记忆列表天然
// 不显示被软合并/被归档的行 —— 这里刻意**不加**第二次过滤,避免两处
// 口径各自漂移(design/23 §8/§10)。
func (s *Server) collectMemories(ctx context.Context) []MemorySummary {
out := make([]MemorySummary, 0)
if s.memories == nil {