Skip to content

migrate linear find issues#65

Merged
ctate merged 2 commits intomainfrom
ctate/migrate-linear-find-issues
Nov 28, 2025
Merged

migrate linear find issues#65
ctate merged 2 commits intomainfrom
ctate/migrate-linear-find-issues

Conversation

@ctate
Copy link
Collaborator

@ctate ctate commented Nov 28, 2025

No description provided.

@vercel
Copy link
Contributor

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
workflow-builder Ready Ready Preview Comment Nov 28, 2025 1:53pm

Comment on lines 35 to 44
const issues = await linear.issues({ filter });

return {
issues: issues.nodes.map(issue => ({
id: issue.id,
title: issue.title,
url: issue.url,
})),
count: issues.nodes.length,
};
Copy link
Contributor

@vercel vercel bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codegen template for the Find Issues action doesn't match the actual implementation in step.ts. The template only returns 3 fields (id, title, url) while the implementation returns 5 fields (additionally includes state and priority), and the template doesn't await issue.state as the implementation does.

View Details
📝 Patch Details
diff --git a/lib/workflow-codegen-sdk.ts b/lib/workflow-codegen-sdk.ts
index 38f8f7e..eac0540 100644
--- a/lib/workflow-codegen-sdk.ts
+++ b/lib/workflow-codegen-sdk.ts
@@ -5,6 +5,7 @@ import { generateTextCodegenTemplate } from "../plugins/ai-gateway/codegen/gener
 import { scrapeCodegenTemplate } from "../plugins/firecrawl/codegen/scrape";
 import { searchCodegenTemplate } from "../plugins/firecrawl/codegen/search";
 import { createTicketCodegenTemplate } from "../plugins/linear/codegen/create-ticket";
+import { findIssuesCodegenTemplate } from "../plugins/linear/codegen/find-issues";
 import { sendEmailCodegenTemplate } from "../plugins/resend/codegen/send-email";
 import { sendSlackMessageCodegenTemplate } from "../plugins/slack/codegen/send-slack-message";
 // Import codegen templates directly
@@ -34,7 +35,7 @@ function loadStepImplementation(actionType: string): string | null {
     "Send Email": sendEmailCodegenTemplate,
     "Send Slack Message": sendSlackMessageCodegenTemplate,
     "Create Ticket": createTicketCodegenTemplate,
-    "Find Issues": createTicketCodegenTemplate, // Uses same template for now
+    "Find Issues": findIssuesCodegenTemplate,
     "Generate Text": generateTextCodegenTemplate,
     "Generate Image": generateImageCodegenTemplate,
     "Database Query": databaseQueryTemplate,
diff --git a/plugins/linear/codegen/find-issues.ts b/plugins/linear/codegen/find-issues.ts
index 1c17fce..aa13dbc 100644
--- a/plugins/linear/codegen/find-issues.ts
+++ b/plugins/linear/codegen/find-issues.ts
@@ -34,13 +34,23 @@ export async function findIssuesStep(input: {
   
   const issues = await linear.issues({ filter });
   
+  const mappedIssues = await Promise.all(
+    issues.nodes.map(async (issue) => {
+      const state = await issue.state;
+      return {
+        id: issue.id,
+        title: issue.title,
+        url: issue.url,
+        state: state?.name || 'Unknown',
+        priority: issue.priority,
+        assigneeId: issue.assigneeId || undefined,
+      };
+    })
+  );
+  
   return {
-    issues: issues.nodes.map(issue => ({
-      id: issue.id,
-      title: issue.title,
-      url: issue.url,
-    })),
-    count: issues.nodes.length,
+    issues: mappedIssues,
+    count: mappedIssues.length,
   };
 }`;
 

Analysis

Find Issues codegen template incomplete and using wrong template in SDK

What fails: The codegen template for the Find Issues action in plugins/linear/codegen/find-issues.ts only maps 3 fields (id, title, url) and doesn't await issue.state, causing a mismatch with the actual server-side implementation which returns 5 fields (id, title, url, state, priority, assigneeId) with awaited state. Additionally, the template loader in lib/workflow-codegen-sdk.ts uses the wrong template (createTicketCodegenTemplate instead of findIssuesCodegenTemplate).

How to reproduce:

  1. Create a workflow with a "Find Issues" action
  2. Export the workflow to a standalone Next.js project
  3. The generated code will either use the Create Ticket implementation (wrong action) or return incomplete issue objects missing state, priority, and assigneeId fields

Result: Exported workflows with Find Issues action either:

  • Execute wrong operation (creating tickets instead of finding issues)
  • Return incomplete issue objects missing required fields that the server version provides

Expected: Generated code should match the server-side implementation:

  • Use the correct findIssuesCodegenTemplate
  • Map all 5 fields (id, title, url, state, priority, assigneeId)
  • Await issue.state to get the string representation rather than a promise
  • Use Promise.all for proper async handling of all state resolutions

Fixed by:

  • Importing findIssuesCodegenTemplate in lib/workflow-codegen-sdk.ts
  • Updating the template map to use findIssuesCodegenTemplate for "Find Issues" action
  • Updating the template in plugins/linear/codegen/find-issues.ts to map all 5 fields and await state using Promise.all

@ctate ctate merged commit 3ff5947 into main Nov 28, 2025
4 checks passed
taitsengstock referenced this pull request in techops-services/keeperhub Dec 8, 2025
* migrate linear find issues

* fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant