| 1 | package session |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // The production open and derived-query paths must stay independent of the |
| 10 | // explicit full-history compatibility boundary. Migration, export and |
| 11 | // diagnostics use StreamSession instead. |
| 12 | func TestFastReadPathsDoNotMaterializeFullHistory(t *testing.T) { |
| 13 | for _, path := range []string{"session_reader.go", "history_index.go", "search_index.go"} { |
| 14 | data, err := os.ReadFile(path) |
| 15 | if err != nil { |
| 16 | t.Fatal(err) |
| 17 | } |
| 18 | source := string(data) |
| 19 | for _, forbidden := range []string{".Snapshot()", ".History()", "materializeSnapshotMessages("} { |
| 20 | if strings.Contains(source, forbidden) { |
| 21 | t.Fatalf("%s reintroduced full-history call %q", path, forbidden) |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 |