Skip to content

Commit da340e4

Browse files
fix(linear): widen issue title/url columns to avoid truncation
_tool_linear_issues.title and .url were varchar(255), but Linear titles can exceed 255 chars (and the issue URL embeds a title slug), so extraction failed with 'Error 1406: Data too long for column title'. Drop the varchar limit so both are longtext, matching the domain issues.title and jira's tool summary. Adds an e2e test extracting a 300-char title without truncation. Signed-off-by: Eduardo Rodrigues <2961314+eduardoarantes@users.noreply.github.com>
1 parent adfbd25 commit da340e4

4 files changed

Lines changed: 61 additions & 4 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package e2e
19+
20+
import (
21+
"testing"
22+
23+
"github.com/apache/incubator-devlake/core/dal"
24+
"github.com/apache/incubator-devlake/helpers/e2ehelper"
25+
"github.com/apache/incubator-devlake/plugins/linear/impl"
26+
"github.com/apache/incubator-devlake/plugins/linear/models"
27+
"github.com/apache/incubator-devlake/plugins/linear/tasks"
28+
"github.com/stretchr/testify/assert"
29+
)
30+
31+
// TestLinearIssueLongTitle guards against truncation/insert failure for long
32+
// issue titles and URLs. Linear titles can exceed 255 chars (and the issue URL
33+
// embeds a title slug), which overflowed the old varchar(255) columns and
34+
// failed extraction with "Data too long for column 'title'". The columns are
35+
// now untyped (longtext), matching the domain issues.title and jira's tool
36+
// summary.
37+
func TestLinearIssueLongTitle(t *testing.T) {
38+
var linear impl.Linear
39+
dataflowTester := e2ehelper.NewDataFlowTester(t, "linear", linear)
40+
41+
taskData := &tasks.LinearTaskData{
42+
Options: &tasks.LinearOptions{ConnectionId: 1, TeamId: "team-1"},
43+
}
44+
45+
dataflowTester.FlushTabler(&models.LinearIssue{})
46+
dataflowTester.FlushTabler(&models.LinearIssueLabel{})
47+
dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_linear_issues_long_title.csv", "_raw_linear_issues")
48+
// must not error with "Data too long for column 'title'"
49+
dataflowTester.Subtask(tasks.ExtractIssuesMeta, taskData)
50+
51+
var issue models.LinearIssue
52+
err := dataflowTester.Dal.First(&issue, dal.Where("connection_id = ? AND id = ?", 1, "issue-longtitle"))
53+
assert.NoError(t, err)
54+
assert.Len(t, issue.Title, 300, "full 300-char title must be stored untruncated")
55+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,params,data,url,input,created_at
2+
1,"{""ConnectionId"":1,""TeamId"":""team-1""}","{""Id"":""issue-longtitle"",""Identifier"":""ENG-LONG"",""Number"":900,""Title"":""TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"",""Description"":""long title row"",""Url"":""https://linear.app/eng/issue/ENG-LONG/tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"",""Priority"":0,""Estimate"":null,""CreatedAt"":""2026-05-01T00:00:00Z"",""UpdatedAt"":""2026-05-01T00:00:00Z"",""StartedAt"":null,""CompletedAt"":null,""CanceledAt"":null,""State"":{""Id"":""state-backlog"",""Name"":""Backlog"",""Type"":""backlog""},""Assignee"":null,""Creator"":null,""Cycle"":null,""Parent"":null,""Labels"":{""Nodes"":[]}}",https://api.linear.app/graphql,null,2026-05-01 00:00:00.000

backend/plugins/linear/models/issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ type LinearIssue struct {
3030
TeamId string `gorm:"index;type:varchar(255)" json:"teamId"`
3131
Identifier string `gorm:"type:varchar(255)" json:"identifier"`
3232
Number int `json:"number"`
33-
Title string `gorm:"type:varchar(255)" json:"title"`
33+
Title string `json:"title"`
3434
Description string `json:"description"`
35-
Url string `gorm:"type:varchar(255)" json:"url"`
35+
Url string `json:"url"`
3636
Priority int `json:"priority"`
3737
PriorityLabel string `gorm:"type:varchar(100)" json:"priorityLabel"`
3838
Estimate *float64 `json:"estimate"`

backend/plugins/linear/models/migrationscripts/archived/models.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ type LinearIssue struct {
7676
TeamId string `gorm:"index;type:varchar(255)"`
7777
Identifier string `gorm:"type:varchar(255)"`
7878
Number int
79-
Title string `gorm:"type:varchar(255)"`
79+
Title string
8080
Description string
81-
Url string `gorm:"type:varchar(255)"`
81+
Url string
8282
Priority int
8383
PriorityLabel string `gorm:"type:varchar(100)"`
8484
Estimate *float64

0 commit comments

Comments
 (0)