返回 DeepSeek-Reasonix
snip_test.go
根目录 / benchmarks / compaction / snip_test.go
1 package main
2
3 import (
4 "strings"
5 "testing"
6 )
7
8 // Automatic snip projections are gone. SnipStaleToolResults remains as a no-op
9 // so older harness flags and call sites do not panic or rewrite history.
10 func TestSnipIsNoOp(t *testing.T) {
11 dir, cleanup, err := tempDir()
12 if err != nil {
13 t.Fatal(err)
14 }
15 defer cleanup()
16
17 rec := &callRecorder{}
18 const window = 64_000
19 h := newHarness(dir, &scriptedProvider{rec: rec, reply: syntheticDigest, window: window}, window, rec, arms{snip: true})
20 for gen := range 3 {
21 growSession(h.sess, gen, probeSuite())
22 }
23 before := renderAll(h.sess.Snapshot())
24 if !strings.Contains(before, "beta-7d21") {
25 t.Fatal("planted fact missing before the snip call")
26 }
27 st, err := h.agentA.SnipStaleToolResults()
28 if err != nil {
29 t.Fatal(err)
30 }
31 if st.Results != 0 || st.SavedChars != 0 {
32 t.Fatalf("snip no-op rewrote history: results=%d chars=%d", st.Results, st.SavedChars)
33 }
34 after := renderAll(h.sess.Snapshot())
35 if after != before {
36 t.Fatal("canonical transcript changed after SnipStaleToolResults")
37 }
38 if !strings.Contains(after, "beta-7d21") {
39 t.Error("planted fact missing after snip no-op")
40 }
41 }
42
42 lines GO