Skip to content

Commit 56739f7

Browse files
committed
fix(cursor): Fix CI lint and e2e snapshots
* Remove plugin models import from key tier migration for migration-script-lint. * Use UTC ISO timestamps in AI code and BugBot e2e snapshot CSV fixtures. * Apply gofmt across the cursor plugin so golangci-lint formatting checks pass. * Type the connection form test-success setValues callback so config-ui tsc passes. Signed-off-by: Joshua Smith <jbsmith7741@gmail.com>
1 parent 786eaeb commit 56739f7

21 files changed

Lines changed: 185 additions & 183 deletions

‎backend/plugins/cursor/e2e/conversation_insights_extractors_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func TestCursorConversationInsightsExtractorsDataFlow(t *testing.T) {
5050
},
5151
Connection: &models.CursorConnection{
5252
CursorConn: models.CursorConn{
53-
RestConnection: helper.RestConnection{Endpoint: models.DefaultEndpoint},
54-
KeyTier: models.KeyTierEnterprise,
55-
HasConversationInsights: true,
53+
RestConnection: helper.RestConnection{Endpoint: models.DefaultEndpoint},
54+
KeyTier: models.KeyTierEnterprise,
55+
HasConversationInsights: true,
5656
},
5757
},
5858
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
connection_id,scope_id,change_id,user_id,user_email,source,model,total_lines_added,total_lines_deleted,ingested_at,metadata
2-
1,team,chg_001,user_ent123,dev@example.com,TAB,default,12,1,2026-08-20 15:00:00,"[{""fileName"":""main.go"",""lineStart"":10,""lineEnd"":15}]"
2+
1,team,chg_001,user_ent123,dev@example.com,TAB,default,12,1,2026-08-20T15:00:00.000+00:00,"[{""fileName"":""main.go"",""lineStart"":10,""lineEnd"":15}]"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
connection_id,scope_id,commit_hash,user_id,user_email,repo_name,branch_name,is_primary_branch,commit_source,total_lines_added,total_lines_deleted,tab_lines_added,tab_lines_deleted,composer_lines_added,composer_lines_deleted,non_ai_lines_added,non_ai_lines_deleted,commit_ts,ingested_at,message
2-
1,team,abc123def456,user_ent123,dev@example.com,github.com/org/repo,main,1,ide,120,10,40,2,50,5,30,3,2026-08-20 14:30:00,2026-08-20 14:31:00,Refactor: extract analytics client
2+
1,team,abc123def456,user_ent123,dev@example.com,github.com/org/repo,main,1,ide,120,10,40,2,50,5,30,3,2026-08-20T14:30:00.000+00:00,2026-08-20T14:31:00.000+00:00,Refactor: extract analytics client
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
connection_id,scope_id,request_id,timestamp,repo,repo_node_id,pr_number,commit_sha,bugs_found,cost_cents,dry_run,publication_status
2-
1,team,6e0d261c-86a2-4383-89f0-9162c1c10662,2026-06-29 19:42:18,github.com/your-org/your-repo,R_kgDOABCDEF,42,9f3c2a1b7d8e4f5061728394a5b6c7d8e9f0a1b2,2,42.5,0,posted
3-
1,team,a1b2c3d4-e5f6-7890-abcd-ef1234567890,2026-06-29 20:15:03,github.com/your-org/your-repo,R_kgDOABCDEF,42,9f3c2a1b7d8e4f5061728394a5b6c7d8e9f0a1b2,1,,1,dry_run
2+
1,team,6e0d261c-86a2-4383-89f0-9162c1c10662,2026-06-29T19:42:18.000+00:00,github.com/your-org/your-repo,R_kgDOABCDEF,42,9f3c2a1b7d8e4f5061728394a5b6c7d8e9f0a1b2,2,42.5,0,posted
3+
1,team,a1b2c3d4-e5f6-7890-abcd-ef1234567890,2026-06-29T20:15:03.000+00:00,github.com/your-org/your-repo,R_kgDOABCDEF,42,9f3c2a1b7d8e4f5061728394a5b6c7d8e9f0a1b2,1,,1,dry_run

‎backend/plugins/cursor/models/ai_code_change.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ type CursorAiCodeChange struct {
3030
ScopeId string `gorm:"primaryKey;type:varchar(255)" json:"scopeId"`
3131
ChangeId string `gorm:"primaryKey;type:varchar(255)" json:"changeId"`
3232

33-
UserId string `gorm:"type:varchar(255);index" json:"userId"`
34-
UserEmail string `gorm:"type:varchar(255);index" json:"userEmail"`
35-
Source string `gorm:"type:varchar(20)" json:"source"`
36-
Model string `gorm:"type:varchar(255)" json:"model"`
33+
UserId string `gorm:"type:varchar(255);index" json:"userId"`
34+
UserEmail string `gorm:"type:varchar(255);index" json:"userEmail"`
35+
Source string `gorm:"type:varchar(20)" json:"source"`
36+
Model string `gorm:"type:varchar(255)" json:"model"`
3737
TotalLinesAdded int `json:"totalLinesAdded"`
3838
TotalLinesDeleted int `json:"totalLinesDeleted"`
3939
IngestedAt *time.Time `gorm:"column:ingested_at" json:"createdAt"`

‎backend/plugins/cursor/models/ai_code_commit.go‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ type CursorAiCodeCommit struct {
3030
ScopeId string `gorm:"primaryKey;type:varchar(255)" json:"scopeId"`
3131
CommitHash string `gorm:"primaryKey;type:varchar(64)" json:"commitHash"`
3232

33-
UserId string `gorm:"type:varchar(255);index" json:"userId"`
34-
UserEmail string `gorm:"type:varchar(255);index" json:"userEmail"`
35-
RepoName string `gorm:"type:varchar(255)" json:"repoName"`
36-
BranchName string `gorm:"type:varchar(255)" json:"branchName"`
37-
IsPrimaryBranch *bool `json:"isPrimaryBranch"`
38-
CommitSource string `gorm:"type:varchar(20)" json:"commitSource"`
39-
TotalLinesAdded int `json:"totalLinesAdded"`
40-
TotalLinesDeleted int `json:"totalLinesDeleted"`
41-
TabLinesAdded int `json:"tabLinesAdded"`
42-
TabLinesDeleted int `json:"tabLinesDeleted"`
43-
ComposerLinesAdded int `json:"composerLinesAdded"`
44-
ComposerLinesDeleted int `json:"composerLinesDeleted"`
45-
NonAiLinesAdded *int `json:"nonAiLinesAdded"`
46-
NonAiLinesDeleted *int `json:"nonAiLinesDeleted"`
47-
CommitTs *time.Time `json:"commitTs"`
48-
IngestedAt *time.Time `gorm:"column:ingested_at" json:"createdAt"`
49-
Message string `gorm:"type:text" json:"message"`
33+
UserId string `gorm:"type:varchar(255);index" json:"userId"`
34+
UserEmail string `gorm:"type:varchar(255);index" json:"userEmail"`
35+
RepoName string `gorm:"type:varchar(255)" json:"repoName"`
36+
BranchName string `gorm:"type:varchar(255)" json:"branchName"`
37+
IsPrimaryBranch *bool `json:"isPrimaryBranch"`
38+
CommitSource string `gorm:"type:varchar(20)" json:"commitSource"`
39+
TotalLinesAdded int `json:"totalLinesAdded"`
40+
TotalLinesDeleted int `json:"totalLinesDeleted"`
41+
TabLinesAdded int `json:"tabLinesAdded"`
42+
TabLinesDeleted int `json:"tabLinesDeleted"`
43+
ComposerLinesAdded int `json:"composerLinesAdded"`
44+
ComposerLinesDeleted int `json:"composerLinesDeleted"`
45+
NonAiLinesAdded *int `json:"nonAiLinesAdded"`
46+
NonAiLinesDeleted *int `json:"nonAiLinesDeleted"`
47+
CommitTs *time.Time `json:"commitTs"`
48+
IngestedAt *time.Time `gorm:"column:ingested_at" json:"createdAt"`
49+
Message string `gorm:"type:text" json:"message"`
5050

5151
common.NoPKModel
5252
}

‎backend/plugins/cursor/models/bugbot_finding.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ type CursorBugBotFinding struct {
2828
RequestId string `gorm:"primaryKey;type:varchar(64)" json:"requestId"`
2929
FindingIndex int `gorm:"primaryKey" json:"findingIndex"`
3030

31-
CommentId string `gorm:"type:varchar(64)" json:"commentId"`
32-
ResolutionStatus string `gorm:"type:varchar(20)" json:"resolutionStatus"`
33-
Severity string `gorm:"type:varchar(20);index" json:"severity"`
34-
Title string `gorm:"type:varchar(500)" json:"title"`
35-
Description string `gorm:"type:text" json:"description"`
36-
Locations string `gorm:"type:text" json:"locations"`
31+
CommentId string `gorm:"type:varchar(64)" json:"commentId"`
32+
ResolutionStatus string `gorm:"type:varchar(20)" json:"resolutionStatus"`
33+
Severity string `gorm:"type:varchar(20);index" json:"severity"`
34+
Title string `gorm:"type:varchar(500)" json:"title"`
35+
Description string `gorm:"type:text" json:"description"`
36+
Locations string `gorm:"type:text" json:"locations"`
3737

3838
common.NoPKModel
3939
}

‎backend/plugins/cursor/models/connection.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ const (
4646
type CursorConn struct {
4747
helper.RestConnection `mapstructure:",squash"`
4848

49-
Token string `mapstructure:"token" json:"token"`
50-
KeyTier string `mapstructure:"keyTier" json:"keyTier" gorm:"type:varchar(20)"`
51-
HasBugbotReviews bool `mapstructure:"hasBugbotReviews" json:"hasBugbotReviews"`
52-
HasConversationInsights bool `mapstructure:"hasConversationInsights" json:"hasConversationInsights"`
53-
HasAiCodeCommitDetails bool `mapstructure:"hasAiCodeCommitDetails" json:"hasAiCodeCommitDetails"`
49+
Token string `mapstructure:"token" json:"token"`
50+
KeyTier string `mapstructure:"keyTier" json:"keyTier" gorm:"type:varchar(20)"`
51+
HasBugbotReviews bool `mapstructure:"hasBugbotReviews" json:"hasBugbotReviews"`
52+
HasConversationInsights bool `mapstructure:"hasConversationInsights" json:"hasConversationInsights"`
53+
HasAiCodeCommitDetails bool `mapstructure:"hasAiCodeCommitDetails" json:"hasAiCodeCommitDetails"`
5454
}
5555

5656
// SetupAuthentication uses HTTP Basic auth with the API key as username and an empty password.

‎backend/plugins/cursor/models/conversation_insight.go‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@ import (
2424
)
2525

2626
const (
27-
ConversationInsightTypeIntents = "intents"
28-
ConversationInsightTypeComplexity = "complexity"
29-
ConversationInsightTypeCategories = "categories"
30-
ConversationInsightTypeGuidanceLevels = "guidanceLevels"
31-
ConversationInsightTypeWorkTypes = "workTypes"
32-
ConversationInsightTypeSubcategory = "subcategory"
27+
ConversationInsightTypeIntents = "intents"
28+
ConversationInsightTypeComplexity = "complexity"
29+
ConversationInsightTypeCategories = "categories"
30+
ConversationInsightTypeGuidanceLevels = "guidanceLevels"
31+
ConversationInsightTypeWorkTypes = "workTypes"
32+
ConversationInsightTypeSubcategory = "subcategory"
3333

3434
ConversationInsightAggDistribution = "distribution"
3535
ConversationInsightAggTopValues = "topValues"
36-
ConversationInsightAggTimeSeries = "timeSeries"
36+
ConversationInsightAggTimeSeries = "timeSeries"
3737
ConversationInsightAggSubcategory = "subcategory"
3838
)
3939

4040
// CursorConversationInsight stores flattened Conversation Insights metrics from
4141
// GET /analytics/team/conversation-insights (Enterprise Analytics API).
4242
type CursorConversationInsight struct {
43-
ConnectionId uint64 `gorm:"primaryKey" json:"connectionId"`
44-
ScopeId string `gorm:"primaryKey;type:varchar(255)" json:"scopeId"`
45-
RecordId string `gorm:"primaryKey;type:varchar(64)" json:"recordId"`
46-
PeriodStart time.Time `gorm:"index" json:"periodStart"`
47-
PeriodEnd time.Time `gorm:"index" json:"periodEnd"`
48-
InsightType string `gorm:"type:varchar(32);index" json:"insightType"`
49-
AggregationType string `gorm:"type:varchar(32);index" json:"aggregationType"`
50-
DimensionValue string `gorm:"type:varchar(255);index" json:"dimensionValue"`
51-
SubcategoryGroup string `gorm:"type:varchar(32);index" json:"subcategoryGroup"`
43+
ConnectionId uint64 `gorm:"primaryKey" json:"connectionId"`
44+
ScopeId string `gorm:"primaryKey;type:varchar(255)" json:"scopeId"`
45+
RecordId string `gorm:"primaryKey;type:varchar(64)" json:"recordId"`
46+
PeriodStart time.Time `gorm:"index" json:"periodStart"`
47+
PeriodEnd time.Time `gorm:"index" json:"periodEnd"`
48+
InsightType string `gorm:"type:varchar(32);index" json:"insightType"`
49+
AggregationType string `gorm:"type:varchar(32);index" json:"aggregationType"`
50+
DimensionValue string `gorm:"type:varchar(255);index" json:"dimensionValue"`
51+
SubcategoryGroup string `gorm:"type:varchar(32);index" json:"subcategoryGroup"`
5252
MetricDate *time.Time `gorm:"index" json:"metricDate"`
53-
Count int `json:"count"`
53+
Count int `json:"count"`
5454

5555
common.NoPKModel
5656
}

‎backend/plugins/cursor/models/migrationscripts/20260826_add_key_tier.go‎

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ import (
2424
"github.com/apache/devlake/core/errors"
2525
"github.com/apache/devlake/core/models/migrationscripts/archived"
2626
"github.com/apache/devlake/helpers/migrationhelper"
27-
"github.com/apache/devlake/plugins/cursor/models"
2827
)
2928

29+
// defaultKeyTier matches models.KeyTierTeam; migrations must not import plugin models.
30+
const defaultKeyTier = "team"
31+
3032
type addCursorKeyTier struct{}
3133

3234
type cursorConnection20260826 struct {
@@ -36,15 +38,15 @@ type cursorConnection20260826 struct {
3638
func (cursorConnection20260826) TableName() string { return "_tool_cursor_connections" }
3739

3840
type cursorAiCodeCommit20260826 struct {
39-
ConnectionId uint64 `gorm:"primaryKey"`
40-
ScopeId string `gorm:"primaryKey;type:varchar(255)"`
41-
CommitHash string `gorm:"primaryKey;type:varchar(64)"`
42-
UserId string `gorm:"type:varchar(255);index"`
43-
UserEmail string `gorm:"type:varchar(255);index"`
44-
RepoName string `gorm:"type:varchar(255)"`
45-
BranchName string `gorm:"type:varchar(255)"`
41+
ConnectionId uint64 `gorm:"primaryKey"`
42+
ScopeId string `gorm:"primaryKey;type:varchar(255)"`
43+
CommitHash string `gorm:"primaryKey;type:varchar(64)"`
44+
UserId string `gorm:"type:varchar(255);index"`
45+
UserEmail string `gorm:"type:varchar(255);index"`
46+
RepoName string `gorm:"type:varchar(255)"`
47+
BranchName string `gorm:"type:varchar(255)"`
4648
IsPrimaryBranch *bool
47-
CommitSource string `gorm:"type:varchar(20)"`
49+
CommitSource string `gorm:"type:varchar(20)"`
4850
TotalLinesAdded int
4951
TotalLinesDeleted int
5052
TabLinesAdded int
@@ -61,17 +63,17 @@ type cursorAiCodeCommit20260826 struct {
6163
func (cursorAiCodeCommit20260826) TableName() string { return "_tool_cursor_ai_code_commits" }
6264

6365
type cursorAiCodeChange20260826 struct {
64-
ConnectionId uint64 `gorm:"primaryKey"`
65-
ScopeId string `gorm:"primaryKey;type:varchar(255)"`
66-
ChangeId string `gorm:"primaryKey;type:varchar(255)"`
67-
UserId string `gorm:"type:varchar(255);index"`
68-
UserEmail string `gorm:"type:varchar(255);index"`
69-
Source string `gorm:"type:varchar(20)"`
70-
Model string `gorm:"type:varchar(255)"`
66+
ConnectionId uint64 `gorm:"primaryKey"`
67+
ScopeId string `gorm:"primaryKey;type:varchar(255)"`
68+
ChangeId string `gorm:"primaryKey;type:varchar(255)"`
69+
UserId string `gorm:"type:varchar(255);index"`
70+
UserEmail string `gorm:"type:varchar(255);index"`
71+
Source string `gorm:"type:varchar(20)"`
72+
Model string `gorm:"type:varchar(255)"`
7173
TotalLinesAdded int
7274
TotalLinesDeleted int
7375
CreatedAt *time.Time
74-
Metadata string `gorm:"type:text"`
76+
Metadata string `gorm:"type:text"`
7577
archived.NoPKModel
7678
}
7779

@@ -88,7 +90,7 @@ func (*addCursorKeyTier) Up(basicRes context.BasicRes) errors.Error {
8890
}
8991
return basicRes.GetDal().Exec(
9092
"UPDATE _tool_cursor_connections SET key_tier = ? WHERE key_tier IS NULL OR key_tier = ''",
91-
models.KeyTierTeam,
93+
defaultKeyTier,
9294
)
9395
}
9496

0 commit comments

Comments
 (0)