Tiers (Marty 2026-11-02, every game must fund itself): guests earn nothing (a guest's chapters, drips and best follow them at sign-in, the POL does not; no more collected= payout on /auth), a free InstantAdPay account earns freeSharePct (25, admin) of the chapter drip with the note "Game Pass holders earn the full amount.", Game Pass holders earn the full drip plus the shield perk, GAMEPASS off = everyone full. /api/me carries tier, freeSharePct and yourDrip; landing, lobby, clear card, tester briefing and share preview say play free, sign in to earn a taste, Game Pass for the full table. Tests: guest 0 at sign-in, free 25%, pass 100%, gp off full, settings key.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-02 17:01:10 -06:00
parent 4d8dde2ad2
commit b69086aaac
11 changed files with 92 additions and 55 deletions
+7 -4
View File
@@ -39,6 +39,8 @@ const spawnLib = require('../lib/spawn');
const tok0 = sso.mint({ memberId: 42, email: 'runner@example.com', wallet: '0x' + 'ab'.repeat(20), username: 'runner42' });
const denied = await call('/auth?t=' + tok0); eq(denied.status, 403, 'a member not on the tester list is refused');
const st = await admin('/api/admin/settings', { testers: ['runner@example.com'], thresholdPol: 0.02, dripPol: 0.01 }); eq(st.body.settings.testers, ['runner@example.com'], 'admin adds a tester');
eq((await admin('/api/admin/state')).body.settings.freeSharePct, 25, 'freeSharePct defaults to 25');
eq((await admin('/api/admin/settings', { freeSharePct: 40 })).body.settings.freeSharePct, 40, 'admin saves freeSharePct'); await admin('/api/admin/settings', { freeSharePct: 25 });
const tok = sso.mint({ memberId: 42, email: 'runner@example.com', wallet: '0x' + 'ab'.repeat(20), username: 'runner42' });
const a = await call('/auth?t=' + tok); eq([a.status, a.headers.get('location')], [302, '/play'], 'a listed member signs in and lands on the game');
eq((await call('/auth?t=' + tok)).status, 400, 'the hand-off token cannot be replayed');
@@ -116,13 +118,14 @@ const spawnLib = require('../lib/spawn');
const ggen = spawnLib.drips(gr.seed, W, H); const gcl = []; let gT = 0; while (gcl.length < 20) { const gg = ggen(); for (const d of gg.drips) if (gcl.length < 20) { gT = spawnLib.arrival(gg.t, d.x0, W, gr.speed) + 0.1; gcl.push({ k: 'd', i: d.i, t: Math.round(gT * 1000) / 1000 }); } }
backdate(gr.runId, gT + 5);
const gev = (await hit('/api/run/events', { method: 'POST', body: JSON.stringify({ runId: gr.runId, t: gT + 0.2, events: gcl, goal: true }) }, g)).body;
eq([gev.cleared.chapter, gev.cleared.pol, gev.cleared.reason], [1, 0, 'guest'], 'a guest clear pays nothing yet (reason guest)');
eq([gev.cleared.chapter, gev.cleared.pol, gev.cleared.reason], [1, 0, 'guest'], 'a guest clear pays nothing (reason guest)');
eq((await hit('/api/me', {}, g)).body.pool.tier, 'guest', '/api/me says tier guest');
eq((await hit('/api/refuel/start', { method: 'POST', body: JSON.stringify({ runId: gr.runId }) }, g)).status, 403, 'a guest cannot refuel before signing in');
// the newcomer joins IAP under runner42 and signs in: the guest run is adopted and the clear pays
// the newcomer joins IAP under runner42 and signs in: the guest run is adopted; the progress follows, the POL does not (2026-11-02)
const tokN = sso.mint({ memberId: 77, email: 'newbie@example.com', wallet: '0x' + 'cd'.repeat(20), username: 'newbie', sponsorRef: 'runner42' });
const au = await hit('/auth?t=' + tokN, {}, g); g = jarAdd(g, au.set);
eq([au.status, au.loc], [302, '/play?collected=1'], 'sign-in adopts the guest and pays the pending clear');
const nme = (await hit('/api/me', {}, g)).body; eq([nme.me.guest, nme.player.chapter, nme.player.bank, nme.balance.unpaid], [false, 2, 20, 0.01], 'progress and the drip followed the newcomer');
eq([au.status, au.loc], [302, '/play?carried=1'], 'sign-in adopts the guest progress and pays nothing for guest clears');
const nme = (await hit('/api/me', {}, g)).body; eq([nme.me.guest, nme.player.chapter, nme.player.bank, nme.balance.unpaid, nme.balance.earnedTotal, nme.pool.tier], [false, 2, 20, 0, 0, 'full'], 'progress followed the newcomer, no POL for the guest clear; GAMEPASS off = full tier');
// the newcomer refuels: runner42 (their IAP sponsor) gets the slice
const nr = (await hit('/api/run/start', { method: 'POST', body: JSON.stringify({ W, H }) }, g)).body;
const nrf = (await hit('/api/refuel/start', { method: 'POST', body: JSON.stringify({ runId: nr.runId }) }, g)).body;