You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: pay down mypy typing-debt + param audit + live demo contract tests
Task 1 — typing-debt paid down: fixed the real type errors in client,
async_client, cli, telemetry, prices, alerts, analytics, data_sources,
webhooks and the package __init__ with proper annotations (not type: ignore),
then removed all 10 TODO(typing-debt) per-module mypy overrides. The only
remaining narrow override is models.py import-untyped (optional dateutil stub,
not a real typing bug). `mypy oilpriceapi/ --ignore-missing-imports` is clean
with the overrides gone.
Task 2 — param-correctness audit vs the real controllers:
- analytics: SDK sent commodity/commodity1/commodity2/days; the v1 analytics
controller requires code/code1/code2/period. Fixed correlation (the Node SDK
bug class), plus statistics/trend/forecast. performance now maps to the
controller's `range` param; spread now targets a named spread (the endpoint
takes a spread name, not two codes) and a new available_spreads() helper was
added. Same fixes applied to the async analytics resource.
- webhooks: controller permits `status` (active/inactive/paused), not boolean
`enabled`. create/update now map enabled -> status (sync + async).
- data_sources: controller requires params nested under `data_source` and uses
`status` + `scraper_config`, not flat `enabled` + `config`. create/update now
nest and map correctly (sync + async).
- alerts already nested correctly under price_alert with the right keys.
Added wire-param unit tests asserting the exact params sent.
Task 3 — live demo contract tests: new DemoResource (client.demo, also usable
standalone with no API key) hitting GET /v1/demo/prices and /v1/demo/commodities.
Live tests under tests/integration (marked `live`, excluded from the unit gate)
assert the real envelope: 9 free-tier prices incl BRENT_CRUDE_USD ~$80, 442
commodities, meta.free_commodities. Mocked unit tests cover the accessor.
Gates: mypy clean, ruff clean (oilpriceapi/), 249 unit tests pass, cov 57.38%
(>=50). Version not bumped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments