fix(trail): propagate URL in ToMetadata (PR review finding) · Entire

fix(trail): propagate URL in ToMetadata (PR review finding)

dd68ce0→main·

toothbrush·3w ago·2 files·+7 added/-1 removed

ToMetadata() dropped r.URL, so server-provided URLs were silently lost anywhere relying on it and callers had to patch URL by hand. Propagate it; the list path still overrides with a constructed fallback for older servers.

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

Sessions

07c424e6eeacView transcript

[?
Add Web URLs to Trail CommandsClaude Code·1 step](/content/gh/entireio/cli/session/18a97739-bf62-4c0b-9cf2-9a1673f59583#timeline-07c424e6eeac/index.html)

Changes

2

58 unmodified lines

59
60
61
62
63
64
65

58 unmodified lines

m := &trail.Metadata{
        Number:    r.Number,
        TrailID:   trail.ID(r.ID),
        URL:       r.URL,
        Branch:    r.Branch,
        Base:      r.Base,
        Title:     r.Title,

Mcmd/entire/cli/api/trail_types.go+1

45 unmodified lines

46
47
48
49
49
50
51
52
53
54
55
56
57
58
59
60
61

45 unmodified lines

func TestTrailResourceToMetadataUsesID(t *testing.T) {

t.Parallel()

metadata := (&TrailResource{ID: "trail-db-id", Branch: "feature/x", Phase: "has_code"}).ToMetadata()
    metadata := (&TrailResource{ID: "trail-db-id", URL: "https://entire.io/gh/o/r/trails/9", Branch: "feature/x", Phase: "has_code"}).ToMetadata()
    if got := metadata.TrailID.String(); got != "trail-db-id" {
        t.Fatalf("metadata TrailID = %q, want stable API id", got)
    }
    if metadata.Phase != "has_code" {
        t.Fatalf("metadata Phase = %q, want has_code", metadata.Phase)
    }
    // The server-provided URL must propagate so callers relying on ToMetadata()
    // don't silently drop it.
    if metadata.URL != "https://entire.io/gh/o/r/trails/9" {
        t.Fatalf("metadata URL = %q, want propagated server url", metadata.URL)
    }
}

Mcmd/entire/cli/api/trail_types_test.go+6/-1