caelum0x 40a1b99115 feat(rago): portfolio add-on grants seed and the grant debit contract for Menivor and Rally (PY2.4)
Dispatch contract 5.4, Railyard side:
- apps/rago/seeds/portfolio/grants.json: the portfolio grants org, one count
  meter per grant (launch reel, mail) under a $0 monthly plan whose package
  charges hold the grant as free units (1 reel, 500 mails, from Scribase
  plans.json), so Rago's current usage is the monthly balance.
- tests/contract/fixtures/grants/contract.json: the grant claims on the
  partner token (grant, grant_period), the debit transaction id
  <aud>:grant:<org>:<YYYY-MM>:<n>, the grants subscription id, sample debits
  and the plain refusal with the upgrade path. Menivor PM1.5 and Rally PR3.1
  test against it; the Scribase carve-out copies it byte for byte.

Tests: grants contract 3/3 (the allowances match Scribase plans.json on disk).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 01:35:31 +03:00

38 lines
2.0 KiB
JSON

{
"contract": "portfolio-grants",
"version": 1,
"package": "Wave P PY2.4 (dispatch contract 5.4)",
"note": "Scribase issues one partner token per grant and add-on month (Ed25519, the Wave E 5.1 partner-token keys and JWKS) with two extra claims, grant and grant_period. The partner verifies the token, then debits the grant in the portfolio Rago org with one event per use; a debit beyond the balance is refused with the plain message below and the upgrade path. Menivor PM1.5 and Rally PR3.1 test against this file.",
"grants": [
{
"grant": "addon-monthly-reel",
"aud": "menivor",
"cap": "launch-video",
"meter": "portfolio.grant.launch_reel",
"allowance_plan_key": "menivor_launch_reel",
"allowance": 1
},
{
"grant": "addon-mail",
"aud": "rally",
"cap": "mail",
"meter": "portfolio.grant.mail",
"allowance_plan_key": "rally_mail",
"allowance": 500
}
],
"token_claims": ["aud", "cap", "exp", "grant", "grant_period", "iat", "iss", "jti", "org", "sub"],
"grant_period_pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
"transaction_id_pattern": "^(menivor|rally):grant:[A-Za-z0-9_-]{1,128}:\\d{4}-(0[1-9]|1[0-2]):[1-9]\\d{0,6}$",
"external_subscription_id": "portfolio-grants-<org>",
"sample_debits": [
{ "transaction_id": "menivor:grant:org_fixture:2026-09:1", "external_customer_id": "org_fixture", "external_subscription_id": "portfolio-grants-org_fixture", "code": "portfolio.grant.launch_reel", "timestamp": 1790683200, "properties": {} },
{ "transaction_id": "rally:grant:org_fixture:2026-09:1", "external_customer_id": "org_fixture", "external_subscription_id": "portfolio-grants-org_fixture", "code": "portfolio.grant.mail", "timestamp": 1790683200, "properties": {} }
],
"refusal": {
"status": 402,
"message": "This month's included {what} is used up. It renews on {renews}. For more now, upgrade in Scribase under Billing, Add-ons.",
"upgrade_path": "/orgs/{org}/billing/addons"
}
}