feat: well-production resource (#50) + remove committed credential from sdk_audit_test#52
feat: well-production resource (#50) + remove committed credential from sdk_audit_test#52karlwaldman wants to merge 2 commits into
Conversation
The standalone SDK audit script carried a literal API key as an env-var fallback. It now reads OILPRICEAPI_KEY / OILPRICEAPI_TEST_KEY from the environment only, skips cleanly (exit 0) when unset, and no longer prints any key material. The exposed credential must be rotated server-side. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tion (#50) Adds client.well_production / AsyncOilPriceAPI.well_production covering: - GET /v1/well-production (national summary + top states) - GET /v1/well-production/states[/:code] - GET /v1/well-production/wells/:api (14-digit validation client-side) - GET /v1/well-production/top-producers - GET /v1/well-production/cycle-time[/cohorts] Params verified against the live API and the Rails controller (V1::WellProductionController). Beta caveats documented (per-well data limited to collected states; Drilling Intelligence plan gate is HTTP 403 ENTERPRISE_REQUIRED, not 402). Sync module is mypy strict-clean and pinned in pyproject. Unit tests are fully mocked (no key needed); live smokes tolerate the 403 gate for free-tier CI keys. Closes #50 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
well_productionresource (syncclient.well_production+ async mirror) covering all seven/v1/well-production*endpoints:summary(),states(),state(),well(),top_producers(),cycle_time(),cycle_time_cohorts().tests/sdk_audit_test.py(it was anos.getenv(...) or '<literal>'fallback in this public repo). The script now readsOILPRICEAPI_KEY/OILPRICEAPI_TEST_KEYfrom the environment only, skips cleanly (exit 0) when unset, and no longer prints key material. The exposed key must be rotated server-side — it remains in git history.Implementation notes
V1::WellProductionControllerin oilpriceapi-api:period(YYYY-MM),start_date/end_date,state_code/limit(server caps 100)/months, cycle-time filters (state,operator,formation,lat/lng/radius_miles,group_by).normalize_api_numberhelper inresource_validators.py, so both sync and async raise a descriptiveValueErrorbefore any HTTP round-trip.ENTERPRISE_REQUIRED(drilling_intelligence feature), not 402 as the issue guessed — negative-path tests reflect the real behavior.oilpriceapi.resources.well_productionis written mypy-strict-clean and pinned in the strict module list inpyproject.tomlso it can't regress.Test evidence (local, Python 3.14)
ruff check oilpriceapi/— All checks passedmypy oilpriceapi/ --ignore-missing-imports— Success: no issues found in 45 source filespytest tests/ --ignore=tests/integration --ignore=tests/contract -m 'not slow'— 351 passed, 10 skipped (10 pre-existing optional-extra skips)pytest tests/integration/test_live_well_production.py -m live) — 2 passed (envelope shapes verified with an entitled key; tests also accept the 403 gate so the free-tier CI key won't fail)tests/sdk_audit_test.pywith no key in env — prints skip message, exit 0Known issue found during live verification (not SDK-side)
GET /v1/well-production/top-producersreturns HTTP 500 in production (all other six endpoints return 200/expected errors). SDK method is included per the route contract; API-side fix tracked separately.🤖 Generated with Claude Code