-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: filter out closed issues in dashboard issue mapping #4976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Neil <neiljar888@gmail.com>
📝 WalkthroughWalkthroughThe changes enhance the dashboard's good first issues feature to include issue state tracking. A state field is added to the GraphQL query schema, type definitions are extended to include the state property, and the mapping function is updated to filter for OPEN issues only while preserving the state in the output. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
❌ Deploy Preview for asyncapi-website failed.Built without sensitive environment variables
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@scripts/dashboard/build-dashboard.ts`:
- Around line 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.
| 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 | ||
| })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
PR #4940
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.