Repository navigation
fix: repoint or retire 8 methods that called unrouted paths (#153) [1.17.0] - #154
Merged
Merged
Conversation
Every call to these methods returned 404 because the API never routed the
path. The mocked tests never asserted paths, so CI stayed green.
- storage.history -> /v1/storage/history/{code} (period, not dates)
- bunker_fuels.spreads -> /v1/bunker-fuels/spreads/ports (from/to required)
- bunker_fuels.historical -> /v1/bunker-fuels/historical/{port}
- forecasts.accuracy/archive -> /v1/forecasts/monthly/{accuracy,archive}
- drilling.trends, drilling.basin, futures.spreads: no route; warn and
raise ValidationError(ENDPOINT_NOT_AVAILABLE) before any request,
naming the replacement. Adds futures.calendar_spreads().
Adds a contract test against a vendored route-table snapshot that fails on
any unrouted /v1 path; it reports exactly these 8 against origin/main.
Hourly polling in the EXAMPLES.md price alert. Version 1.16.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
…atures) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #153.
Problem
Eight methods (sync and async) called
/v1paths the API never routed, so every call returned 404. The existing mocked tests did not assert request paths, which is why CI stayed green.Decisions
storage.history/v1/storage/{code}/history/v1/storage/history/{code}withperiodbunker_fuels.spreads/v1/bunker-fuels/spreads/v1/bunker-fuels/spreads/ports?from&to[&grade]bunker_fuels.historical/v1/bunker-fuels/historical?port=/v1/bunker-fuels/historical/{port}(+ client-sidefuel_typefilter)forecasts.accuracy/v1/forecasts/accuracy/v1/forecasts/monthly/accuracynot_available→DataNotFoundError(route exists; forecasts unpublished)forecasts.archive/v1/forecasts/archive/v1/forecasts/monthly/archivedrilling.trends/v1/drilling-intelligence/trendsrig_counts.trends()drilling.basin/v1/drilling-intelligence/basin/{name}ei.drilling_productivity.by_basin()futures.spreads(c1, c2)/v1/futures/spreadsfutures.calendar_spreads(contract)on/v1/futures/{slug}/spreadsDeprecationWarningand raiseValidationError(code="ENDPOINT_NOT_AVAILABLE", status_code=None). They are slated for removal in 2.0.storage.historydropsstart_date/end_date, which the route never accepted, and gainsperiod.bunker_fuels.spreadsnow requiresfrom_portandto_port.bunker_fuels.historicalreturns the API object instead of a list.Contract test
tests/unit/test_api_path_contract.pychecks every/v1literal inoilpriceapi/against a vendored route-table snapshot. The snapshot istests/fixtures/api_paths.json.fixture: 520 routes fromrails routesat apib64093719(oilpriceapi-api origin/main, 2026-10-03), plus the 105 swagger paths.rails routes, not swagger plusopenapi_route_policy.yml. The policy excludes paths by prefix (/v1/futures,/v1/storage,/v1/bunker-fuels,/v1/forecasts), which would admit every one of these dead paths.scripts/refresh_api_paths.py./v1/storage/{code}/historyfails it. With the fix, it is green.Also
EXAMPLES.mdprice-alert loop now polls hourly instead of every 30 minutes, halving its daily requests. The comment is phrased to passvalidate_storefront_claims.py, which forbids fixed rate numbers in docs.Verification (local, Python 3.14)
ruff check oilpriceapi/: clean.mypy oilpriceapi/: clean.test_dead_route_repoints.pyandtest_api_path_contract.py, sync and async).validate_storefront_claims.py: passes on source and on the built sdist.Not merged, tagged or published.
🤖 Generated with Claude Code