Skip to content

fix(hive): search open labelled issues for Good First Issue - #1376

Merged
KaranUnique merged 3 commits into
Canopus-Labs:mainfrom
nyxsky404:fix/932-good-first-issue-filter
Aug 7, 2026
Merged

fix(hive): search open labelled issues for Good First Issue#1376
KaranUnique merged 3 commits into
Canopus-Labs:mainfrom
nyxsky404:fix/932-good-first-issue-filter

Conversation

@nyxsky404

@nyxsky404 nyxsky404 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

Related Issue

Closes #932

Summary

Good First Issue was searching search/repositories with a topic token, so metadata matches showed up even with no open starter issue. Label filters now hit search/issues (is:open + label variants), results are grouped by repo, and each card links the matching issue. Empty state covers the no-open-issue case.


Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Refactoring
  • Documentation update
  • UI/UX improvement
  • Other(please describe) ______

How Has This Been Tested?

  • vitest run src/utils/repositoryHiveSearch.unit.test.js (5 passing)
  • Covers issue vs repo routing, closed/PR exclusion, multi-label variants, empty results

Screenshots (if applicable)

N/A

Checklist

  • My code follows the project's guidelines
  • I have tested my changes
  • I have updated documentation where necessary
  • I have linked the related issue
  • My changes do not introduce new warnings or errors

Made with Cursor

Summary

Fixes the Good First Issue filter by searching GitHub’s open issues instead of repository metadata.

  • Uses search/issues with is:open and label variants.
  • Excludes closed issues and pull requests.
  • Groups matching issues by repository.
  • Links repository cards to matching starter issues.
  • Displays issue reactions and comments instead of fabricated repository statistics.
  • Cancels stale searches when filters, sorting, pages, or new searches change.
  • Supports pagination and navigation controls.
  • Uses repository search for non-label filters.
  • Shows an empty state when no matching issues exist.
  • Adds utilities and Vitest coverage for routing, filtering, grouping, pagination, duplicate repositories, and empty results.

Filter previously queried repositories by topic text, so repos
without an open starter issue still appeared. Route label filters
through Issues search, group by repo, and surface the issue link.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Repository Hive now routes label searches through GitHub’s issues API, groups open matching issues by repository, supports pagination, cancels stale requests, and normalizes results through shared utilities. Cards display separate repository and matching issue links with issue-specific metrics and status text.

Changes

Repository Hive search

Layer / File(s) Summary
Search routing and normalization
frontend/src/utils/repositoryHiveSearch.js
Shared utilities define filters, sort options, repository and issue queries, paginated URLs, issue grouping, response normalization, and page metadata.
Repository Hive integration and card rendering
frontend/src/pages/OpenSource/RepositoryHive.jsx
The page uses shared utilities, cancels stale requests, resets pagination for search changes, distinguishes issue-backed results, displays type-specific metrics, and renders separate repository and matching issue links.
Search behavior validation
frontend/src/utils/repositoryHiveSearch.unit.test.js
Tests cover routing, query construction, pagination, issue grouping, pull-request exclusion, duplicate repositories, and empty responses.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RepositoryHive
  participant repositoryHiveSearch
  participant GitHubSearchAPI
  User->>RepositoryHive: Submit search or change filter, sort, or page
  RepositoryHive->>repositoryHiveSearch: Build paginated API URL
  repositoryHiveSearch-->>RepositoryHive: Return issues or repositories API URL
  RepositoryHive->>GitHubSearchAPI: Fetch search results
  GitHubSearchAPI-->>RepositoryHive: Return issue or repository data
  RepositoryHive->>repositoryHiveSearch: Normalize response and page metadata
  repositoryHiveSearch-->>RepositoryHive: Return grouped repository results
  RepositoryHive-->>User: Display repository, issue, metrics, and pagination links
Loading

Possibly related issues

  • #932: The issue-label search now queries open matching issues, groups results by repository, and displays the matching starter issue.
  • #934: The page now includes request cancellation and normalized error and pagination state handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Repository Hive Good First Issue search fix, which is the primary change.
Linked Issues check ✅ Passed The changes search open labeled issues, exclude pull requests, group repositories, expose matching issues, support pagination, and handle empty results [#932].
Out of Scope Changes check ✅ Passed The pagination, request cancellation, sorting, normalization, and tests directly support the linked issue and stated Repository Hive objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/utils/repositoryHiveSearch.js`:
- Around line 161-171: Extend buildGitHubSearchUrl to accept a page parameter
and include it in issue-search requests, then add pagination state and controls
in the page component so users can navigate beyond the first response. Ensure
duplicate-repository grouping does not prematurely stop pagination when fewer
than perPage cards are produced, and add coverage for later-page requests and
duplicate-repository pages.
- Around line 44-47: Update the issue-backed result flow around ISSUE_SORT_MAP
and the normalized repository record to enrich each distinct repository with
actual repository metadata before rendering or sorting. Remove the
issue-specific stars/reactions and forks/comments mappings, along with
hard-coded repository counts, so RepositoryHive.jsx receives genuine repository
statistics and repository sort modes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca9f7842-630c-4ca8-be26-bdef8ad9b9c7

📥 Commits

Reviewing files that changed from the base of the PR and between 32c4e5c and 00039a5.

📒 Files selected for processing (3)
  • frontend/src/pages/OpenSource/RepositoryHive.jsx
  • frontend/src/utils/repositoryHiveSearch.js
  • frontend/src/utils/repositoryHiveSearch.unit.test.js

Comment thread frontend/src/utils/repositoryHiveSearch.js
Comment thread frontend/src/utils/repositoryHiveSearch.js Outdated
Use issue reactions/comments instead of fake repo stats, add page
support to search URLs, and expose pagination controls.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/OpenSource/RepositoryHive.jsx`:
- Around line 87-89: Update the request flow containing the response handling
with setRepositories and setPageInfo to track the latest request using
AbortController or a request sequence identifier. Prevent stale requests from
updating repositories, pageInfo, loading, or error state, and ensure the guard
covers both successful and failed requests when filters, sorting, pagination, or
submitted searches change.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 09fd6379-ab17-4766-bfba-a126d8dc1650

📥 Commits

Reviewing files that changed from the base of the PR and between 00039a5 and 3b2263a.

📒 Files selected for processing (3)
  • frontend/src/pages/OpenSource/RepositoryHive.jsx
  • frontend/src/utils/repositoryHiveSearch.js
  • frontend/src/utils/repositoryHiveSearch.unit.test.js

Comment thread frontend/src/pages/OpenSource/RepositoryHive.jsx
Cancel in-flight GitHub requests when filters, sort, page, or a new
search changes so an older response cannot overwrite current results.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/OpenSource/RepositoryHive.jsx`:
- Around line 92-93: Update the search-result pagination flow around
normalizeSearchResponse and getSearchPageInfo to paginate the deduplicated
repository collection rather than GitHub’s raw issue total_count. Ensure
repository cards are unique across pages and calculate page metadata from the
grouped repositories; alternatively, explicitly retain issue pagination while
preventing duplicate repositories across pages.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 916c1991-88c4-499c-9ee8-9c884be4f60d

📥 Commits

Reviewing files that changed from the base of the PR and between 3b2263a and 6442c7c.

📒 Files selected for processing (1)
  • frontend/src/pages/OpenSource/RepositoryHive.jsx

Comment on lines +92 to +93
setRepositories(normalizeSearchResponse(selectedFilters, data));
setPageInfo(getSearchPageInfo(data, page, PER_PAGE));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Paginate grouped repositories instead of raw issues.

normalizeSearchResponse groups only the current page of issue results. getSearchPageInfo then uses GitHub’s raw issue total_count. If one repository has multiple matching issues, the page count is incorrect for repository cards, and the same repository can appear on multiple pages.

Use a pagination strategy that deduplicates repositories before calculating page metadata. Otherwise, present pagination as issue pagination and prevent duplicate repository cards across pages.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/OpenSource/RepositoryHive.jsx` around lines 92 - 93,
Update the search-result pagination flow around normalizeSearchResponse and
getSearchPageInfo to paginate the deduplicated repository collection rather than
GitHub’s raw issue total_count. Ensure repository cards are unique across pages
and calculate page metadata from the grouped repositories; alternatively,
explicitly retain issue pagination while preventing duplicate repositories
across pages.

@KaranUnique
KaranUnique merged commit 10f1015 into Canopus-Labs:main Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Repository Hive Good First Issue filter does not verify open labelled issues

2 participants