8000 Implement asset selection logic for download counting by ludeeus · Pull Request #4696 · hacs/integration · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement asset selection logic for download counting #4696

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ludeeus
Copy link
Member
@ludeeus ludeeus commented Jul 6, 2025

This pull request introduces enhancements to the asset selection logic for download counting in the hacs repository, along with comprehensive test coverage for various scenarios. The most notable changes include the addition of a helper method to identify the correct asset for download, updates to the download counting logic, and new test cases to ensure robustness.

Asset Selection Enhancements:

  • custom_components/hacs/repositories/base.py: Added _find_target_asset method to intelligently se 8000 lect the correct asset based on filename, plugin patterns, manifest filename, or fallback to the first asset.
  • Updated common_update_data method to use _find_target_asset for determining the download count.

fixes #4438

@Copilot Copilot AI review requested due to automatic review settings July 6, 2025 19:47
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a helper to improve how release assets are selected for download counting and updates the counting logic to use it, backed by extensive new tests.

  • Added _find_target_asset in base.py to pick assets by configured filename, plugin patterns, manifest filename, or fallback.
  • Updated common_update_data to use the new helper for setting data.downloads.
  • Introduced many new tests and snapshot fixtures covering various asset selection scenarios.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

File Description
custom_components/hacs/repositories/base.py Imported GitHubReleaseAssetModel, updated common_update_data, and added _find_target_asset.
tests/repositories/test_download_counting.py Added comprehensive unit tests for asset selection and download counting.
tests/snapshots/api-usage/tests/repositories/*.json Added snapshot JSON fixtures for each new test scenario to verify API usage.
Comments suppressed due to low confidence (1)

tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-plugin-pattern-matching.json:1

  • Snapshot filename test_download_countingtest-regression-plugin-pattern-matching.json appears to combine two names without a separator. Consider renaming to include a clear delimiter or subdirectory (e.g., test_download_counting/test-regression-plugin-pattern-matching.json) for consistency and proper snapshot mapping.
{

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.

Download counter shows wrong value
1 participant
0