TestAdaptiveDepth verifies that tree depth shrinks proportionally with repo size, preventing hook startup from injecting massive tree output into context.
(t *testing.T)
| 103 | // TestAdaptiveDepth verifies that tree depth shrinks proportionally with repo size, |
| 104 | // preventing hook startup from injecting massive tree output into context. |
| 105 | func TestAdaptiveDepth(t *testing.T) { |
| 106 | tests := []struct { |
| 107 | name string |
| 108 | fileCount int |
| 109 | wantDepth int |
| 110 | }{ |
| 111 | {"unknown repo size defaults to shallow (0)", 0, 2}, |
| 112 | {"negative treated as unknown", -1, 2}, |
| 113 | {"small repo gets full depth", 100, 4}, |
| 114 | {"medium repo threshold (2001)", 2001, 3}, |
| 115 | {"large repo threshold (5001)", 5001, 2}, |
| 116 | {"exactly medium threshold (2000)", 2000, 4}, |
| 117 | {"exactly large threshold (5000)", 5000, 3}, |
| 118 | } |
| 119 | |
| 120 | for _, tt := range tests { |
| 121 | t.Run(tt.name, func(t *testing.T) { |
| 122 | got := AdaptiveDepth(tt.fileCount) |
| 123 | if got != tt.wantDepth { |
| 124 | t.Errorf("AdaptiveDepth(%d) = %d, want %d", tt.fileCount, got, tt.wantDepth) |
| 125 | } |
| 126 | }) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // TestHandoffBudgetForRepo verifies that handoff list sizes scale down for large |
| 131 | // repos to prevent context bloat in the session handoff output. |
nothing calls this directly
no test coverage detected