Skip to content

Credit codes and invites: days of the x402 pass - #34

Merged
ralyodio merged 1 commit into
mainfrom
feat/credit-codes-invites
Oct 26, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/credit-codes-invites

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Fleet rollout of @profullstack/redeem-credits 0.2.0 + @profullstack/affiliates 0.3.0 (ROLLOUT batch 5).

What a code grants: unit pass_days. Through the existing pass path: a $0 crawl_sales row owned by the account (new user_id/source columns), ref grant:code:<id>:<user> (unique, so a retried grant is one term), stacked after any running term. While it runs, accessFor serves the account as pass on the session, every API key, the CLI and MCP; /settings shows the signed cp_ bearer token for the same term (minted with the gateway's secret, checked with gateway.verifyPass). crawlSalesSummary counts sold passes only.

Invites: 3 per account, 30-day expiry, from accounts at least 7 days old. Accepted only when spending the emailed link creates the account (proves the mailbox); the code rides on login_tokens.invite_code as well as the r4k_invite cookie. Both sides get 7 pass days, decided once per side in invite_bonuses; withheld for same mailbox (+tag, Gmail dots), throwaway domains, same network as the invite's creation (salted IP hash), or an inviter at 10 bonuses in 30 days. One accepted invite per account (affiliates 0.3 unique index).

Affiliate links: /?ref=<code> sets referral_code; first-touch attribution of new accounts. r4ck had no referral programme, so nothing counts twice. No commission is paid (nothing to pay it from yet).

Surfaces: /settings (Have a code?, pass panel, admin mint/revoke), /account/invites (+ /invites redirect), /i/<code> (in OPEN_PATHS, noindex), API /api/v1/credits/redeem, /api/v1/pass, /api/v1/invites, /api/v1/admin/credits; MCP redeem_code, list_invites, create_invite; CLI 0.2.0 redeem, pass, invites; scripts/credit-codes.js. Links are built from the request host.

Migration 0003 runs on boot. It holds the packages' own DDL plus the r4ck columns and tables. I dry-ran it against prod in a rolled-back transaction. Backup: ~/backups/r4ck/pre-0003-20261026T183357Z.dump.

Supabase check: not applicable. r4ck runs on plain Postgres with no PostgREST or public key, and every write goes through server routes.

Tests: test/credits.test.js (8, real Postgres). Full suite 99 pass, 1 fail. The failure is syncTick timing out at 5 s, and it fails the same way on main.

🤖 Generated with Claude Code

A credit code (@profullstack/redeem-credits 0.2.0) grants pass_days; an
invite (@profullstack/affiliates 0.3.0) gives both sides 7 days of the pass
when a new account is made from the emailed link. Both go through the
existing pass path: a $0 crawl_sales row owned by the account, idempotent on
its ref. While it runs, accessFor serves the account as a pass on the
session, its API keys, the CLI and MCP, and /settings shows the signed cp_
bearer token for it.

- /settings: "Have a code?" + pass panel; admin mint/revoke panel
- /account/invites (3 per account, from 7 days old), /i/<code> landing,
  invite carried on login_tokens.invite_code so another browser counts
- bonus withheld for same mailbox (+tag, gmail dots), throwaway domains,
  same network as the invite's creation, inviter cap 10/30 days
- ?ref= affiliate links: first-touch attribution of new accounts
- API /api/v1/credits/redeem, /pass, /invites, /admin/credits; MCP
  redeem_code, list_invites, create_invite; CLI 0.2.0 redeem, pass, invites
- scripts/credit-codes.js for minting on the box
- migration 0003 (package DDL + crawl_sales.user_id/source, invite tables)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​profullstack/​redeem-credits@​0.2.07610010090100
Added@​profullstack/​affiliates@​0.3.07610010092100

View full report

@ralyodio
ralyodio merged commit dde6c74 into main Oct 26, 2026
3 checks passed
@ralyodio
ralyodio deleted the feat/credit-codes-invites branch October 26, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant