From 0d0633adec06252768ba97af7f4fa14cc98d7692 Mon Sep 17 00:00:00 2001 From: Alex Harrison Date: Tue, 1 Dec 2026 10:19:21 -0700 Subject: [PATCH] Remove integrations (sync, status, disconnect): intervals.icu terms bar token sharing From 2026-12-31 intervals.icu's API Terms have each developer use a credential only for the app it was issued to (3.3) and bar sharing or transferring credentials (4.2, 10.2), so the API stops taking another app's intervals.icu access token (fuel-backend icusync). status and disconnect only served the connections sync made. Partners send workouts from other platforms with activity import. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +++++ README.md | 5 ++-- saturday/__init__.py | 14 ---------- saturday/client.py | 51 ++---------------------------------- saturday/types.py | 55 +-------------------------------------- tests/LIVE.md | 2 +- tests/fixtures/live.json | 11 -------- tests/test_api_surface.py | 19 ++------------ tests/test_bugfixes.py | 4 +-- tests/test_contracts.py | 6 +---- tests/test_live.py | 8 +----- tests/test_models.py | 7 ----- tests/test_request.py | 16 +----------- 13 files changed, 19 insertions(+), 185 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3ca1a..dd0a26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +Breaking changes: + +- `client.integrations` is gone: `sync`, `status` and `disconnect`, with the types `IntegrationProvider`, `SyncProvider`, `IntegrationStatusDetail`, `IntegrationStatusResponse`, `IntegrationSyncResult`, `IntegrationSyncResponse` and `IntegrationDisconnectResponse`. The API no longer takes another app's intervals.icu access token: intervals.icu's API Terms, in force from 31 December 2026, have each developer use its credentials only for its own app (3.3) and bar sharing or transferring them (4.2, 10.2). Send an athlete's workouts from another platform with `activities.import_activities`. The error codes `invalid_provider`, `integration_not_found`, `sync_error`, `status_error` and `disconnect_error` leave the catalog with them. + ## 0.9.0 Breaking changes: diff --git a/README.md b/README.md index 9fabbc2..8ac0a16 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,6 @@ with Saturday(api_key="sk_test_...") as client: | `client.partner` | `get`, `usage`, `usage_daily`, `list_api_keys`, `create_api_key`, `revoke_api_key`, `rotate_api_key` | | `client.webhooks` | `create`, `list`, `get`, `update`, `delete`, `test`, `list_deliveries` | | `client.organizations` | `create`, `list`, `get`, `update`, `add_member`, `list_members`, `remove_member`, `set_offer`, `get_offer`, `delete_offer`, `create_subscription`, `list_subscriptions`, `update_subscription`, `add_licenses`, `list_licenses`, `remove_license` | -| `client.integrations` | `sync` (intervals.icu), `status`, `disconnect` | | `client.testing` | `simulate_subscription` (test keys only) | | `client.meta` | `discovery`, `errors`, `health` | | `client.knowledge` | `search`, `list_topics`, `get_article` (early access) | @@ -216,9 +215,9 @@ Every method returns the API's JSON as plain dictionaries, typed with the TypedD Every timestamp a partner key receives is an integer of Unix seconds: on athletes, activities, webhooks and their deliveries, API keys, your account, `trial_ends_at`, the fueling profile's `updated_at`, the export's `exported_at` and every time in its records. Coach routes answer in Unix milliseconds. -`athletes.update_settings` replaces the whole settings object: send every setting you want kept. `athletes.delete` removes the athlete and everything stored under them in your account. `athletes.erase` is for a right-to-erasure request: it first revokes, at the provider, each connection you supplied for the athlete with `integrations.sync`, then deletes the athlete, everything stored under them and their link to a Saturday account. A linked athlete's own Saturday account is not changed. A 503 with code `provider_erasure_incomplete` means nothing was deleted yet: call `erase` again. +`athletes.update_settings` replaces the whole settings object: send every setting you want kept. `athletes.delete` removes the athlete and everything stored under them in your account. `athletes.erase` is for a right-to-erasure request: it deletes the athlete, everything stored under them and their link to a Saturday account. A linked athlete's own Saturday account is not changed. A 503 with code `provider_erasure_incomplete` means nothing was deleted yet: call `erase` again. -`integrations.sync("intervals_icu", ...)` fetches the activities of the intervals.icu user an access token belongs to, a token your intervals.icu app obtained, and stores them under your athlete; it is the only provider sync takes. Send TrainingPeaks workouts with `activities.import_activities` once the athlete agrees to share them. `integrations.disconnect` ends the connection you supplied and keeps the activities already synced; for a provider the athlete never connected it raises `NotFoundError` (`integration_not_found`). +To bring in an athlete's workouts from another platform, send them with `activities.import_activities`: Saturday no longer takes a platform's access token from you. Nutrition and knowledge sit behind [feature gates](https://docs.saturday.fit/guides/feature-gates) that Saturday opens per partner. Until a gate is open for your key, its routes answer `403` with code `feature_alpha` (`PermissionDeniedError`); ask api@saturday.fit to open one. diff --git a/saturday/__init__.py b/saturday/__init__.py index 0cdfc30..c34b529 100644 --- a/saturday/__init__.py +++ b/saturday/__init__.py @@ -93,12 +93,6 @@ HealthResponse, ImportActivityRequest, ImportPrescriptionItem, - IntegrationDisconnectResponse, - IntegrationProvider, - IntegrationStatusDetail, - IntegrationStatusResponse, - IntegrationSyncResponse, - IntegrationSyncResult, LegPrescription, License, LicenseListResponse, @@ -151,7 +145,6 @@ SimulateSubscriptionResponse, StoredPrescriptionResponse, SubscriptionCTA, - SyncProvider, TrialMetadata, UsagePeriod, UsageResponse, @@ -241,12 +234,6 @@ "HealthResponse", "ImportActivityRequest", "ImportPrescriptionItem", - "IntegrationDisconnectResponse", - "IntegrationProvider", - "IntegrationStatusDetail", - "IntegrationStatusResponse", - "IntegrationSyncResponse", - "IntegrationSyncResult", "License", "LicenseListResponse", "LimitingFactor", @@ -293,7 +280,6 @@ "SimulateSubscriptionResponse", "StoredPrescriptionResponse", "SubscriptionCTA", - "SyncProvider", "TrialMetadata", "UsagePeriod", "UsageResponse", diff --git a/saturday/client.py b/saturday/client.py index 3a0e12d..dc5f01c 100644 --- a/saturday/client.py +++ b/saturday/client.py @@ -46,9 +46,6 @@ FuelingProfile, HealthResponse, ImportActivityRequest, - IntegrationDisconnectResponse, - IntegrationStatusResponse, - IntegrationSyncResponse, LicenseListResponse, NutritionCalculateResponse, OnboardingLink, @@ -177,7 +174,6 @@ def __init__( self.partner = _PartnerResource(self) self.webhooks = _WebhooksResource(self) self.organizations = _OrganizationsResource(self) - self.integrations = _IntegrationsResource(self) self.testing = _TestingResource(self) self.meta = _MetaResource(self) self.knowledge = _KnowledgeResource(self) @@ -407,10 +403,8 @@ def export(self, athlete_id: str) -> AthleteDataExport: def erase(self, athlete_id: str) -> None: """Erase everything Saturday holds for you about the athlete, for a right-to-erasure request. - Each provider connection you supplied for the athlete with ``integrations.sync`` is revoked - at the provider first; then the athlete and everything stored under them are deleted - (activities, those synced through your connections included, prescriptions, feedback, - consent records, usage logs) with the athlete's link to a Saturday account. A linked + The athlete and everything stored under them are deleted (activities, prescriptions, + feedback, consent records, usage logs) with the athlete's link to a Saturday account. A linked athlete's own Saturday account is not changed. A ``SaturdayError`` with status 503 and code ``provider_erasure_incomplete`` means a connection could not be revoked yet and nothing was deleted: call ``erase`` again. @@ -707,47 +701,6 @@ def remove_license(self, org_id: str, sub_id: str, athlete_id: str) -> None: ) -class _IntegrationsResource: - def __init__(self, client: Saturday): - self._client = client - - def sync( - self, - provider: str, - *, - athlete_id: str, - access_token: str, - date_range: Optional[Dict[str, str]] = None, - sync_types: Optional[List[str]] = None, - ) -> IntegrationSyncResponse: - """Fetch the activities of the intervals.icu user an access token belongs to and store each - as an activity of your athlete. - - ``provider`` is ``"intervals_icu"``, the only one: Strava and TrainingPeaks tokens raise - ``ValidationError`` (``invalid_provider``). Send an OAuth access token your intervals.icu app - obtained from that user; the calls count against your app's intervals.icu limit. - ``date_range`` is ``{"start": "YYYY-MM-DD", "end": "YYYY-MM-DD"}``, both or neither; without - it, the last 7 days. ``sync_types`` defaults to ``["activities"]``. The result is under - ``result``. - """ - body: Dict[str, Any] = {"athlete_id": athlete_id, "access_token": access_token, "sync_types": sync_types or ["activities"]} - if date_range is not None: - body["date_range"] = date_range - return self._client.request("POST", f"/v1/integrations/{_seg(provider)}/sync", json=body) - - def status(self, provider: str, athlete_id: str) -> IntegrationStatusResponse: - """``provider``: ``intervals_icu``, ``strava`` or ``training_peaks``.""" - return self._client.request("GET", f"/v1/integrations/{_seg(provider)}/status", params={"athlete_id": athlete_id}) - - def disconnect(self, provider: str, athlete_id: str) -> IntegrationDisconnectResponse: - """End the connection you supplied for the athlete with ``sync``: it is revoked at the - provider and its tokens are removed. Activities already synced stay. A linked athlete's own - connection to the provider in their Saturday account is not changed. A provider the athlete - never connected raises ``NotFoundError`` (code ``integration_not_found``), and nothing - reaches the provider.""" - return self._client.request("POST", f"/v1/integrations/{_seg(provider)}/disconnect", json={"athlete_id": athlete_id}) - - class _TestingResource: """Test environment only (``sk_test_`` keys). In production these routes answer 404.""" diff --git a/saturday/types.py b/saturday/types.py index 504c7a2..a6f68bf 100644 --- a/saturday/types.py +++ b/saturday/types.py @@ -1519,60 +1519,7 @@ class AthleteDataExport(_AthleteDataExportRequired, total=False): consent: List[Dict[str, Any]] -# --- Integrations and the test project --- - - -IntegrationProvider = Literal["intervals_icu", "strava", "training_peaks"] -"""The providers ``integrations.status`` and ``integrations.disconnect`` take.""" - -SyncProvider = Literal["intervals_icu"] -"""The provider ``integrations.sync`` takes. Strava and TrainingPeaks tokens are refused with a -``ValidationError`` (``invalid_provider``).""" - - -class _IntegrationStatusDetailRequired(TypedDict): - provider: IntegrationProvider - connected: bool - sync_count: int - - -class IntegrationStatusDetail(_IntegrationStatusDetailRequired, total=False): - last_sync_at: int # Unix seconds. - errors: List[str] - - -class IntegrationStatusResponse(TypedDict): - status: IntegrationStatusDetail - request_id: str - - -class _IntegrationSyncResultRequired(TypedDict): - provider: SyncProvider - # partial when some activities could not be stored, failed when none could or intervals.icu - # refused the token; errors says why. - status: Literal["completed", "partial", "failed"] - activities_found: int - activities_synced: int - activities_skipped: int # Found but not stored: the activity's type names no sport the API supports. - - -class IntegrationSyncResult(_IntegrationSyncResultRequired, total=False): - # Whether the athlete's prescriptions for these activities are exact (full) or ranges (teaser). - prescription_tier: Literal["full", "teaser"] - errors: List[str] - - -class IntegrationSyncResponse(TypedDict): - result: IntegrationSyncResult - request_id: str - - -class IntegrationDisconnectResponse(TypedDict): - """The connection you supplied is ended.""" - - message: str # For example "Successfully disconnected intervals_icu". - provider: IntegrationProvider - request_id: str +# --- The test project --- class SimulateSubscriptionResponse(TypedDict): diff --git a/tests/LIVE.md b/tests/LIVE.md index 2372305..6bf2670 100644 --- a/tests/LIVE.md +++ b/tests/LIVE.md @@ -12,6 +12,6 @@ python -m pytest tests/test_live.py - One run makes about 130 calls, of which about 45 are calculations, prep, product fit and compare, and creates 4 athletes (one of them with a simulated subscription, for the brick and triathlon block), 4 activities, an organization, an API key and a webhook pointed at `https://example.com`. The webhook receives two deliveries, a `webhook.test` and a `prescription.calculated`; example.com answers 405, and the suite reads each event body from its delivery record. It erases the athletes, with their activities, and deletes the key and webhook it created; the organization stays. - The catalog products it sizes are Maurten Gel 100 and Tailwind Endurance Fuel. - `athletes.erase` and `testing.simulate_subscription` need the test environment. The run marks 2 athletes with `testing.simulate_subscription`, inside the 10 a key may mark per UTC day. -- It also checks what the API refuses: a second athlete with a taken `external_id` (create, batch item and update), a Strava or TrainingPeaks token on `integrations.sync`, prep with both `products=` and `legs=`, and the stored prescription after an update that changes the session. +- It also checks what the API refuses: a second athlete with a taken `external_id` (create, batch item and update) prep with both `products=` and `legs=`, and the stored prescription after an update that changes the session. Set `SATURDAY_LIVE_CAPTURE=tests/fixtures/live.json` to record every response. Keys, secrets, signed links and account details are replaced with placeholders before they are written. `tests/test_live_types.py`, part of the normal test run, checks every recorded response against the TypedDict its method returns: every required key, no undeclared key, every value of its declared type, so a field the API adds, drops or renames fails the suite until the types match. diff --git a/tests/fixtures/live.json b/tests/fixtures/live.json index b15143b..e6c7bb9 100644 --- a/tests/fixtures/live.json +++ b/tests/fixtures/live.json @@ -2815,17 +2815,6 @@ ] } }, - "integration_status": { - "type": "IntegrationStatusResponse", - "body": { - "request_id": "req_188ac58bbdd9", - "status": { - "provider": "intervals_icu", - "connected": false, - "sync_count": 0 - } - } - }, "calculate_brick": { "type": "NutritionCalculateResponse", "body": { diff --git a/tests/test_api_surface.py b/tests/test_api_surface.py index 1fd1a29..698f1af 100644 --- a/tests/test_api_surface.py +++ b/tests/test_api_surface.py @@ -39,14 +39,6 @@ "licenses": [{"email": "sam@example.com", "added_at": 1700000000, "active": True, "athlete_id": "ath_1", "name": "Sam"}], "total": 1, "request_id": "req_lic", } -# CONSTRUCTED from IntegrationSyncResponse in saturday/types.py. -SYNCED = { - "result": {"provider": "intervals_icu", "status": "completed", "activities_found": 2, - "activities_synced": 2, "activities_skipped": 0, "prescription_tier": "full"}, - "request_id": "req_sync", -} -# CONSTRUCTED from IntegrationDisconnectResponse (its docstring gives the message). -DISCONNECTED = {"message": "Successfully disconnected intervals_icu", "provider": "intervals_icu", "request_id": "req_disc"} # CONSTRUCTED: nutrition.extract, infer.* and knowledge.* return Dict and no # response shape for them exists in this repository's docs, types or fixtures. EXTRACTED = {"product_name": "Example Gel", "per_serving": {"carb_g": 25.0, "sodium_mg": 50.0, "fluid_ml": 0.0}} @@ -249,14 +241,7 @@ "GET", "/v1/organizations/org_1/subscriptions/sub_1/licenses", {}, None, 200, LICENSES, "LicenseListResponse"), ("organizations-remove-license", lambda c: c.organizations.remove_license("org_1", "sub_1", "ath_1"), "DELETE", "/v1/organizations/org_1/subscriptions/sub_1/licenses/ath_1", {}, None, 204, None, None), - # integrations, testing, meta, knowledge - ("integrations-sync", lambda c: c.integrations.sync("intervals_icu", athlete_id="ath_1", access_token="tok"), - "POST", "/v1/integrations/intervals_icu/sync", {}, {"athlete_id": "ath_1", "access_token": "tok", "sync_types": ["activities"]}, - 200, SYNCED, "IntegrationSyncResponse"), - ("integrations-status", lambda c: c.integrations.status("intervals_icu", "ath_1"), - "GET", "/v1/integrations/intervals_icu/status", {"athlete_id": "ath_1"}, None, 200, LIVE["integration_status"], "IntegrationStatusResponse"), - ("integrations-disconnect", lambda c: c.integrations.disconnect("intervals_icu", "ath_1"), - "POST", "/v1/integrations/intervals_icu/disconnect", {}, {"athlete_id": "ath_1"}, 200, DISCONNECTED, "IntegrationDisconnectResponse"), + # testing, meta, knowledge ("testing-simulate-subscription", lambda c: c.testing.simulate_subscription("ath_1"), "POST", "/v1/test/athletes/ath_1/simulate-subscription", {}, {"active": True}, 200, LIVE["simulate_subscription"], "SimulateSubscriptionResponse"), ("meta-discovery", lambda c: c.meta.discovery(), @@ -385,7 +370,7 @@ def test_case_table_covers_every_resource_method(): "nutrition": client.nutrition, "athletes": client.athletes, "activities": client.activities, "onboarding": client.onboarding, "reference": client.reference, "infer": client.infer, "partner": client.partner, "webhooks": client.webhooks, "organizations": client.organizations, - "integrations": client.integrations, "testing": client.testing, "meta": client.meta, + "testing": client.testing, "meta": client.meta, "knowledge": client.knowledge, "coach": client.coach, } # coach.report_pdf returns bytes: its case is the separate test below. diff --git a/tests/test_bugfixes.py b/tests/test_bugfixes.py index 1e061ea..bbb22df 100644 --- a/tests/test_bugfixes.py +++ b/tests/test_bugfixes.py @@ -63,7 +63,7 @@ def test_retry_after_is_kept_on_typed_errors(status, klass): lambda c: c.activities.get("ath_1", ""), lambda c: c.knowledge.get_article(""), lambda c: c.coach.delete_webhook(""), - lambda c: c.integrations.status("", "ath_1"), + lambda c: c.organizations.get(""), ]) def test_empty_path_segment_is_rejected_before_any_request(call): """Bug: _seg rejected "." and ".." for reaching another route but encoded @@ -114,7 +114,7 @@ def test_readme_resource_table_lists_every_method(): client = Saturday(api_key="sk_test_fake") try: for name in ("nutrition", "athletes", "activities", "onboarding", "reference", "infer", "partner", - "webhooks", "organizations", "integrations", "testing", "meta", "knowledge"): + "webhooks", "organizations", "testing", "meta", "knowledge"): actual = {m for m, _ in inspect.getmembers(getattr(client, name), predicate=inspect.ismethod) if not m.startswith("_")} assert rows[name] == actual, f"README row for {name}: table {sorted(rows[name])} != client {sorted(actual)}" diff --git a/tests/test_contracts.py b/tests/test_contracts.py index 3a8d8e3..ece1347 100644 --- a/tests/test_contracts.py +++ b/tests/test_contracts.py @@ -238,8 +238,6 @@ def test_shared_profile_carries_every_answer_and_unshared_carries_none(): "POST", "/v1/infer/activity-type", {"activity_name": "Morning Ride", "tags": ["bike"]}), (lambda c: c.infer.brick_types(activity_name="Brick session"), "POST", "/v1/infer/brick-types", {"activity_name": "Brick session"}), - (lambda c: c.integrations.disconnect("intervals_icu", "ath_1"), - "POST", "/v1/integrations/intervals_icu/disconnect", {"athlete_id": "ath_1"}), (lambda c: c.organizations.update_subscription("org_1", "sub_1", seats=10), "PATCH", "/v1/organizations/org_1/subscriptions/sub_1", {"seats": 10}), (lambda c: c.organizations.add_licenses("org_1", "sub_1", [{"athlete_id": "ath_1"}]), @@ -358,8 +356,6 @@ def send(request): "POST", "/v1/organizations/org_1/subscriptions", {}, {"type": "team", "seats": 10, "start_date": 1700000000, "end_date": 1730000000}), (lambda c: c.organizations.list_subscriptions("org_1"), "GET", "/v1/organizations/org_1/subscriptions", {}, None), - (lambda c: c.integrations.status("intervals_icu", "ath_1"), - "GET", "/v1/integrations/intervals_icu/status", {"athlete_id": "ath_1"}, None), (lambda c: c.testing.simulate_subscription("ath_1"), "POST", "/v1/test/athletes/ath_1/simulate-subscription", {}, {"active": True}), (lambda c: c.testing.simulate_subscription("ath_1", active=False), @@ -375,7 +371,7 @@ def send(request): "webhook-update-full", "webhook-update-partial", "webhook-delete", "webhook-test", "org-create-full", "org-create-minimal", "org-add-member-full", "org-add-member-default", "org-list-members", "org-remove-member", "org-set-offer", "org-delete-offer", - "org-create-subscription", "org-list-subscriptions", "integration-status", + "org-create-subscription", "org-list-subscriptions", "simulate-on", "simulate-off", "discovery", "error-catalog", "health", "knowledge-full", "knowledge-plain", ]) diff --git a/tests/test_live.py b/tests/test_live.py index f94bdef..231f318 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -302,18 +302,12 @@ def test_main_flows(live): client.organizations.create_subscription(org["id"], type="team", seats=5, start_date=1, end_date=2) assert restricted.value.code == "organization_subscription_restricted" - # Privacy and integrations + # Privacy consent = capture("consent", "ConsentRecord", client.athletes.record_consent(complete["id"], consent_type="analytics", granted=True)) capture("consent_list", "ConsentListResponse", client.athletes.list_consent(complete["id"])) client.athletes.revoke_consent(complete["id"], consent["id"]) exported = capture("export", "AthleteDataExport", client.athletes.export(complete["id"])) assert abs(exported["exported_at"] - time.time()) < 600 - for provider in ("strava", "training_peaks"): - with pytest.raises(ValidationError) as refused_provider: - client.integrations.sync(provider, athlete_id=complete["id"], access_token="not-a-token") - assert refused_provider.value.code == "invalid_provider" - status = capture("integration_status", "IntegrationStatusResponse", client.integrations.status("intervals_icu", complete["id"])) - assert status["status"]["connected"] is False client.athletes.erase(partial["id"]) with pytest.raises(NotFoundError): client.athletes.get(partial["id"]) diff --git a/tests/test_models.py b/tests/test_models.py index 315ccab..48b7efe 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -65,7 +65,6 @@ "FuelingProfileWeight": PROFILE["athlete_weight_kg"], "GapAmounts": LIVE["product_fit"]["fit"]["remaining_gap"], "ImportPrescriptionItem": CONTRACTS["import_calculated"]["prescriptions"][0], - "IntegrationStatusDetail": LIVE["integration_status"]["status"], "LegPrescription": LIVE["calculate_brick"]["legs"][0], "LinkedSessionTypeInfo": LIVE["activity_types"]["linked_session_types"][0], "MissingField": CONTRACTS["activity_full_banded"]["precision"]["missing_fields"][0], @@ -108,12 +107,6 @@ "OrganizationSubscription": {"id": "sub_1", "org_id": "org_1", "partner_id": "partner_example", "type": "team", "seats": 10, "used_seats": 3, "status": "active", "start_date": 1700000000, "end_date": 1730000000, "created_at": 1700000000}, - "IntegrationSyncResult": {"provider": "intervals_icu", "status": "completed", "activities_found": 2, - "activities_synced": 2, "activities_skipped": 0, "prescription_tier": "full"}, - "IntegrationSyncResponse": {"result": {"provider": "intervals_icu", "status": "completed", "activities_found": 2, - "activities_synced": 2, "activities_skipped": 0}, "request_id": "req_sync"}, - "IntegrationDisconnectResponse": {"message": "Successfully disconnected intervals_icu", - "provider": "intervals_icu", "request_id": "req_disc"}, } NON_MODELS = { diff --git a/tests/test_request.py b/tests/test_request.py index 8d42564..a73ed53 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -278,19 +278,6 @@ def test_taken_external_id_raises_conflict_naming_the_athlete(make_client): assert len(calls) == 1 -def test_sync_posts_to_the_intervals_icu_route_with_sync_types(make_client): - seen = [] - body = {"result": {"provider": "intervals_icu", "status": "completed", "activities_found": 1, - "activities_synced": 1, "activities_skipped": 0}, "request_id": "req_1"} - client = make_client(lambda r: seen.append(r) or httpx.Response(200, json=body)) - synced = client.integrations.sync("intervals_icu", athlete_id="ath_1", access_token="tok", - date_range={"start": "2026-11-01", "end": "2026-11-07"}) - assert synced["result"]["activities_synced"] == 1 - assert seen[0].url.path == "/v1/integrations/intervals_icu/sync" - assert json.loads(seen[0].content) == {"athlete_id": "ath_1", "access_token": "tok", "sync_types": ["activities"], - "date_range": {"start": "2026-11-01", "end": "2026-11-07"}} - - def test_erase_incomplete_is_raised_not_retried(make_client): calls = [] client = make_client(lambda r: calls.append(r) or httpx.Response(503, json={"error": { @@ -737,7 +724,6 @@ def test_5xx_json_errors_keep_their_code_and_retry_after(make_client, status): (lambda c: c.organizations.add_licenses("org_1", "sub_1", [{"athlete_id": "ath_1"}]), 1), (lambda c: c.activities.create("ath_1", type="run", duration_min=60), 1), (lambda c: c.activities.import_activities("ath_1", [{"type": "run", "duration_min": 60}]), 1), - (lambda c: c.integrations.sync("intervals_icu", athlete_id="ath_1", access_token="tok"), 1), (lambda c: c.knowledge.search("sodium"), 1), (lambda c: c.coach.apply_preset(scope="overall", preset="balanced"), 1), (lambda c: c.coach.register_webhook("https://example.com/hook"), 1), @@ -749,7 +735,7 @@ def test_5xx_json_errors_keep_their_code_and_retry_after(make_client, status): ], ids=[ "batch", "product-fit", "compare", "extract", "infer-activity", "infer-brick", "export", "onboarding-link", "webhook-create", "key-create", "key-rotate", - "license-grant", "activity-create", "activity-import", "sync", "knowledge-search", + "license-grant", "activity-create", "activity-import", "knowledge-search", "preset", "coach-webhook-register", "put-rules", "patch-athlete", "patch-subscription", "delete-webhook", "delete-coach-webhook", ])