From c5da849074a8711fd50089c8f6b744646d5b8591 Mon Sep 17 00:00:00 2001 From: Abdulbaki Aybakan Date: Wed, 13 May 2026 23:45:05 +0200 Subject: [PATCH 1/4] Fix potential null reference for issue labels --- scripts/detect_duplicates.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/detect_duplicates.ts b/scripts/detect_duplicates.ts index 798d864afe6..65898d98646 100644 --- a/scripts/detect_duplicates.ts +++ b/scripts/detect_duplicates.ts @@ -122,7 +122,7 @@ export async function fetchExistingIssues( } // Fallback: Check for bug or feature labels - const labelNames = issue.labels.map((l: any) => + const labelNames = (issue.labels || []).map((l: any) => typeof l === "string" ? l.toLowerCase() : (l.name || "").toLowerCase() ); return labelNames.includes("bug") || labelNames.includes("feature"); @@ -143,7 +143,7 @@ export async function fetchExistingIssues( body: issue.body || "", created_at: new Date(issue.created_at), updated_at: new Date(issue.updated_at), - labels: issue.labels.map((l: any) => + labels: (issue.labels || []).map((l: any) => typeof l === "string" ? l : l.name || "" ), url: issue.html_url, From a9e22fafb952dfefc536875bb40bb7f01223ff34 Mon Sep 17 00:00:00 2001 From: Abdulbaki Aybakan Date: Wed, 13 May 2026 23:45:46 +0200 Subject: [PATCH 2/4] Handle undefined labels in issue logging --- scripts/test/test-real-issue.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/test-real-issue.ts b/scripts/test/test-real-issue.ts index 47b1d7fbc13..994117d566f 100644 --- a/scripts/test/test-real-issue.ts +++ b/scripts/test/test-real-issue.ts @@ -50,7 +50,7 @@ async function testRealIssue() { console.log("─".repeat(60)); console.log(`Title: ${issue.title}`); console.log(`State: ${issue.state}`); - console.log(`Labels: ${issue.labels.map((l: any) => l.name).join(", ") || "none"}`); + console.log(`Labels: ${(issue.labels || []).map((l: any) => l.name).join(", ") || "none"}`); console.log(`Created: ${issue.created_at}`); console.log(`URL: ${issue.html_url}`); console.log("─".repeat(60)); From 97601d24cfc95f4dfd591e3ba1d6545cd6d5caab Mon Sep 17 00:00:00 2001 From: Abdulbaki Aybakan Date: Wed, 13 May 2026 23:46:10 +0200 Subject: [PATCH 3/4] Fix labels logging to handle undefined case --- scripts/test/test-duplicate-preview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/test-duplicate-preview.ts b/scripts/test/test-duplicate-preview.ts index 79c1269d13f..5fc9803737d 100644 --- a/scripts/test/test-duplicate-preview.ts +++ b/scripts/test/test-duplicate-preview.ts @@ -50,7 +50,7 @@ async function previewDuplicateDetection() { console.log("─".repeat(60)); console.log(`Title: ${issue.title}`); console.log(`State: ${issue.state}`); - console.log(`Labels: ${issue.labels.map((l: any) => l.name).join(", ") || "none"}`); + console.log(`Labels: ${(issue.labels || []).map((l: any) => l.name).join(", ") || "none"}`); console.log(`Type: ${issue.type || "NOT SET"}`); console.log(`Created: ${issue.created_at}`); console.log(`URL: ${issue.html_url}`); From 4a929c13ce8394c1a929c70ea3a060611e67cbe1 Mon Sep 17 00:00:00 2001 From: Abdulbaki Aybakan Date: Wed, 13 May 2026 23:46:33 +0200 Subject: [PATCH 4/4] Handle missing labels in GitHub API response --- scripts/test/test-github-api-response.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/test-github-api-response.ts b/scripts/test/test-github-api-response.ts index ec9060f4671..fd7d3c7266f 100644 --- a/scripts/test/test-github-api-response.ts +++ b/scripts/test/test-github-api-response.ts @@ -49,7 +49,7 @@ async function testGitHubAPIResponse() { console.log(` - number: ${firstIssue.number}`); console.log(` - title: ${firstIssue.title}`); console.log(` - state: ${firstIssue.state}`); - console.log(` - labels: ${firstIssue.labels.map((l: any) => l.name).join(", ")}`); + console.log(` - labels: ${(firstIssue.labels || []).map((l: any) => l.name).join(", ")}`); console.log(` - type: ${firstIssue.type || "NOT AVAILABLE"}`); console.log(` - pull_request: ${firstIssue.pull_request ? "YES" : "NO"}`); console.log("");