Repository navigation
Encode coach ids, keep the API key on the base URL, read HTTP-date Retry-After; tests for 14 untested methods - #33
Merged
Merged
Conversation
- Encode coach athlete/activity/webhook ids; reject . and .. segments - Normalize method, refuse absolute URLs, cap backoff and error text - Parse Retry-After HTTP-dates; handle null/non-object error bodies - Validate api_key, timeout and max_retries in constructor - Add coach route tests and 14 partner method request tests
…sses bearer_token The new validation refused api_key="" even with a bearer token, which is how an OAuth-only partner constructs the client. Control characters are refused in whichever credential is sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Review verdict: MERGE Read the whole diff against main and the confirmed coach-id finding:
Runs: Minor, no hold: the constructor now raises |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security and robustness fixes, plus request tests for 14 partner methods that had no test. Muse (Meta Muse Code, Meta training off) wrote it in a code lane. A Claude read the whole diff, changed one check (below), and reran the suite:
uv run --with pytest --with pytest-asyncio --with httpx pytest -qgives 277 passed, 2 skipped. No version bump, changelog or workflow change; the release is your call. No landing label.Fixed, each with a test
_seg. Before,coach.fueling_rollup("../../partner")called/v1/partner/fueling-rollupwith the coach key._segrefuses.and...request()refuses an absolute or scheme-relative URL. Before,request("GET", "https://other.host/x")sent the API key to that host.request()upper-cases the method once at entry.Retry-Afteras an HTTP date is read (wait = date minus now, never below 0). An empty or unreadable header counts as absent. Before, an HTTP date on a 429 read as a daily ceiling.erroris not an object, gives the normal error class withHTTP <status>and codeunknown(before:AttributeError).timeoutmust be a finite number above 0,max_retriesan integer of 0 or more, and the credential sent must be non-empty with no control characters. Muse's version refusedapi_key=""even withbearer_token, which an OAuth-only client passes; the Claude review allowed that case and added a test.Retry-Afteralready had.Tests added: request method, path and body for
nutrition.extract, bothinfercalls,integrations.disconnect,organizations.update_subscription, the three license calls,knowledge.list_topicsandget_article,activities.get,organizations.get,updateandget_offer, and 14 coach routes.Behavior a partner could notice: bad constructor options and dot-only ids now raise
ValueErrorat once instead of failing later.Design questions, left untouched for you
http://is accepted silently today).SaturdayErrorfor an unreadable success body (today a bareJSONDecodeError).hatchlingandhttpxwith no upper bound, and actions pinned by tag.🤖 Generated with Claude Code