Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| 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, | ||
| }; |
There was a problem hiding this comment.
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:
- Create a workflow with a "Find Issues" action
- Export the workflow to a standalone Next.js project
- 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.stateto get the string representation rather than a promise - Use Promise.all for proper async handling of all state resolutions
Fixed by:
- Importing
findIssuesCodegenTemplateinlib/workflow-codegen-sdk.ts - Updating the template map to use
findIssuesCodegenTemplatefor "Find Issues" action - Updating the template in
plugins/linear/codegen/find-issues.tsto map all 5 fields and await state using Promise.all
* migrate linear find issues * fixes
No description provided.