feat(registry): awards ledger, stat totals, session-verified accounts and botmatch results #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/registry-awards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
DodginBalls rewards-admin P5 (plan: unity-core-playground/dodginballs-rewards-admin.md). Registry side of the awards system, deployed before the game posts to it (P6).
0008_rewards.sql:accounts.title,session_accounts,awards(append-only ledger, uniqueidem),stats(running sums per game and*, by tier). All cascade on account delete.POST /api/v1/entitlements/ticket?session=<id>signs the session asaud;POST /api/v1/entitlements/verifywith{ticket, session}and that session's lease records the account against the session. Plain verify is unchanged.POST /api/v1/awards: token plus the session's lease; every account must be verified by the session (else 403). Tier from the token; hosted capped byAWARDS_HOSTED_PER_DAY(default 500) and never unlocks; unlocks only for activekind=rewardcatalog items, granted as an entitlement with sourcereward.seqmakes a retry grant once. 30 posts per session per minute.GET /api/v1/stats/me,GET /api/v1/awards/me?since=<id>.POST /api/v1/resultskind=botmatch: bots as{"id":"bot"}, not stored as players, no Elo; withsessionand its lease, verified humans on the sole winning side get awin.<mode>award.assumed: migration is 0008, not the plan's 0005, because 0005 to 0007 already shipped.
assumed: counts are
[{key, amount}], not a map, because Unity's JsonUtility cannot write maps.assumed: awards and verify-with-session always require the session lease (new routes, no old clients), checked against
server_sessionsso it holds after deregister.assumed: the ticket audience is the session id (the plan's security note), so a host cannot replay a joiner's ticket to another server.
assumed: the hosted cap counts amount per UTC day; over it, counts are clipped and reported as
capped.assumed: botmatch wins live in the ledger and stats as
win.<mode>; ratings stay for ranked matches only.assumed: no title route, admin stat edit, revoke or admin view of stats here (P7, P8).
Checks: gofmt and go vet clean; go test ./... 132 pass / 0 fail against real Postgres and MinIO (6 new: verified awards and unlocks, hosted cap without unlocks, lease and verification refusals, botmatch wins without ratings, hosted botmatch cap, account delete takes awards). Forgejo has no PR CI for this repo; that local run is the gate.
Not deployed: needs a registry-v* tag and the home-config image bump (human-only), plus ENTITLEMENT_SECRET on the deployed registry.
https://claude.ai/code/session_01AWkPstXg5XSSwLrRRmfZJx
Migration 0008_rewards: accounts.title, session_accounts, awards, stats. POST /api/v1/awards (token + session lease), GET /api/v1/stats/me, GET /api/v1/awards/me. Tickets carry an optional session audience; verify with {ticket, session} records the account. POST /api/v1/results takes kind=botmatch: no Elo, win.<mode> awards to verified winners. Claude-Session: https://claude.ai/code/session_01AWkPstXg5XSSwLrRRmfZJx