fix token profile review feedback · Entire
fix token profile review feedback
2c727f2·
peyton-alt·3w ago·2 files·+17 added/-0 removed
Sessions
e945a42148c6View transcript
Changes
2
cmd/entire/cli
Mtokens_profile.go+2
Mtokens_profile_test.go+15
95 unmodified lines
96
97
98
99
100
101
102
7 unmodified lines
110
111
112
113
114
115
116
95 unmodified lines
cmd.Flags().BoolVar(&jsonFlag, "json", false, "Output as JSON")
cmd.Flags().IntVar(&limitFlag, "limit", 50, "Maximum committed checkpoints to analyze")
cmd.Flags().BoolVar(&allFlag, "all", false, "Analyze all committed checkpoints")
cmd.MarkFlagsMutuallyExclusive("limit", "all")
return cmd
}
7 unmodified lines
defer repo.Close()
store := checkpoint.NewCommittedReadStore(ctx, repo)
store.SetBlobFetcher(FetchBlobsByHash)
infos, err := store.ListCommitted(ctx)
if err != nil {
return fmt.Errorf("failed to list checkpoints: %w", err)
Mcmd/entire/cli/tokens_profile.go+2
176 unmodified lines
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
176 unmodified lines
}
}
func TestTokensProfileCmd_LimitAndAllAreMutuallyExclusive(t *testing.T) {
runExplainAutoTestRepo(t)
cmd := newTokensGroupCmd()
cmd.SetArgs([]string{"profile", "--limit", "2", "--all"})
err := cmd.ExecuteContext(context.Background())
if err == nil {
t.Fatal("expected error for --limit with --all")
}
if !strings.Contains(err.Error(), "limit") || !strings.Contains(err.Error(), "all") {
t.Fatalf("expected error to mention limit and all, got: %v", err)
}
}
func TestTokensProfileCmd_EmptyHistory(t *testing.T) {
runExplainAutoTestRepo(t)