Skip to content

[P1][Sprint 1][Subscriptions] Complete get, update, pause, and resume lifecycle #100

Closed

Description

@karlwaldman

Why

The API exposes GET/PATCH /v1/subscriptions/{id} and pause/resume member actions. The Python client currently supports list/create/delete/events only.

Acceptance criteria

  • Add typed sync and async get, update, pause, and resume methods.
  • Validate IDs and update payloads before network calls.
  • Return typed Subscription objects and preserve server recovery metadata.
  • Test 404, 422, entitlement, malformed-success, and timeout paths.
  • Add an isolated live lifecycle smoke with guaranteed cleanup.
  • Document and release the completed lifecycle.

Delivery

Independent Python release.

Activity

  1. karlwaldman commented on Sep 13, 2026

    @karlwaldman
    MemberAuthor

    Premise check before implementation, verified 2026-09-13 against oilpriceapi-api origin/main and production.

    Confirmed

    • Routes exist: resources :subscriptions, only: [:index, :show, :create, :update, :destroy] with member post :pause / post :resume (config/routes.rb, the #3245 Phase 2 block).
    • /v1/subscriptions is the Watch model (agent price watches). It is not billing: the controller touches no Stripe or plan state, and the model is named Watch specifically "to avoid colliding with Billing::Subscription". A live lifecycle smoke is therefore safe on the test key's own account.
    • Wire shape: every single-record action renders {"status":"success","data":{"subscription":{id,name,codes,interval_seconds,status,deliver_webhook,source,tool_name,last_evaluated_at,next_run_at,created_at}}}; unknown id is 404 {"error":{"code":"NOT_FOUND","message":"Subscription not found","request_id":...}} (probed live).

    Corrections

    1. "Test ... entitlement ... paths": only create can return an entitlement 402 (WATCH_LIMIT via enforce_watch_limit, INTERVAL_FLOOR via render_watch_save_failure). update routes every model failure, including the plan interval floor and webhook delivery without the entitlement, through render_watch_errors, a 422 {"status":"fail","data":{"error":"VALIDATION_ERROR","message","details"}}. pause/resume have no entitlement gate. The PR tests the 402 on create and the entitlement refusals on update as 422.
    2. "Document and release" / the sprint's "capabilities metadata": this repo has no machine-readable capabilities file (git grep -i capabilit origin/main hits only README prose; the one machine-readable artifact is the snippet manifest examples/snippets/manifest-source.json). No new metadata file is invented. The release is deferred: the PR adds a ## [Unreleased] CHANGELOG entry and no version bump or tag.
    3. "Preserve server recovery metadata": already carried by the typed exceptions (request_id, code, remediation_url from upgrade_url, raw_body). The PR asserts it survives rather than adding a new mechanism.
  2. added 2 commits that reference this issue on Sep 13, 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

    featureNew featurepriority: highShould be fixed soonqaQuality assurance and testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions