Repository navigation
Expand file tree
/
Copy pathcall_continuation_test.go
More file actions
56 lines (54 loc) · 1.59 KB
/
Copy pathcall_continuation_test.go
File metadata and controls
56 lines (54 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package sessions
import (
"os"
"path/filepath"
"testing"
)
func TestReadCallSourceKeepsAppendContinuation(t *testing.T) {
for _, agent := range []string{"claude", "codex"} {
t.Run(agent, func(t *testing.T) {
d := setupCalls(t)
var path, extra string
if agent == "claude" {
path = filepath.Join(d.claude, "projects", "fixture", "session.jsonl")
writeLines(t, path, claudeMsg("one", "claude-opus-5-5", 10, 2, 30, 4, 1))
extra = claudeMsg("two", "claude-opus-5-5", 10, 2, 30, 4, 2)
} else {
path = filepath.Join(d.codex, "sessions", "rollout-2026-09-20T10-00-00-0190aaaa-1111-7222-8333-444455556666.jsonl")
writeLines(t, path, append(cxTurnLines(0, "t1", "gpt-6-astra", "high"), tokenCountLine(1, cxUse(100, 40, 0, 10, 2), cxUse(100, 40, 0, 10, 2)))...)
extra = tokenCountLine(2, cxUse(200, 80, 0, 20, 4), cxUse(100, 40, 0, 10, 2))
}
read := func() []Call {
t.Helper()
for _, source := range CallSources() {
if source.Path == path {
return ReadCallSource(source)
}
}
t.Fatal("source missing")
return nil
}
if cs := read(); len(cs) != 1 {
t.Fatal(cs)
}
if entry := callContinuations[path]; len(entry.state.Calls) != 0 {
t.Fatal("expanded calls retained")
}
before, err := os.Stat(callCachePath(path))
if err != nil {
t.Fatal(err)
}
appendText(t, path, extra+"\n")
if cs := read(); len(cs) != 2 {
t.Fatal(cs)
}
after, err := os.Stat(callCachePath(path))
if err != nil {
t.Fatal(err)
}
if !os.SameFile(before, after) {
t.Fatal("live append rebuilt the entire shard")
}
})
}
}