Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions scripts/dashboard/build-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,27 @@ async function writeToFile(
* Each issue is mapped to an object containing its unique identifier, title, assignment status, resource path,
* repository name (prefixed with "asyncapi/"), author's login, a primary area label (extracted using a filter and defaulting to "Unknown"),
* and a list of labels cleaned to exclude area identifiers and the "good first issue" tag.
* Closed issues are filtered out during this transformation.
*
* @param issues - The list of good first issues to transform.
* @returns A promise that resolves to an array of simplified issue objects.
* @returns A promise that resolves to an array of simplified issue objects, excluding closed issues.
*/
async function mapGoodFirstIssues(issues: GoodFirstIssues[]): Promise<MappedIssue[]> {
return issues.map((issue) => ({
id: issue.id,
title: issue.title,
isAssigned: !!issue.assignees.totalCount,
resourcePath: issue.resourcePath,
repo: `asyncapi/${issue.repository.name}`,
author: issue.author.login,
area: getLabel(issue, 'area/') || 'Unknown',
labels: issue.labels!.nodes.filter(
(label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
)
}));
return issues
.filter((issue) => issue.state === 'OPEN')
.map((issue) => ({
id: issue.id,
title: issue.title,
isAssigned: !!issue.assignees.totalCount,
resourcePath: issue.resourcePath,
repo: `asyncapi/${issue.repository.name}`,
author: issue.author.login,
area: getLabel(issue, 'area/') || 'Unknown',
labels: issue.labels!.nodes.filter(
(label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
),
state: issue.state
}));
Comment on lines 273 to +288
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix failing tests: new state filter drops items when state is missing.

With the new issue.state === 'OPEN' filter, any fixtures/mocks lacking state will be filtered out, which matches the reported failures (empty/undefined results). Update test fixtures/mocks to include state: 'OPEN' (or adjust expectations), or add a backward‑compatible fallback if legacy data can omit state. Based on pipeline failures, ...

🔧 Optional defensive fallback (keeps legacy fixtures working)
-  return issues
-    .filter((issue) => issue.state === 'OPEN')
+  return issues
+    .filter((issue) => (issue.state ?? 'OPEN') === 'OPEN')
     .map((issue) => ({
       id: issue.id,
       title: issue.title,
       isAssigned: !!issue.assignees.totalCount,
       resourcePath: issue.resourcePath,
       repo: `asyncapi/${issue.repository.name}`,
       author: issue.author.login,
       area: getLabel(issue, 'area/') || 'Unknown',
       labels: issue.labels!.nodes.filter(
         (label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
       ),
       state: issue.state
     }));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async function mapGoodFirstIssues(issues: GoodFirstIssues[]): Promise<MappedIssue[]> {
return issues.map((issue) => ({
id: issue.id,
title: issue.title,
isAssigned: !!issue.assignees.totalCount,
resourcePath: issue.resourcePath,
repo: `asyncapi/${issue.repository.name}`,
author: issue.author.login,
area: getLabel(issue, 'area/') || 'Unknown',
labels: issue.labels!.nodes.filter(
(label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
)
}));
return issues
.filter((issue) => issue.state === 'OPEN')
.map((issue) => ({
id: issue.id,
title: issue.title,
isAssigned: !!issue.assignees.totalCount,
resourcePath: issue.resourcePath,
repo: `asyncapi/${issue.repository.name}`,
author: issue.author.login,
area: getLabel(issue, 'area/') || 'Unknown',
labels: issue.labels!.nodes.filter(
(label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
),
state: issue.state
}));
async function mapGoodFirstIssues(issues: GoodFirstIssues[]): Promise<MappedIssue[]> {
return issues
.filter((issue) => (issue.state ?? 'OPEN') === 'OPEN')
.map((issue) => ({
id: issue.id,
title: issue.title,
isAssigned: !!issue.assignees.totalCount,
resourcePath: issue.resourcePath,
repo: `asyncapi/${issue.repository.name}`,
author: issue.author.login,
area: getLabel(issue, 'area/') || 'Unknown',
labels: issue.labels!.nodes.filter(
(label) => !label.name.startsWith('area/') && !label.name.startsWith('good first issue')
),
state: issue.state
}));
}
🤖 Prompt for AI Agents
In `@scripts/dashboard/build-dashboard.ts` around lines 273 - 288, The new strict
filter in mapGoodFirstIssues is dropping legacy fixtures that omit state; update
the function mapGoodFirstIssues to handle missing state by treating undefined as
'OPEN' (e.g., use (issue.state ?? 'OPEN') === 'OPEN') or remove the filter and
handle state on MappedIssue consumers, and update any GoodFirstIssues test
fixtures to include state: 'OPEN' to keep tests deterministic; touch the
mapGoodFirstIssues implementation and related test fixtures (GoodFirstIssues /
MappedIssue) accordingly.

}

/**
Expand Down
1 change: 1 addition & 0 deletions scripts/dashboard/issue-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ query($first: Int!, $after: String) {
id
title
resourcePath
state
repository {
name
}
Expand Down
5 changes: 4 additions & 1 deletion types/scripts/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export interface IssueById {
} & BasicIssueOrPR;
}

export interface GoodFirstIssues extends BasicIssueOrPR {}
export interface GoodFirstIssues extends BasicIssueOrPR {
state: string;
}

export interface HotDiscussionsIssuesNode extends BasicIssueOrPR {
timelineItems: TimelineItems;
Expand Down Expand Up @@ -128,4 +130,5 @@ export interface MappedIssue {
author: string;
area: string;
labels: Label[];
state?: string;
}
Loading