# sources

content_hash: f8d4a7e96c15c90c898412479e7dca8015e3950182c100aa5fbc1361e91384a9
indexed_at: 2026-08-04 01:17:30
label:
  cmd:pnpm vitest run src/routes/plans.test.ts src/routes/subscribe.test.ts src/routes/webhooks.test.ts src/routes/account.test.ts src/routes/staff.test.ts


content_hash: a9d831b07f6b2a89fdfd889cd51275ecf6e9b310bcbea79a604e6336d6b33914
indexed_at: 2026-08-04 01:25:28
label:
  cmd:pnpm vitest run src/routes/plans.test.ts src/routes/subscribe.test.ts src/routes/webhooks.test.ts src/routes/account.test.ts src/routes/staff.test.ts tests/integration/subscribe.test.ts


# chunks_content

c3: command
c5: 2026-08-04T01:17:30.171345743+00:00
c0:
  pnpm vitest run src/routes/plans.test.ts src/routes/subscribe.test.ts src/routes/webhooks.test.ts src/routes/account.test.ts src/routes/staff.test.ts

c1:
   RUN  v3.2.7 /home/user/builds/cap07-plans-b0b6527c4420/backend/api
   ✓ src/routes/subscribe.test.ts (8 tests) 12867ms
     ✓ subscribeAccount > persists only a pending PayPal subscription until verified settlement  2202ms
     ✓ subscribeAccount > is idempotent for a repeated request on the same account and package  1444ms
     ✓ subscribeAccount > refuses inactive packages before contacting PayPal  1655ms
     ✓ subscribeAccount > fails closed without local records when PayPal is unavailable  1456ms
     ✓ subscribeAccount > rejects invalid PayPal facts without persisting them  1335ms
     ✓ subscribeAccount > rejects a suspended account before contacting PayPal  1498ms
     ✓ createSubscribeRoute > rejects caller-supplied account scope and malformed catalog keys  1452ms
     ✓ createSubscribeRoute > returns authenticated pollable checkout status without provider input  1820ms
   ✓ src/routes/account.test.ts (6 tests) 8434ms
     ✓ account route > lists only the authenticated account dashboard data  1693ms
     ✓ account route > reads the active catalog from persisted subscription packages  1614ms
     ✓ account route > returns 403 when a caller requests another account dashboard  1343ms
     ✓ account route > updates a member role through the tenancy path  1301ms
     ✓ account route > forbids assigning STAFF-equivalent roles to caller or member  1240ms
     ✓ account route > canonicalizes ASCII role keys and rejects non-canonical role-key grammar  1242ms
   ✓ src/routes/webhooks.test.ts (7 tests) 10461ms
     ✓ createWebhookRoute > rejects a settlement amount mismatch before any financial effect  1268ms
     ✓ createWebhookRoute > rejects a settlement key-component mismatch before any financial effect  1314ms
     ✓ createWebhookRoute > rejects a settlement currency mismatch before any financial effect  1449ms
     ✓ createWebhookRoute > seeds the next-period wallet once for a redelivered chargeKey even when PayPal event ids differ  1685ms
     ✓ createWebhookRoute > resumes a stale settlement claim with its captured facts and without refilling spent credits  1604ms
     ✓ createWebhookRoute > persists an unmatched refund webhook as unreconciled without financial effects  1437ms
     ✓ createWebhookRoute > forwards a refund fact mismatch to durable reservation confirmation for flagging  1703ms
   ✓ src/routes/plans.test.ts (5 tests) 6984ms
     ✓ subscription package catalog persistence > stores every plugin in one catalog and writes staff audit events in the mutation transaction  2117ms
     ✓ subscription package catalog persistence > rolls back package changes when the audit insert fails  2282ms
     ✓ subscription package catalog persistence > archives without deleting subscription history and removes the package from customer reads  2579ms
   ✓ src/routes/staff.test.ts (26 tests) 94ms
   Test Files  5 passed (5)
        Tests  52 passed (52)
     Start at  04:16:49
     Duration  40.49s (transform 452ms, setup 0ms, collect 1.20s, tests 38.84s, environment 0ms, prepare 69ms)


c3: command
c5: 2026-08-04T01:25:28.742477170+00:00
c0:
  pnpm vitest run src/routes/plans.test.ts src/routes/subscribe.test.ts src/routes/webhooks.test.ts src/routes/account.test.ts src/routes/staff.test.ts tests/integration/subscribe.test.ts

c1:
   RUN  v3.2.7 /home/user/builds/cap07-plans-b0b6527c4420/backend/api
   ✓ tests/integration/subscribe.test.ts (1 test) 2047ms
     ✓ HTTP integration: subscribe flow > creates only a pending checkout via the mounted app path  2045ms
   ✓ src/routes/subscribe.test.ts (8 tests) 11899ms
     ✓ subscribeAccount > persists only a pending PayPal subscription until verified settlement  1428ms
     ✓ subscribeAccount > is idempotent for a repeated request on the same account and package  1202ms
     ✓ subscribeAccount > refuses inactive packages before contacting PayPal  1463ms
     ✓ subscribeAccount > fails closed without local records when PayPal is unavailable  1547ms
     ✓ subscribeAccount > rejects invalid PayPal facts without persisting them  1572ms
     ✓ subscribeAccount > rejects a suspended account before contacting PayPal  1539ms
     ✓ createSubscribeRoute > rejects caller-supplied account scope and malformed catalog keys  1595ms
     ✓ createSubscribeRoute > returns authenticated pollable checkout status without provider input  1549ms
   ✓ src/routes/webhooks.test.ts (7 tests) 8828ms
     ✓ createWebhookRoute > rejects a settlement amount mismatch before any financial effect  1567ms
     ✓ createWebhookRoute > rejects a settlement key-component mismatch before any financial effect  1141ms
     ✓ createWebhookRoute > rejects a settlement currency mismatch before any financial effect  1186ms
     ✓ createWebhookRoute > seeds the next-period wallet once for a redelivered chargeKey even when PayPal event ids differ  1210ms
     ✓ createWebhookRoute > resumes a stale settlement claim with its captured facts and without refilling spent credits  1182ms
     ✓ createWebhookRoute > persists an unmatched refund webhook as unreconciled without financial effects  1247ms
     ✓ createWebhookRoute > forwards a refund fact mismatch to durable reservation confirmation for flagging  1293ms
   ✓ src/routes/account.test.ts (6 tests) 7543ms
     ✓ account route > lists only the authenticated account dashboard data  1206ms
     ✓ account route > reads the active catalog from persisted subscription packages  1248ms
     ✓ account route > returns 403 when a caller requests another account dashboard  1195ms
     ✓ account route > updates a member role through the tenancy path  1234ms
     ✓ account route > forbids assigning STAFF-equivalent roles to caller or member  1278ms
     ✓ account route > canonicalizes ASCII role keys and rejects non-canonical role-key grammar  1380ms
   ✓ src/routes/plans.test.ts (5 tests) 3545ms
     ✓ subscription package catalog persistence > stores every plugin in one catalog and writes staff audit events in the mutation transaction  1159ms
     ✓ subscription package catalog persistence > rolls back package changes when the audit insert fails  1178ms
     ✓ subscription package catalog persistence > archives without deleting subscription history and removes the package from customer reads  1202ms
   ✓ src/routes/staff.test.ts (26 tests) 40ms
   Test Files  6 passed (6)
        Tests  53 passed (53)
     Start at  04:24:53
     Duration  35.20s (transform 364ms, setup 0ms, collect 1.01s, tests 33.90s, environment 0ms, prepare 55ms)


c0: pnpm test
c3: command
c5: 2026-08-04T01:37:07.266067262+00:00
c1:
  > @press-zone/api@0.0.4 test /home/user/builds/cap07-plans-b0b6527c4420/backend/api
  > vitest run
   RUN  v3.2.7 /home/user/builds/cap07-plans-b0b6527c4420/backend/api
   ✓ tests/integration/webhook-idempotency.test.ts (1 test) 1991ms
     ✓ HTTP integration: webhook idempotency flow > turns a double-delivered settlement into one wallet seed, one invoice, and one ledger entry  1989ms
   ✓ src/routes/plugin.test.ts (43 tests) 53430ms
     ✓ createPluginRoute > debits credits once and returns downstream data on the happy path  1197ms
     ✓ createPluginRoute > returns 402 without recording a debit when credits are insufficient  1179ms
     ✓ createPluginRoute > retains a charged intent as pending when downstream execution is uncertain  1243ms
     ✓ createPluginRoute > never expires a charged pending intent into another debit or execution  1601ms
     ✓ createPluginRoute > binds the account before access runs and never debits when access blocks the request  1569ms
     ✓ createPluginRoute > requires a client idempotency key before charging or executing  1607ms
     ✓ createPluginRoute > rejects an oversized client idempotency key before charging or executing  1561ms
     ✓ createPluginRoute > rejects an oversized request body before charging or executing  1364ms
     ✓ createPluginRoute > replays a persisted result without another debit or execution  1192ms
     ✓ createPluginRoute > replays the same request when its host changes between retries  1188ms
     ✓ createPluginRoute > scopes a reused client key to its billing period  1277ms
     ✓ createPluginRoute > rejects reusing an idempotency key for a different request payload  1711ms
     ✓ createPluginRoute > replays a persisted BigInt result with the same JSON response  1498ms
     ✓ createPluginRoute > reconciles an uncertain result without executing downstream work again  1427ms
     ✓ createPluginRoute > keeps a pending intent when reconciliation returns a different request hash  1343ms
     ✓ createPluginRoute > replays one persisted reconciliation result when retries race  1383ms
     ✓ createPluginRoute > does not let a late execution writer overwrite a reconciled result  1374ms
     ✓ createPluginRoute > replays reconciliation when late execution becomes uncertain after settlement  1305ms
     ✓ createPluginRoute > exposes the requireAuth -> bindAccount -> requirePluginAccess guard chain for mounting  999ms
     ✓ createPluginRoute > returns deterministic local-fallback-compatible estimates without metering side effects  1026ms
     ✓ createPluginRoute > matches PHP strip_tags character counting for quoted markup, comments, malformed tags, entities, and Unicode  1064ms
     ✓ createPluginRoute > matches executable PHP strip_tags fixtures including malformed declarations  1431ms
     ✓ createPluginRoute > rejects malformed UTF-8 before JSON parsing without meter or execution side effects  1357ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: application/json; charset=utf-8  1429ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: Application/Json; Charset="utf-8"  1443ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: undefined  1545ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: text/plain  1294ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: application/json; charset=  1120ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: application/json; charset="unterminated  1049ms
     ✓ createPluginRoute > validates estimate JSON media type before consuming body: application/json trailing  986ms
     ✓ createPluginRoute > counts Unicode code points for the content limit  997ms
     ✓ createPluginRoute > rejects malformed JSON without meter or execution side effects  996ms
     ✓ createPluginRoute > rejects empty content without meter or execution side effects  1020ms
     ✓ createPluginRoute > rejects oversized content without meter or execution side e
  [truncated]


c0: pnpm build
c3: command
c5: 2026-08-04T01:37:11.234642279+00:00
c1:
  > @press-zone/api@0.0.4 build /home/user/builds/cap07-plans-b0b6527c4420/backend/api
  > rm -rf dist && tsc -p tsconfig.json --outDir dist


