Skip to content

Conversation

@nabenabe0928
Copy link
Contributor

Motivation

As the latest main branch does not count the stats for any default load_module calls, we fix this bug.

Description of the changes

  • Change the setup
  • Add the unit test for this

@nabenabe0928 nabenabe0928 added the bug Issue/PR about behavior that is broken. label Jun 20, 2025
@nabenabe0928 nabenabe0928 modified the milestone: v0.4.0 Jun 20, 2025
@codecov
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.79%. Comparing base (736a87b) to head (299a1cf).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   83.16%   89.79%   +6.63%     
==========================================
  Files           9        9              
  Lines         196      196              
==========================================
+ Hits          163      176      +13     
+ Misses         33       20      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nabenabe0928 nabenabe0928 added this to the v0.4.0 milestone Jun 20, 2025
@nabenabe0928 nabenabe0928 requested a review from Copilot June 20, 2025 06:26
Copy link

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 fixes a bug where default load_module statistics were not reported due to a misconfigured condition, and it enhances the unit tests to ensure this behavior works as expected.

  • Updated the condition for reporting stats by removing the strict base_url check.
  • Modified the parameter order for _download_via_git to align with its definition.
  • Adjusted the return type and documentation for is_no_analytics in _conf.py.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/test_hub.py Added a new unit test to ensure that _report_stats is invoked when the analytics are enabled.
optunahub/hub.py Reordered parameters in the _download_via_git call and updated the is_official_registry condition.
optunahub/_conf.py Updated is_no_analytics to always return a boolean and revised the corresponding docstring.
Comments suppressed due to low confidence (3)

optunahub/hub.py:165

  • The removal of the strict base_url comparison in the is_official_registry check alters the logic for reporting stats. Please confirm that this change is intended to support non-default base_url scenarios.
    is_official_registry = repo_owner == "optuna" and repo_name == "optunahub-registry"

optunahub/hub.py:139

  • The reordering of parameters in the _download_via_git call should be validated against the function definition to ensure consistency and clarity in API usage.
                base_url=base_url or "https://github.com",

optunahub/_conf.py:34

  • The function's return type and docstring have been updated to always return a boolean. Please verify that all callers of this function are compatible with this change.
def is_no_analytics() -> bool:

Copy link
Member

@y0z y0z left a comment

Choose a reason for hiding this comment

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

LGTM

@y0z y0z merged commit d6245cc into main Jun 20, 2025
13 of 14 checks passed
@y0z y0z deleted the hotfix/fix-report-stats-for-patch branch June 20, 2025 06:41
nabenabe0928 pushed a commit to nabenabe0928/optunahub that referenced this pull request Jun 20, 2025
…patch

Fix the condition for stats report to count the default `load_module` stats
@y0z y0z mentioned this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue/PR about behavior that is broken.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants