返回 DeepSeek-Reasonix
memory_recall_audit_test.go
根目录 / internal / control / memory_recall_audit_test.go
1 package control
2
3 import (
4 "testing"
5
6 "reasonix/internal/agent"
7 "reasonix/internal/event"
8 "reasonix/internal/tool"
9 )
10
11 type recallAuditSink struct {
12 event.Sink
13 audits []event.MemoryRecallAudit
14 }
15
16 func (s *recallAuditSink) RecordMemoryRecall(a event.MemoryRecallAudit) {
17 s.audits = append(s.audits, a)
18 }
19
20 func TestComposeEmitsMemoryRecallAudit(t *testing.T) {
21 ag := agent.New(nil, tool.NewRegistry(), agent.NewSession("sys"), agent.Options{}, event.Discard)
22 sink := &recallAuditSink{Sink: event.Discard}
23 c := newOwnedTestController(t, Options{Runner: ag, Executor: ag, Sink: sink})
24 _ = c.Compose("what is the canonical fast check command")
25 if len(sink.audits) != 1 {
26 t.Fatalf("audits = %d, want exactly one recall audit per composed user turn", len(sink.audits))
27 }
28 if sink.audits[0].Suppressed == "" && len(sink.audits[0].Hits) == 0 {
29 t.Fatalf("audit must explain itself: %+v", sink.audits[0])
30 }
31 }
32
32 lines GO