TestReadFileTruncatesOversizeContent: ReadFile obeys the same Truncate head+tail cap as every other tool. Oversize content must carry the marker so the model re-reads a slice rather than trusting a silently-clipped blob.
(t *testing.T)
| 40 | // TestReadFileWindowsOversizeContent: a file past one window comes back as a |
| 41 | // contiguous HEAD plus the exact offset to continue from - never Truncate's |
| 42 | // head+tail with the middle dropped, which is the unrecoverable dead end |
| 43 | // offset/limit exists to remove. The result must also stay under |
| 44 | // ToolOutputCap*4 so Execute's Truncate can't re-fire on the window. |
| 45 | func TestReadFileWindowsOversizeContent(t *testing.T) { |
| 46 | dir := t.TempDir() |
| 47 | path := filepath.Join(dir, "big.txt") |
| 48 | var b strings.Builder |
| 49 | for i := range 5000 { |
| 50 | fmt.Fprintf(&b, "line %d padding padding padding\n", i) |
| 51 | } |
| 52 | if err := os.WriteFile(path, []byte(b.String()), 0o644); err != nil { |
| 53 | t.Fatal(err) |
| 54 | } |
| 55 | got := ReadFile(path, 0, 0) |
| 56 | if !strings.Contains(got, "Continue with read_file offset=") { |
| 57 | t.Fatalf("windowed read should name the next offset, got %d bytes without it", len(got)) |
| 58 | } |
| 59 | if strings.Contains(got, "───── truncated") { |
| 60 | t.Fatalf("windowed read must not fall through to head+tail truncation: %q", got[:200]) |
nothing calls this directly
no test coverage detected