cli: drop types and test helper orphaned by the dead-code sweep · Entire

cli: drop types and test helper orphaned by the dead-code sweep

830dd4c·

Soph·2w ago·3 files·+4 added/-35 removed

The interaction/checkpointDetail display types lost their last consumer with formatSessionInfo; createTempTranscript lost its callers with the GetTranscriptPosition tests. Name the repeated username literal in the search accessor test for goconst.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Sessions

f06be81196bfView transcript

Changes

3

213 unmodified lines

214
215
216
217
218
219
220
221
222
223
217
218
219
4 unmodified lines

224
225
226
234
235
236
237
238
239
240
241
242
243
244
245
246
247
227
228
229

213 unmodified lines

return full
}

// interaction holds a single prompt and its responses for display.
type interaction struct {
    Prompt    string
    Responses []string // Multiple responses can occur between tool calls
    Files     []string
}

// associatedCommit holds information about a git commit associated with a checkpoint.
type associatedCommit struct {
    SHA      string
4 unmodified lines

Date     time.Time
}

// checkpointDetail holds detailed information about a checkpoint for display.
type checkpointDetail struct {
    Index            int
    ShortID          string
    Timestamp        time.Time
    IsTaskCheckpoint bool
    Message          string
    // Interactions contains all prompt/response pairs in this checkpoint.
    // Most strategies have one, but shadow condensations may have multiple.
    Interactions []interaction
    // Files is the aggregate list of all files modified (for backwards compat)
    Files []string
}

func newExplainCmd() *cobra.Command {
    var sessionFlag string
    var commitFlag string

Mcmd/entire/cli/explain.go-21

457 unmodified lines

458
459
460
461
461
462
463
464
465
465
466
467
468
469
45 unmodified lines

515
516
517
517
518
519
520
521

457 unmodified lines

// AuthorUsername, when set and non-empty, wins over Author; a commit
    // subject wins over the prompt.
    username := "alice-gh"
    const usernameOverride = "alice-gh"
    username := usernameOverride
    subject := "fix: the bug"
    cp.Checkpoint.AuthorUsername = &username
    cp.Checkpoint.CommitSubject = &subject
    if cp.ResultAuthor() != "alice-gh" {
    if cp.ResultAuthor() != usernameOverride {
        t.Errorf("ResultAuthor with username = %q", cp.ResultAuthor())
    }
    if cp.ResultTitle() != "fix: the bug" {
45 unmodified lines

t.Errorf("session ResultAuthor without username = %q", ss.ResultAuthor())
    }
    ss.Session.AuthorUsername = &username
    if ss.ResultAuthor() != "alice-gh" {
    if ss.ResultAuthor() != usernameOverride {
        t.Errorf("session ResultAuthor = %q", ss.ResultAuthor())
    }
}

Mcmd/entire/cli/search/search_test.go+4/-3

1 unmodified line

2
3
4
5
5
6
7
59 unmodified lines

67
68
69
71
72
73
74
75
76
77
78
79
80
70
71
72

1 unmodified line

import (
    "context"
    "os"
    "path/filepath"
    "testing"
)
59 unmodified lines

}
}

func createTempTranscript(t *testing.T, content string) string {
    t.Helper()
    tmpDir := t.TempDir()
    tmpFile := filepath.Join(tmpDir, "transcript.jsonl")
    if err := os.WriteFile(tmpFile, []byte(content), 0o644); err != nil {
        t.Fatalf("failed to create temp file: %v", err)
    }
    return tmpFile
}

func TestAgentTranscriptPath(t *testing.T) {
    tests := []struct {
    name          string

Mcmd/entire/cli/transcript_test.go-11