Skip to content

[P1] 402 history gate: surface upgrade link in SDK + oilprice CLI; ship 1.18.0 #163

Closed

Description

@karlwaldman

Status: confirmed-live (code on origin/main, 2026-11-14)

From Mon 2026-11-16 12:00 UTC (Entitlement::HistoricalAccess::HISTORICAL_ENDPOINT_GATED_FROM, oilpriceapi-api app/services/entitlement/historical_access.rb:33) /v1/prices/historical and /v1/prices/history return 402 UPGRADE_REQUIRED for unentitled accounts (api#10744). The past_* endpoints, which client.historical.get() uses, are already gated.

Bug

The 402 body (V1::PricesController#require_paid_tier_for_historical) carries the link only as upgrade.url; there is no top-level upgrade_url. error_from_response (oilpriceapi/exceptions.py, remediation_url) reads only remediation_url / upgrade_url / action_url, so PaymentRequiredError.remediation_url is None. oilprice historical prints Error: [402] ... (no traceback, already caught at cli.py:127) but no upgrade link.

Repro: tests/unit/test_history_gate_402.py in the linked PR fails on origin/main (2 of 5) and passes with the fix.

Release 1.18.0 (N3)

MRR-tree fields

  • Metric: activation; Python/CLI/Kaggle users get a clean upgrade path after the gate.
  • Baseline: PyPI 1.17.0 (2026-10-03); pypistats last month 457 downloads (per KMW research, not re-queried).
  • Target: 1.18.0 on PyPI; entitled history passes, unentitled gets 402 with link.
  • Check date: Thu 2026-12-17.
  • Keep/rollback: keep if latest price plus entitled history pass.

Activity

  1. added
    bugSomething isn't working
    P1Major customer-facing breakage, billing/revenue error, or wrong data with no workaround.
    strategy:p0-nowNow board (capped at 15 across OPA repos)
    on Nov 14, 2026
  2. karlwaldman commented on Nov 14, 2026

    @karlwaldman
    MemberAuthor

    N3 update, re-derived 2026-11-14. Labelled strategy:p0-now (Now board, 4 of 15 open).

    Field Value
    Baseline PyPI latest 1.17.0 (uploaded 2026-10-03). pypistats: last month 457, last week 54 (confirmed). main is 4 commits past v1.17.0. Production api_requests, client_type='sdk-python', external, 2026-10-15 to 2026-11-13: 18,758 requests / 19 users / 45.1% errors (7,293 x 402, 1,164 x 403). By version: 1.5.0 11,525 req / 5 users / 61.3%; 1.17.0 5,734 / 14 / 24.3%; 1.11.0 1,499 / 1 / 0%.
    Control None. Before/after on the same query (mcp-server#145 holds it)
    Readout date Thu 2026-12-17
    Owner Karl: PyPI publish 1.18.0. Agent: #165 CI fix, #164 via elevated review. Kaggle republish: separate agent on OilpriceAPI/kaggle-notebooks#14

    Status: #164 open, risk:elevated, 2 checks failing (Python 3.8/3.9 setup on Ubuntu 26.04, #165), 4 green. #164 cannot merge until #165 lands.

  3. karlwaldman commented on Nov 14, 2026

    @karlwaldman
    MemberAuthor

    Status 2026-11-14 (periphery session):

  4. added a commit that references this issue on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Major customer-facing breakage, billing/revenue error, or wrong data with no workaround.bugSomething isn't workingstrategy:p0-nowNow board (capped at 15 across OPA repos)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions