remove dead GetAdditionalSessions chain · Entire

remove dead GetAdditionalSessions chain

7d974b2→main·

pfleidi·1mo ago·4 files·+0 added/-153 removed

ManualCommitStrategy.GetAdditionalSessions, getDescriptionFromShadowBranch, and getSessionDescriptionFromTree had no remaining production callers after the previous removal of ListSessions/GetSession. Delete them along with their callable-smoke-tests.

The 'SessionSource interface' the doc comment referenced was never a real interface — only the comment.

Sessions

7211866d53d2View transcript

[?
Finish Checkpoints v1.1 Topology CoverageClaude Code·Opus 4.7[1m]·1 step](/content/gh/entireio/cli/session/a38d5b65-e04c-4025-b7ec-8f2b68cd2df5#timeline-7211866d53d2/index.html)

Changes

4

1617 unmodified lines

1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1621
1622
1623

1617 unmodified lines

}
}

// TestManualCommitStrategyCallable verifies that the strategy's methods are callable
func TestManualCommitStrategyCallable(t *testing.T) {
    s := strategy.NewManualCommitStrategy()

// GetAdditionalSessions should exist and be callable
    _, err := s.GetAdditionalSessions(context.Background())
    if err != nil {
        t.Logf("GetAdditionalSessions returned error: %v", err)
    }
}

func TestFormatSessionInfo_CheckpointNumberingReversed(t *testing.T) {
    now := time.Now()
    session := &strategy.Session{

Mcmd/entire/cli/explain_test.go-11

1549 unmodified lines

1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1553
1554
1555

1549 unmodified lines

// See push_common.go and session_test.go for usage examples.

// getSessionDescriptionFromTree reads the first line of prompt.txt from a git tree.
// This is the tree-based equivalent of getSessionDescription (which reads from filesystem).
//
// If metadataDir is provided, looks for files at metadataDir/prompt.txt.
// If metadataDir is empty, first tries the root of the tree (for when the tree is already
// the session directory), then falls back to
// searching for .entire/metadata/*/prompt.txt (for full worktree trees).
func getSessionDescriptionFromTree(tree *object.Tree, metadataDir string) string {
    // Helper to read first line from a file in tree
    readFirstLine := func(path string) string {
        file, err := tree.File(path)
        if err != nil {
            return ""
        }
        content, err := file.Contents()
        if err != nil {
            return ""
        }
        lines := strings.SplitN(content, "\n", 2)
        if len(lines) > 0 && lines[0] != "" {
            return strings.TrimSpace(lines[0])
        }
        return ""
    }

// If metadataDir is provided, look there directly
    if metadataDir != "" {
        if desc := readFirstLine(metadataDir + "/" + paths.PromptFileName); desc != "" {
            return desc
        }
        return NoDescription
    }

// No metadataDir provided - first try looking at the root of the tree
    // (used when the tree is already the session directory)
    if desc := readFirstLine(paths.PromptFileName); desc != "" {
        return desc
    }

// Fall back to searching for .entire/metadata/*/prompt.txt
    // (used when the tree is the full worktree)
    var desc string
    //nolint:errcheck // We ignore errors here as we're just searching for a description
    _ = tree.Files().ForEach(func(f *object.File) error {
        if desc != "" {
            return nil // Already found description
        }
        name := f.Name
        if strings.Contains(name, ".entire/metadata/") && strings.HasSuffix(name, "/"+paths.PromptFileName) {
            content, err := f.Contents()
            if err != nil {
                return nil //nolint:nilerr // Skip files we can't read, continue searching
            }
            lines := strings.SplitN(content, "\n", 2)
            if len(lines) > 0 && lines[0] != "" {
                desc = strings.TrimSpace(lines[0])
            }
        }
        return nil
    })

if desc != "" {
        return desc
    }
    return NoDescription
}

// GetGitAuthorFromRepo retrieves the git user.name and user.email,
// checking both the repository-local config and the global ~/.gitconfig.
// Delegates to checkpoint.GetGitAuthorFromRepo — this wrapper exists so

Mcmd/entire/cli/strategy/common.go-67

102 unmodified lines

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168

102 unmodified lines

} return s.getCheckpointLog(ctx, checkpoint.CheckpointID) }

// GetAdditionalSessions implements SessionSource interface. // Returns active sessions from .git/entire-sessions/ that haven't yet been condensed. func (s *ManualCommitStrategy) GetAdditionalSessions(ctx context.Context) ([]*Session, error) { activeStates, err := s.listAllSessionStates(ctx) if err != nil { return nil, fmt.Errorf("failed to list session states: %w", err) }

if len(activeStates) == 0 { return nil, nil }

var sessions []*Session for _, state := range activeStates { session := &Session{ ID: state.SessionID, Description: NoDescription, Strategy: StrategyNameManualCommit, StartTime: state.StartedAt, }

// Try to get description from shadow branch if description := s.getDescriptionFromShadowBranch(ctx, state.SessionID, state.BaseCommit, state.WorktreeID); description != "" { session.Description = description }

sessions = append(sessions, session) }

return sessions, nil }

// getDescriptionFromShadowBranch reads the session description from the shadow branch. // sessionID is expected to be an Entire session ID (already date-prefixed like "2026-01-12-abc123"). func (s *ManualCommitStrategy) getDescriptionFromShadowBranch(ctx context.Context, sessionID, baseCommit, worktreeID string) string { repo, err := OpenRepository(ctx) if err != nil { return "" } defer repo.Close()

shadowBranchName := getShadowBranchNameForCommit(baseCommit, worktreeID) refName := plumbing.NewBranchReferenceName(shadowBranchName) ref, err := repo.Reference(refName, true) if err != nil { return "" }

commit, err := repo.CommitObject(ref.Hash()) if err != nil { return "" }

tree, err := commit.Tree() if err != nil { return "" }

// Use the session ID directly as the metadata directory name metadataDir := paths.SessionMetadataDirFromSessionID(sessionID) return getSessionDescriptionFromTree(tree, metadataDir) }


Mcmd/entire/cli/strategy/manual_commit_logs.go-63

1 2 3 4 4 5 6 97 unmodified lines

104 105 106 108 109 110 111 112 113 114 115 116 117 118

package strategy

import ( "context" "testing" "time"

97 unmodified lines

t.Errorf("expected ToolUseID to match, got %s", taskCheckpoint.ToolUseID) } }

// TestManualCommitStrategyGetAdditionalSessions verifies that GetAdditionalSessions is callable func TestManualCommitStrategyGetAdditionalSessions(t *testing.T) { strat := NewManualCommitStrategy()

// GetAdditionalSessions should be callable _, err := strat.GetAdditionalSessions(context.Background()) if err != nil { t.Logf("GetAdditionalSessions returned error: %v", err) } }