Skip to content

Check the Strava scopes the athlete granted; 1.15.4 - #83

Draft
sturimcode wants to merge 1 commit into
mainfrom
claude/awesome-planck-tcotr1
Draft

sturimcode wants to merge 1 commit into
mainfrom
claude/awesome-planck-tcotr1

Conversation

@sturimcode

Copy link
Copy Markdown
Owner

Why

Strava's API changelog entry for 2026-04-23 says the token response now has a scope field. It lists the scopes the athlete actually granted, separated by spaces. On Strava's consent screen the athlete can untick individual permissions. If they untick profile editing, eufy-sync used to save the grant anyway, and every later weight update failed with an HTTP 403. That 403 message mostly pointed at the API app's subscription.

What changes

  • Setup: reads the granted scopes from the token response, falling back to the callback's scope query parameter. If profile:write is missing, setup stops without saving the tokens and says to run --setup-strava again with that permission left ticked.
  • Tokens: the granted scopes are saved with the tokens. On refresh, a scope returned by Strava replaces the saved list; otherwise the saved list is kept.
  • doctor / check_connection: reports a known grant without profile:write and offers --setup-strava as the fix.
  • update_weight 403: when the scopes are known, the message names one cause: either the missing permission or the subscription. Grants saved before this change have no scope list and get the same combined message as before.
  • The requested scopes (profile:write,profile:read_all) are unchanged.
  • README setup step mentions leaving the profile permission ticked. Version bumped to 1.15.4.

Testing

pytest: 803 passed, 6 skipped. ruff check is clean. The new tests cover setup end to end through the local callback server, with the browser and the token exchange mocked. They also cover how scopes are kept across a refresh and the new error messages.


Generated by Claude Code

Strava's changelog (2026-04-23) says the token response now lists the
granted scopes. The athlete can untick profile:write on the consent
screen, which used to surface only later as an ambiguous 403.

- Setup refuses a grant without profile:write and says how to fix it.
- Granted scopes are saved with the tokens and kept across refreshes.
- doctor and weight-update 403s name the missing permission when the
  scopes are known; older grants without a scope list behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PbMTbkp1w5JTQYmxMm2n6Q

Copy link
Copy Markdown
Owner Author

The CI check is failing because of one matrix job, checks / test (macos-latest, 3.15). That job never ran: it waited in the queue for a macOS runner and was cancelled after 15 minutes, both on the first run and on the one re-run of the failed jobs. GitHub has no logs for it. No test has failed on this PR, so the failure isn't caused by the changes. The other 13 jobs passed, including macOS on Python 3.12, 3.13 and 3.14 and all Windows and Linux versions.

Re-running that job when a macOS 3.15 runner is available should turn CI green. I haven't re-run it a second time.


Generated by Claude Code

This branch has not been deployed

No deployments
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.

2 participants