Files
FabledCurator/tests/fixtures/patreon_members_page1.json
T
bvandeusenandClaude Opus 5 afcde8e457
CI / lint (push) Successful in 3s
CI / extension-version (push) Successful in 3s
Build images / sign-extension (push) Successful in 5s
Build images / build-agent (push) Successful in 7s
CI / frontend-build (push) Successful in 24s
CI / backend-lint-and-test (push) Successful in 58s
Build images / build-web (push) Successful in 1m16s
Build images / smoke-web (push) Skipped
CI / integration (push) Successful in 2m25s
Build images / build-ml (push) Successful in 2m45s
Build images / promote (push) Skipped
feat: PatreonClient.iter_memberships — the roster seam (milestone 387 step C2)
Built on C0's real capture (Scribe note #3886), not on API docs — gallery-dl
has no membership extractor and Patreon's public v2 API is the CREATOR surface
behind OAuth, so the rule-130 reference had to be a characterized response.

**The request is deliberately minimal, and that is a privacy decision.** The
browser's own include set pulls `latest_pledge.card`, and those card resources
come back carrying the ACCOUNT HOLDER'S EMAIL in `merchant_name`; `address` is
in there too. Copying the query string wholesale is the obvious move and would
have FC fetching payment PII it has no use for and can only mishandle. We ask
for `include=campaign,reward` and nothing else, and a test asserts on the
params actually sent so nobody widens it back.

**We do not send `filter[membership_type]`.** The browser sends the six buckets
its settings page displays, which excludes lapsed memberships — and a
DISAPPEARANCE is precisely the signal the roster exists to read. Filtering here
would manufacture the event C4 acts on.

Two corrections the capture forced, both now in code:

* **The filter vocabulary is not the status vocabulary.** I had read the six
  filter words off a screenshot and was about to write them into
  MEMBERSHIP_STATUS as the enum. The body shows `patron_status` carrying
  `former_patron` — absent from that filter — on a row the filter selected as
  `free_member`. So the map is taught exactly the two OBSERVED values, and
  `declined_patron` stays out despite looking obviously right: believing the
  filter is the mistake that was just caught.
* **Free membership is a boolean, not a status.** `has_paid_access` gains an
  `is_free_member` axis, because `active_patron` alone would report a free
  follower as a paying patron and C4 would never offer to clean it up. Honest
  limit, stated in the docstring: the capture has no ACTIVE free member, so it
  shows the separation is possible, not that it occurs.

C1's tripwire test did its job — it was written to fail the moment anyone
populated the status map, and updating it here IS the confirmation step, done
with the capture rather than ahead of it.

`_fetch`'s retry/backoff/auth-vs-drift/Retry-After logic is extracted to a
shared `_request` so the roster rides the same path rather than growing a
second copy — two copies would drift, and the half that drifted would be the
one that only runs daily. Every error message and log line renders
byte-identically for the posts path, so the existing tests pin the refactor.

Pagination is driven by `page[offset]` against `meta.pagination.total`, never
by `links`: the response's own `links.first` is built WITHOUT the `/api/`
prefix the request uses, so following it would hit the web page. An empty page
is terminal regardless of what the total claims, so a server reporting more
rows than it hands over cannot spin the walk forever.

Drift is stricter here than on the posts path, on purpose: a missing
`meta.pagination.total` raises rather than returning a short list, because a
truncated roster reads downstream as "you cancelled those" — the worst wrong
answer this feature can give.

`current_user_id()` is marked INFERRED, not characterized: C0 captured
/api/members, not /api/current_user, so it relies only on the JSON:API envelope
this API demonstrably uses elsewhere, and raises drift rather than returning
something plausible if that is wrong.

The fixture is derived from the real capture with every piece of account data
replaced (the raw capture stays gitignored). Six members, each earning its
place: a former patron with a null pledge, an active patron with no tier, an
annual cadence, a previous_pledge whose included resource has no
`relationships` key at all, and a reward priced in CAD beside a USD charge —
the trap that makes reading `reward.amount_cents` report a number the operator
was never charged. A leak check caught a free-membership-subscription id and
six real campaign launch timestamps before any of it was staged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNXXULQDjVZmbuNa2G9mD9
2026-09-10 22:26:01 -04:00

724 lines
19 KiB
JSON

{
"data": [
{
"id": "00000000-0000-4000-8000-000000000000",
"type": "member",
"attributes": {
"access_expires_at": "2026-01-02T00:00:00.000+00:00",
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": true,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "former_patron",
"pledge_amount_cents": null,
"pledge_cadence": 1
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000001",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700001",
"type": "pledge"
}
},
"previous_pledge": {
"data": null
},
"reward": {
"data": {
"id": "90001",
"type": "reward"
}
}
}
},
{
"id": "00000000-0000-4000-8000-000000000001",
"type": "member",
"attributes": {
"access_expires_at": null,
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": false,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "active_patron",
"pledge_amount_cents": 1000,
"pledge_cadence": 1
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000002",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700002",
"type": "pledge"
}
},
"previous_pledge": {
"data": null
},
"reward": {
"data": null
}
}
},
{
"id": "00000000-0000-4000-8000-000000000002",
"type": "member",
"attributes": {
"access_expires_at": null,
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": false,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "active_patron",
"pledge_amount_cents": 1500,
"pledge_cadence": 12
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000003",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700003",
"type": "pledge"
}
},
"previous_pledge": {
"data": {
"id": "700004",
"type": "pledge"
}
},
"reward": {
"data": {
"id": "90002",
"type": "reward"
}
}
}
},
{
"id": "00000000-0000-4000-8000-000000000003",
"type": "member",
"attributes": {
"access_expires_at": null,
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": false,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "active_patron",
"pledge_amount_cents": 2000,
"pledge_cadence": 1
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000004",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700005",
"type": "pledge"
}
},
"previous_pledge": {
"data": {
"id": "700006",
"type": "pledge"
}
},
"reward": {
"data": {
"id": "90003",
"type": "reward"
}
}
}
},
{
"id": "00000000-0000-4000-8000-000000000004",
"type": "member",
"attributes": {
"access_expires_at": null,
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": false,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "active_patron",
"pledge_amount_cents": 2500,
"pledge_cadence": 1
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000005",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700007",
"type": "pledge"
}
},
"previous_pledge": {
"data": null
},
"reward": {
"data": {
"id": "90004",
"type": "reward"
}
}
}
},
{
"id": "00000000-0000-4000-8000-000000000005",
"type": "member",
"attributes": {
"access_expires_at": null,
"currency": "USD",
"gift_paid_conversion_reward_cadence": null,
"grant_type": null,
"is_free_member": false,
"is_gifted": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00",
"patron_status": "active_patron",
"pledge_amount_cents": 3000,
"pledge_cadence": 1
},
"relationships": {
"address": {
"data": null
},
"billing_subscription_scheduled_event": {
"data": null
},
"campaign": {
"data": {
"id": "1000006",
"type": "campaign"
}
},
"gift_paid_conversion_payment_method": {
"data": null
},
"latest_pledge": {
"data": {
"id": "700008",
"type": "pledge"
}
},
"previous_pledge": {
"data": null
},
"reward": {
"data": {
"id": "90005",
"type": "reward"
}
}
}
}
],
"included": [
{
"id": "1000001",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": false,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator One",
"owner_id": 5000000,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-one",
"published_at": "2020-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-one",
"url_for_current_user": "https://www.patreon.com/cw/creator-one",
"vanity": "creator-one"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": {
"id": "80000000",
"type": "free-membership-subscription"
}
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "1000002",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": false,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator Two",
"owner_id": 5000001,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-two",
"published_at": "2021-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-two",
"url_for_current_user": "https://www.patreon.com/c/creator-two",
"vanity": "creator-two"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": null
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "1000003",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": true,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator Three",
"owner_id": 5000002,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-three",
"published_at": "2022-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-three",
"url_for_current_user": "https://www.patreon.com/c/creator-three",
"vanity": "creator-three"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": null
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "1000004",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": true,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator Four",
"owner_id": 5000003,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-four",
"published_at": "2023-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-four",
"url_for_current_user": "https://www.patreon.com/cw/creator-four",
"vanity": "creator-four"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": null
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "1000005",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": true,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator Five",
"owner_id": 5000004,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-five",
"published_at": "2024-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-five",
"url_for_current_user": "https://www.patreon.com/c/creator-five",
"vanity": "creator-five"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": null
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "1000006",
"type": "campaign",
"attributes": {
"annual_pledging_enabled": false,
"avatar_photo_url": "https://example.invalid/avatar.jpg",
"cover_photo_url": "https://example.invalid/cover.jpg",
"is_active": true,
"is_monthly": true,
"is_non_profit": false,
"name": "Creator Six",
"owner_id": 5000005,
"pay_per_name": "month",
"pledge_url": "https://www.patreon.com/checkout/creator-six",
"published_at": "2025-01-01T00:00:00.000+00:00",
"url": "https://www.patreon.com/creator-six",
"url_for_current_user": "https://www.patreon.com/cw/creator-six",
"vanity": "creator-six"
},
"relationships": {
"current_user_free_membership_subscription": {
"data": null
},
"current_user_gift": {
"data": null
},
"rewards": {
"data": [
{
"id": "-1",
"type": "reward"
}
]
}
}
},
{
"id": "90001",
"type": "reward",
"attributes": {
"amount_cents": 0,
"currency": "EUR",
"description": "<p>Tier benefits.</p>",
"image_url": null,
"patron_amount_cents": 100,
"requires_shipping": false,
"title": "Tier A",
"unpublished_at": null
}
},
{
"id": "90002",
"type": "reward",
"attributes": {
"amount_cents": 499,
"currency": "USD",
"description": "<p>Tier benefits.</p>",
"image_url": "https://example.invalid/reward.png",
"patron_amount_cents": 499,
"requires_shipping": false,
"title": "Tier B",
"unpublished_at": null
}
},
{
"id": "90003",
"type": "reward",
"attributes": {
"amount_cents": 400,
"currency": "USD",
"description": "<p>Tier benefits.</p>",
"image_url": "https://example.invalid/reward.png",
"patron_amount_cents": 400,
"requires_shipping": false,
"title": "Tier C",
"unpublished_at": null
}
},
{
"id": "90004",
"type": "reward",
"attributes": {
"amount_cents": 570,
"currency": "CAD",
"description": "<p>Tier benefits.</p>",
"image_url": "https://example.invalid/reward.png",
"patron_amount_cents": 450,
"requires_shipping": false,
"title": "Tier D",
"unpublished_at": null
}
},
{
"id": "90005",
"type": "reward",
"attributes": {
"amount_cents": 1000,
"currency": "USD",
"description": "<p>Tier benefits.</p>",
"image_url": "https://example.invalid/reward.png",
"patron_amount_cents": 1000,
"requires_shipping": false,
"title": "Tier E",
"unpublished_at": null
}
},
{
"id": "700001",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "700002",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "700003",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 12,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "700004",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 12,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
}
},
{
"id": "700005",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "700006",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
}
},
{
"id": "700007",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "700008",
"type": "pledge",
"attributes": {
"amount_cents": 500,
"cadence": 1,
"currency": "USD",
"is_apple_iap_subscription": false,
"is_grandfathered": false,
"next_charge_date": "2026-12-15T00:00:00.000+00:00"
},
"relationships": {}
},
{
"id": "-1",
"type": "reward",
"attributes": {
"amount": 0,
"amount_cents": 0,
"description": "Everyone",
"user_limit": null,
"remaining": 0,
"requires_shipping": false,
"created_at": null,
"url": null,
"patron_currency": "USD"
}
},
{
"id": "00000000-0000-4000-8000-ffffffffffff",
"type": "card",
"attributes": {
"card_type": "PayPal",
"expiration_date": null,
"merchant_name": "billing@example.invalid",
"number": null
}
}
],
"links": {
"first": "https://www.patreon.com/members?page%5Boffset%5D=0"
},
"meta": {
"count": 6,
"sort": "-pledge_relationship_start",
"pagination": {
"total": 6
}
}
}