reject checkpoint token self-comparison · Entire
reject checkpoint token self-comparison
0a3a7e9·
peyton-alt·3w ago·2 files·+33 added/-0 removed
Sessions
caff12e75277View transcript
[?
okay proceedCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ed29b-5de8-7272-9e6c-89a843c92842#timeline-caff12e75277/index.html)
Changes
2
cmd/entire/cli
Mcheckpoint_tokens.go+4
Msessions_test.go+29
111 unmodified lines
112
113
114
115
116
117
118
119
120
121
111 unmodified lines
if err != nil {
return tokenCommandError(err)
}
if baselineReport.CheckpointID == report.CheckpointID {
cmd.SilenceUsage = true
return fmt.Errorf("cannot compare checkpoint %s to itself", report.CheckpointID)
}
report.Comparison = buildCheckpointTokensComparison(report, baselineReport)
}
Mcmd/entire/cli/checkpoint_tokens.go+4
2249 unmodified lines
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2249 unmodified lines
}
}
func TestCheckpointTokensCmd_RejectsSelfComparison(t *testing.T) {
repo, _ := runExplainAutoTestRepo(t)
ctx := context.Background()
store := checkpoint.NewGitStore(repo, checkpoint.DefaultV1Refs())
cpID := id.MustCheckpointID("abc222abc222")
writeCommittedTokenCheckpoint(ctx, t, store, cpID, "checkpoint-token-self-compare", &agent.TokenUsage{
InputTokens: 100,
OutputTokens: 50,
APICallCount: 1,
})
cmd := newCheckpointGroupCmd()
var stdout bytes.Buffer
cmd.SetOut(&stdout)
cmd.SetArgs([]string{"tokens", "abc222", "--compare", "abc222abc222"})
err := cmd.ExecuteContext(ctx)
if err == nil {
t.Fatal("expected self-comparison error, got nil")
}
if !strings.Contains(err.Error(), "cannot compare checkpoint abc222abc222 to itself") {
t.Fatalf("expected self-comparison error, got: %v", err)
}
if stdout.Len() != 0 {
t.Fatalf("expected no report output for self-comparison, got:\n%s", stdout.String())
}
}
func TestCheckpointTokensCmd_JSONOutputWithComparison(t *testing.T) {
repo, _ := runExplainAutoTestRepo(t)
ctx := context.Background()