Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/service/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ func convertIssueDetails(details []core.IssueWithDetails) []core.Issue {
Name string `json:"name"`
}{ID: d.State.ID, Name: d.State.Name},
Priority: &priority,
Estimate: d.Estimate,
DueDate: d.DueDate,
Assignee: d.Assignee,
Delegate: d.Delegate,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
}
Expand Down
80 changes: 80 additions & 0 deletions internal/service/issue_convert_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package service

import (
"testing"

"github.com/joa23/linear-cli/pkg/linear/core"
)

// TestConvertIssueDetails_CarriesDueDateEstimateDelegate is a regression test
// for TL-563: ListAllIssues's IssueWithDetails carried DueDate/Estimate/Delegate,
// but convertIssueDetails (used by ListAssignedWithPagination) dropped them
// when converting to core.Issue, which would have silently undone the fix one
// layer up. The fixture below starts with all three fields already populated
// (not both-nil, which would pass trivially) to catch a half-applied fix.
func TestConvertIssueDetails_CarriesDueDateEstimateDelegate(t *testing.T) {
estimate := 3.5
dueDate := "2026-09-01"
details := []core.IssueWithDetails{
{
ID: "issue-1",
Identifier: "TL-1",
Title: "Issue with due date, estimate, and delegate",
Priority: 2,
Estimate: &estimate,
DueDate: &dueDate,
Delegate: &core.User{ID: "delegate-1", Name: "Bot", Email: "bot@example.com"},
CreatedAt: "2026-01-01T00:00:00Z",
UpdatedAt: "2026-01-02T00:00:00Z",
},
}

issues := convertIssueDetails(details)

if len(issues) != 1 {
t.Fatalf("expected 1 issue, got %d", len(issues))
}
got := issues[0]

if got.Estimate == nil || *got.Estimate != estimate {
t.Errorf("Estimate = %v, want %v", got.Estimate, estimate)
}
if got.DueDate == nil || *got.DueDate != dueDate {
t.Errorf("DueDate = %v, want %v", got.DueDate, dueDate)
}
if got.Delegate == nil || got.Delegate.ID != "delegate-1" {
t.Errorf("Delegate = %v, want ID \"delegate-1\"", got.Delegate)
}
}

// TestConvertIssueDetails_OmitsUnsetDueDateEstimateDelegate confirms issues
// without these fields set continue to convert to nil, not false positives.
func TestConvertIssueDetails_OmitsUnsetDueDateEstimateDelegate(t *testing.T) {
details := []core.IssueWithDetails{
{
ID: "issue-2",
Identifier: "TL-2",
Title: "Issue without due date, estimate, or delegate",
Priority: 1,
CreatedAt: "2026-01-01T00:00:00Z",
UpdatedAt: "2026-01-02T00:00:00Z",
},
}

issues := convertIssueDetails(details)

if len(issues) != 1 {
t.Fatalf("expected 1 issue, got %d", len(issues))
}
got := issues[0]

if got.Estimate != nil {
t.Errorf("Estimate = %v, want nil", got.Estimate)
}
if got.DueDate != nil {
t.Errorf("DueDate = %v, want nil", got.DueDate)
}
if got.Delegate != nil {
t.Errorf("Delegate = %v, want nil", got.Delegate)
}
}
3 changes: 3 additions & 0 deletions pkg/linear/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,13 @@ type IssueWithDetails struct {
Title string `json:"title"`
Description string `json:"description"`
Priority int `json:"priority"`
Estimate *float64 `json:"estimate,omitempty"`
DueDate *string `json:"dueDate,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
State WorkflowState `json:"state"`
Assignee *User `json:"assignee,omitempty"`
Delegate *User `json:"delegate,omitempty"`
Labels []Label `json:"labels"`
Project *Project `json:"project,omitempty"`
Team Team `json:"team"`
Expand Down
37 changes: 32 additions & 5 deletions pkg/linear/issues/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,13 @@ func (ic *Client) ListAssignedIssues(limit int) ([]core.Issue, error) {
name
email
}
delegate {
id
name
email
}
estimate
dueDate
createdAt
updatedAt
url
Expand Down Expand Up @@ -831,7 +838,7 @@ func (ic *Client) ListAssignedIssues(limit int) ([]core.Issue, error) {
}
}
`

// Filter for issues assigned to the current user
// Why: The "me" identifier is Linear's way of referring to the
// authenticated user without needing to know their specific ID.
Expand Down Expand Up @@ -907,6 +914,14 @@ func (ic *Client) SearchIssuesEnhanced(filters *core.IssueSearchFilters) (*core.
name
email
}
delegate {
id
name
email
}
priority
estimate
dueDate
labels {
nodes {
id
Expand All @@ -918,7 +933,6 @@ func (ic *Client) SearchIssuesEnhanced(filters *core.IssueSearchFilters) (*core.
}
}
}
priority
createdAt
updatedAt
url
Expand Down Expand Up @@ -1886,7 +1900,6 @@ func (ic *Client) ListAllIssues(filter *core.IssueFilter) (*core.ListAllIssuesRe
identifier
title
description
priority
createdAt
updatedAt
state {
Expand All @@ -1912,6 +1925,14 @@ func (ic *Client) ListAllIssues(filter *core.IssueFilter) (*core.ListAllIssuesRe
createdAt
isMe
}
delegate {
id
name
email
}
priority
estimate
dueDate
labels {
nodes {
id
Expand Down Expand Up @@ -1972,14 +1993,17 @@ func (ic *Client) ListAllIssues(filter *core.IssueFilter) (*core.ListAllIssuesRe
Title string `json:"title"`
Description string `json:"description"`
Priority int `json:"priority"`
Estimate *float64 `json:"estimate,omitempty"`
DueDate *string `json:"dueDate,omitempty"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
State core.WorkflowState `json:"state"`
Assignee *core.User `json:"assignee"`
Assignee *core.User `json:"assignee,omitempty"`
Delegate *core.User `json:"delegate,omitempty"`
Labels struct {
Nodes []core.Label `json:"nodes"`
} `json:"labels"`
Project *core.Project `json:"project"`
Project *core.Project `json:"project,omitempty"`
Team core.Team `json:"team"`
} `json:"nodes"`
PageInfo struct {
Expand Down Expand Up @@ -2010,10 +2034,13 @@ func (ic *Client) ListAllIssues(filter *core.IssueFilter) (*core.ListAllIssuesRe
Title: node.Title,
Description: node.Description,
Priority: node.Priority,
Estimate: node.Estimate,
DueDate: node.DueDate,
CreatedAt: node.CreatedAt,
UpdatedAt: node.UpdatedAt,
State: node.State,
Assignee: node.Assignee,
Delegate: node.Delegate,
Labels: node.Labels.Nodes,
Project: node.Project,
Team: node.Team,
Expand Down
Loading