Skip to content

Add preferred release groups for auto-download and filtering#491

Merged
Doezer merged 9 commits intorelease/1.3.0from
feat/preferred-release-groups
Apr 1, 2026
Merged

Add preferred release groups for auto-download and filtering#491
Doezer merged 9 commits intorelease/1.3.0from
feat/preferred-release-groups

Conversation

@Doezer
Copy link
Copy Markdown
Owner

@Doezer Doezer commented Mar 28, 2026

This pull request adds support for users to specify and manage "preferred release groups" for game downloads. Users can now prioritize downloads from specific release groups, both in the UI and in the automatic download logic. The implementation includes database schema changes, UI components for configuration, and backend logic to honor these preferences during searches and downloads.

User Settings and Database Changes:

  • Added two new fields to the user_settings table and schema: preferred_release_groups (a JSON-encoded list of group names) and filter_by_preferred_groups (a boolean to enable/disable filtering by these groups). [1] [2]
  • Updated in-memory storage and user settings logic to handle the new fields.

Frontend: User Interface for Preferred Groups:

  • Introduced a new PreferredReleaseGroupsSettings component in the settings page, allowing users to add, remove, and save preferred release groups, as well as toggle filtering. [1] [2] [3] [4] [5]
  • Enhanced the game download dialog to auto-select preferred groups when filtering is enabled.

Backend: Auto-Search and Download Filtering:

  • Modified the auto-search logic in server/cron.ts to filter both main and update search results by preferred release groups when configured, ensuring only matching releases are considered if any are available. [1] [2] [3]
  • Updated notifications to include the release group in the message when a download is started.

Closes #392

@Doezer Doezer added this to the 1.3.0 milestone Mar 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements a 'Preferred Release Groups' feature, enabling users to prioritize specific release groups for auto-downloads and filter search results. The changes include a new settings UI component, database schema updates, and logic in the auto-search cron job to apply these preferences. Review feedback highlights a critical stability risk where malformed JSON could crash the cron job and recommends refactoring duplicated parsing and filtering logic into shared helper functions to improve maintainability and error handling.

Comment thread server/cron.ts Outdated
Comment thread client/src/components/GameDownloadDialog.tsx Outdated
Comment thread client/src/pages/settings.tsx Outdated
Comment thread server/cron.ts Outdated
@Doezer Doezer added this to Questarr Mar 28, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Questarr Mar 28, 2026
Doezer and others added 4 commits March 29, 2026 15:14
…ring

- Add preferredReleaseGroups and filterByPreferredGroups to userSettings schema
- Migration 0008 adds the two new columns to user_settings table
- Auto-download now filters candidates to preferred groups before the single/multiple result decision; falls back to all results if no match
- Download Started notification includes the release group name
- New PreferredReleaseGroupsSettings component with tag input and pre-filter toggle
- Settings Rules tab renders the new component
- GameDownloadDialog pre-populates selected groups from preferred groups when filterByPreferredGroups is enabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…games loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap JSON.parse of preferredReleaseGroups in try-catch with Array.isArray
  guard in cron.ts to prevent cron job crash on malformed data
- Extract duplicated preferred-groups filter logic into applyPreferredGroupsFilter
  helper, replacing identical blocks in both wanted-games and owned-games loops
- Add console.warn to empty catch block in GameDownloadDialog.tsx
- Add Array.isArray guard and console.warn to settings.tsx JSON.parse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Doezer Doezer force-pushed the feat/preferred-release-groups branch from 854861a to 6fcbceb Compare March 29, 2026 13:52
@Doezer Doezer moved this from Backlog to In progress in Questarr Mar 29, 2026
@Doezer
Copy link
Copy Markdown
Owner Author

Doezer commented Mar 29, 2026

Add way to add new release group to the list from search download view

@Doezer Doezer linked an issue Mar 29, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Owner Author

@Doezer Doezer left a comment

Choose a reason for hiding this comment

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

Addressed all four review comments in commit 45579c2 (rebased onto release/1.3.0):\n\n1. [CRITICAL] cron.ts JSON.parse crash — Wrapped in try-catch with Array.isArray guard; logs a warning on malformed data.\n2. [MEDIUM] Duplicated filter logic — Extracted to applyPreferredGroupsFilter helper; both mainItems and updateItems loops now use it.\n3. [MEDIUM] GameDownloadDialog empty catch — Added console.warn with the error.\n4. [MEDIUM] settings.tsx unsafe cast — Added Array.isArray guard and console.warn in catch.\n\nAll lint, type-check, and tests (659/659) pass.

Doezer and others added 5 commits March 30, 2026 09:34
- Add 9 tests covering applyPreferredGroupsFilter behavior:
  - Filter multiple results to single preferred-group match
  - Fallback to all items when no items match preferred groups
  - Empty array skips filtering
  - Malformed JSON handled gracefully without crashing
  - Non-array JSON treated as no filter
  - Group suffix in Download Started notification
  - No group suffix when item has no group
  - Preferred groups applied to owned-game update items
- Add mockUpdateGameStatus, mockAddGameDownload, mockAddDownloadWithFallback
- Update baseSettings with preferredReleaseGroups, filterByPreferredGroups, steamSyncFailures
Add parseJsonStringArray helper to shared/title-utils.ts and replace
the duplicated JSON.parse + Array.isArray + try/catch pattern in
cron.ts, settings.tsx, and GameDownloadDialog.tsx.

Fixes SonarCloud new_duplicated_lines_density hotspot on PR #491.
- closes dialog after successful download (mockOnOpenChange)
- shows destructive toast when API returns success:false
- displays indexer errors from search response
- shows bundle dialog when main item clicked with updates available
- filters results to preferred group when filterByPreferredGroups enabled
- shows all results when filterByPreferredGroups is false

Also exposes mockToast and mockOnOpenChange for assertion in tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…earch tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@Doezer Doezer merged commit 78523f8 into release/1.3.0 Apr 1, 2026
5 of 6 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Questarr Apr 1, 2026
@Doezer Doezer deleted the feat/preferred-release-groups branch April 1, 2026 06:23
Doezer added a commit that referenced this pull request Apr 5, 2026
* feat: add preferred release groups for auto-download and search filtering

- Add preferredReleaseGroups and filterByPreferredGroups to userSettings schema
- Migration 0008 adds the two new columns to user_settings table
- Auto-download now filters candidates to preferred groups before the single/multiple result decision; falls back to all results if no match
- Download Started notification includes the release group name
- New PreferredReleaseGroupsSettings component with tag input and pre-filter toggle
- Settings Rules tab renders the new component
- GameDownloadDialog pre-populates selected groups from preferred groups when filterByPreferredGroups is enabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: hoist preferredGroups parsing outside per-game loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: apply preferred release groups filter to update items in owned-games loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address Gemini review comments on preferred release groups

- Wrap JSON.parse of preferredReleaseGroups in try-catch with Array.isArray
  guard in cron.ts to prevent cron job crash on malformed data
- Extract duplicated preferred-groups filter logic into applyPreferredGroupsFilter
  helper, replacing identical blocks in both wanted-games and owned-games loops
- Add console.warn to empty catch block in GameDownloadDialog.tsx
- Add Array.isArray guard and console.warn to settings.tsx JSON.parse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add preferred release groups coverage to cron_autosearch

- Add 9 tests covering applyPreferredGroupsFilter behavior:
  - Filter multiple results to single preferred-group match
  - Fallback to all items when no items match preferred groups
  - Empty array skips filtering
  - Malformed JSON handled gracefully without crashing
  - Non-array JSON treated as no filter
  - Group suffix in Download Started notification
  - No group suffix when item has no group
  - Preferred groups applied to owned-game update items
- Add mockUpdateGameStatus, mockAddGameDownload, mockAddDownloadWithFallback
- Update baseSettings with preferredReleaseGroups, filterByPreferredGroups, steamSyncFailures

* refactor: extract parseJsonStringArray to eliminate code duplication

Add parseJsonStringArray helper to shared/title-utils.ts and replace
the duplicated JSON.parse + Array.isArray + try/catch pattern in
cron.ts, settings.tsx, and GameDownloadDialog.tsx.

Fixes SonarCloud new_duplicated_lines_density hotspot on PR #491.

* test: expand GameDownloadDialog coverage with 6 new scenarios

- closes dialog after successful download (mockOnOpenChange)
- shows destructive toast when API returns success:false
- displays indexer errors from search response
- shows bundle dialog when main item clicked with updates available
- filters results to preferred group when filterByPreferredGroups enabled
- shows all results when filterByPreferredGroups is false

Also exposes mockToast and mockOnOpenChange for assertion in tests.

* refactor: extract createFetchMock helper to eliminate test duplication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: extract shared fixtures to reduce duplication in cron autosearch tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Doezer added a commit that referenced this pull request Apr 9, 2026
* feat: add preferred release groups for auto-download and search filtering

- Add preferredReleaseGroups and filterByPreferredGroups to userSettings schema
- Migration 0008 adds the two new columns to user_settings table
- Auto-download now filters candidates to preferred groups before the single/multiple result decision; falls back to all results if no match
- Download Started notification includes the release group name
- New PreferredReleaseGroupsSettings component with tag input and pre-filter toggle
- Settings Rules tab renders the new component
- GameDownloadDialog pre-populates selected groups from preferred groups when filterByPreferredGroups is enabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: hoist preferredGroups parsing outside per-game loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: apply preferred release groups filter to update items in owned-games loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address Gemini review comments on preferred release groups

- Wrap JSON.parse of preferredReleaseGroups in try-catch with Array.isArray
  guard in cron.ts to prevent cron job crash on malformed data
- Extract duplicated preferred-groups filter logic into applyPreferredGroupsFilter
  helper, replacing identical blocks in both wanted-games and owned-games loops
- Add console.warn to empty catch block in GameDownloadDialog.tsx
- Add Array.isArray guard and console.warn to settings.tsx JSON.parse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add preferred release groups coverage to cron_autosearch

- Add 9 tests covering applyPreferredGroupsFilter behavior:
  - Filter multiple results to single preferred-group match
  - Fallback to all items when no items match preferred groups
  - Empty array skips filtering
  - Malformed JSON handled gracefully without crashing
  - Non-array JSON treated as no filter
  - Group suffix in Download Started notification
  - No group suffix when item has no group
  - Preferred groups applied to owned-game update items
- Add mockUpdateGameStatus, mockAddGameDownload, mockAddDownloadWithFallback
- Update baseSettings with preferredReleaseGroups, filterByPreferredGroups, steamSyncFailures

* refactor: extract parseJsonStringArray to eliminate code duplication

Add parseJsonStringArray helper to shared/title-utils.ts and replace
the duplicated JSON.parse + Array.isArray + try/catch pattern in
cron.ts, settings.tsx, and GameDownloadDialog.tsx.

Fixes SonarCloud new_duplicated_lines_density hotspot on PR #491.

* test: expand GameDownloadDialog coverage with 6 new scenarios

- closes dialog after successful download (mockOnOpenChange)
- shows destructive toast when API returns success:false
- displays indexer errors from search response
- shows bundle dialog when main item clicked with updates available
- filters results to preferred group when filterByPreferredGroups enabled
- shows all results when filterByPreferredGroups is false

Also exposes mockToast and mockOnOpenChange for assertion in tests.

* refactor: extract createFetchMock helper to eliminate test duplication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: extract shared fixtures to reduce duplication in cron autosearch tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Doezer added a commit that referenced this pull request Apr 17, 2026
* feat: add preferred release groups for auto-download and search filtering

- Add preferredReleaseGroups and filterByPreferredGroups to userSettings schema
- Migration 0008 adds the two new columns to user_settings table
- Auto-download now filters candidates to preferred groups before the single/multiple result decision; falls back to all results if no match
- Download Started notification includes the release group name
- New PreferredReleaseGroupsSettings component with tag input and pre-filter toggle
- Settings Rules tab renders the new component
- GameDownloadDialog pre-populates selected groups from preferred groups when filterByPreferredGroups is enabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: hoist preferredGroups parsing outside per-game loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: apply preferred release groups filter to update items in owned-games loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address Gemini review comments on preferred release groups

- Wrap JSON.parse of preferredReleaseGroups in try-catch with Array.isArray
  guard in cron.ts to prevent cron job crash on malformed data
- Extract duplicated preferred-groups filter logic into applyPreferredGroupsFilter
  helper, replacing identical blocks in both wanted-games and owned-games loops
- Add console.warn to empty catch block in GameDownloadDialog.tsx
- Add Array.isArray guard and console.warn to settings.tsx JSON.parse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add preferred release groups coverage to cron_autosearch

- Add 9 tests covering applyPreferredGroupsFilter behavior:
  - Filter multiple results to single preferred-group match
  - Fallback to all items when no items match preferred groups
  - Empty array skips filtering
  - Malformed JSON handled gracefully without crashing
  - Non-array JSON treated as no filter
  - Group suffix in Download Started notification
  - No group suffix when item has no group
  - Preferred groups applied to owned-game update items
- Add mockUpdateGameStatus, mockAddGameDownload, mockAddDownloadWithFallback
- Update baseSettings with preferredReleaseGroups, filterByPreferredGroups, steamSyncFailures

* refactor: extract parseJsonStringArray to eliminate code duplication

Add parseJsonStringArray helper to shared/title-utils.ts and replace
the duplicated JSON.parse + Array.isArray + try/catch pattern in
cron.ts, settings.tsx, and GameDownloadDialog.tsx.

Fixes SonarCloud new_duplicated_lines_density hotspot on PR #491.

* test: expand GameDownloadDialog coverage with 6 new scenarios

- closes dialog after successful download (mockOnOpenChange)
- shows destructive toast when API returns success:false
- displays indexer errors from search response
- shows bundle dialog when main item clicked with updates available
- filters results to preferred group when filterByPreferredGroups enabled
- shows all results when filterByPreferredGroups is false

Also exposes mockToast and mockOnOpenChange for assertion in tests.

* refactor: extract createFetchMock helper to eliminate test duplication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: extract shared fixtures to reduce duplication in cron autosearch tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add favorite release groups for auto downloading releases

1 participant