Address ULID review: display, fetch-hint, docs, id-const, lazy mint · Entire

Address ULID review: display, fetch-hint, docs, id-const, lazy mint

c6fd45b→main· Soph·1w ago·8 files·+136 added/-34 removed

Follow-ups from review of the git-refs ULID-emission PR (the id-kind read-routing item, #1, and the write-boundary kind guard, #2, are deferred — see below):

Deferred to the id-kind read-routing follow-up (tracked separately):

Tests: TestCheckpointID_DisplayShort, TestAttributionCheckpointColumnWidth.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

14006b64f8d1View transcript

?\ Build Checkpoints Store Based on DesignClaude Code·Opus 4.8[1m]·1 step

Changes

8

return suggestFetchCommand(ctx, refName.String()+":"+refName.String())

// suggestFetchCommand builds a "git fetch " hint, preferring // the configured checkpoint remote URL when available and falling back to origin. // suggestFetchCommand builds a "git fetch " hint. It resolves // the target the same way attach's own fetch does (resolveCheckpointFetchTarget: // the checkpoint-remote/token URL if any, else origin) so the pasteable command // points at the remote the fetch actually used — not a bare "origin" that fails // in a token-only environment with an SSH origin.

func suggestFetchCommand(ctx context.Context, refspec string) string { if remote.Configured(ctx) { if url, err := remote.FetchURL(ctx); err == nil && url != "" { return fmt.Sprintf("git fetch %s %s", url, refspec) } } return "git fetch origin " + refspec return fmt.Sprintf("git fetch %s %s", resolveCheckpointFetchTarget(ctx), refspec) }

func resolveCheckpointID(ctx context.Context, headCommit *object.Commit) (id.CheckpointID, bool) {


```go
func renderAttributionBlameLong(w io.Writer, result *fileAttributionResult, lineFlag string) {
    renderAttributionBlameTable(w, result, lineFlag, func(sty statusStyles) {
        lineWidth := attributionLineColumnWidth(result.Lines)
        const checkpointColumnWidth = 21
        fmt.Fprintf(w, "  %*s  Tag   %-12s  %-18s  %-16s  %-21s    Content\n",
            lineWidth, "Line", "Agent", "Model", "Author", "Checkpoint/Session")
        fmt.Fprintf(w, "  %s\n", sty.render(sty.dim, strings.Repeat("─", lineWidth+92)))
        // Size the Checkpoint/Session column to its content so a ULID checkpoint
        // (26 chars, vs a 12-hex ID) is not front-truncated into an unresolvable,
        // session-less prefix. The other columns sum to 71 alongside these two.
        cpWidth := attributionCheckpointColumnWidth(result.Lines)
        ruleWidth := lineWidth + cpWidth + 71
        fmt.Fprintf(w, "  %*s  Tag   %-12s  %-18s  %-16s  %-*s    Content\n",
            lineWidth, "Line", "Agent", "Model", "Author", cpWidth, "Checkpoint/Session")
        fmt.Fprintf(w, "  %s\n", sty.render(sty.dim, strings.Repeat("─", ruleWidth)));

for _, line := range result.Lines {
            fmt.Fprintf(w, "  %s  %s  %-12s  %-18s  %-16s  %-21s  %s %s\n",
            fmt.Fprintf(w, "  %s  %s  %-12s  %-18s  %-16s  %-*s  %s %s\n",
                sty.render(sty.dim, fmt.Sprintf("%*d", lineWidth, line.LineNumber)),
                renderAttributionTag(sty, line.Authorship),
                stringutil.TruncateRunes(line.Agent, 12, ""),
                stringutil.TruncateRunes(line.Model, 18, ""),
                stringutil.TruncateRunes(shortAuthorName(line.Author), 16, ""),
                stringutil.TruncateRunes(shortCheckpointSession(line), checkpointColumnWidth, ""),
                cpWidth, shortCheckpointSession(line),
                sty.render(sty.dim, attributionLineMarker(line)),
                renderAttributionContent(sty, line),
            )
        }

fmt.Fprintf(w, "  %s\n", sty.render(sty.dim, strings.Repeat("─", lineWidth+92)))
        fmt.Fprintf(w, "  %s\n", sty.render(sty.dim, strings.Repeat("─", ruleWidth)))
    })
}

// attributionCheckpointColumnWidth sizes the Checkpoint/Session column to the
// widest value it must show (header label or any rendered checkpoint/session),
// so ULID checkpoints render in full rather than being clipped to a 12-hex width.
func attributionCheckpointColumnWidth(lines []attributionLine) int {
    w := len("Checkpoint/Session")
    for i := range lines {
        if n := len(shortCheckpointSession(lines[i])); n > w {
            w = n
        }
    }
    return w
}

func renderAttributionSummary(w io.Writer, sty statusStyles, summary attributionSummary, lineFlag string) {
    parts := []string{
        sty.render(sty.green, fmt.Sprintf("AI: %d (%d%%)", summary.AILines, summary.AIPercentage)),
    }