Skip to content

fix: reject start=0 on 1-based badge endpoints, fix demo goal calls - #445

Merged
cyberjunky merged 1 commit into
masterfrom
fix/one-based-start-validation
Sep 29, 2026
Merged

cyberjunky merged 1 commit into
masterfrom
fix/one-based-start-validation

Conversation

@cyberjunky

@cyberjunky cyberjunky commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #441.

  • get_badge_challenges, get_available_badge_challenges and get_non_completed_badge_challenges now reject start=0 with a ValueError, like get_inprogress_virtual_challenges already did. Garmin rejects 0 on these endpoints anyway (400 - start should > 0, checked against the live API).
  • demo.py goal options passed start=0, which feat: update get_goals method to use 1-based indexing #441 now rejects; they use start_badge (1) now.
  • get_adhoc_challenges is left as is: the endpoint accepts start=0.
  • Unit tests for the zero-start rejection.

Summary by CodeRabbit

  • Bug Fixes
    • Badge, challenge, and goal menus now use consistent one-based starting positions, improving which items are displayed.
    • Badge-challenge requests now require a positive starting position. Requests using zero return a validation error.

The badge challenge endpoints count from 1 and reply 400 'start should > 0'
for start=0; validate it client-side like get_inprogress_virtual_challenges.
get_goals is 1-based too since the previous merge, so the demo now passes
start_badge (1) instead of start (0) for the goal menu options.
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: cyberjunky/python-garminconnect/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 3ad4fb8d-24d4-4bbe-8dc3-56a5fde2ee60

📥 Commits

Reviewing files that changed from the base of the PR and between 4b06aa4 and 22ec361.

📒 Files selected for processing (3)
  • demo.py
  • garminconnect/__init__.py
  • tests/test_garmin_unit.py
 __________________________________
< Pretty fly for a code review AI. >
 ----------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

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

@cyberjunky
cyberjunky merged commit 8442d8d into master Sep 29, 2026
7 of 8 checks passed
@cyberjunky
cyberjunky deleted the fix/one-based-start-validation branch September 29, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant