The Draft on the real holding tank (2026-11-15, LOCAL ONLY): tankpool.js 'iap' mode = signed client for InstantAdPay's draft partner routes
TANK_MODE=iap (or hub) + IAP_URL + DRAFT_PARTNER_SECRET: pool / adopt / release / status as HMAC-signed POSTs ('draft.v1.' + ts +
newline + body, X-Draft-Ts / X-Draft-Sig). The stub stays the default and keeps every existing test. adopt carries the coach claim
(wallet, hubId, username, positions = store.positionsOf) and a request id; one retry with the same rid on a network failure, so a
retry never makes two adoptions. release sends why 'coach' | 'return' + the pick's iap ref and takes InstantAdPay's outcome
(returned / kept / done). league.sweep follows a pick InstantAdPay closed first (its own 3-day sweep, a release there, a LinkSpin
follow). Surfing arrives as ad credits (surfCredits, shown "N ad credits" to coaches, +10 scouting like surf POL); games stay
"not tracked yet" (InstantAdPay has no per-member game record).
Fix found by the cross test: a tank refusal about the COACH (no InstantAdPay account, full, not vested, hub off) used to mark the
person unavailable and let the same coach choose again, which would burn the whole pool; now the slot passes (skip 'tank: <code>')
and a silent tank pauses the draft (nothing recorded, the next tick retries the same slot). Manual picks record nothing on either.
Tests: unit 62/62 (2 new: skip + wait), smoke 156/156 (ports 3561-3564), qa/iap-tank.test.cjs 23/23 (this client + league against
InstantAdPay's REAL draftpartner.js + tank.js from the sibling checkout behind a signed server on 3565, then a dead port 3566).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,7 @@ function score(c, now) {
|
||||
if (c.games && Number(c.games.plays) > 0) s += Math.min(40, Number(c.games.plays));
|
||||
const seen = Number(c.lastSeen) || 0;
|
||||
if (seen) { const age = now - seen; s += age < DAY ? 25 : age < 3 * DAY ? 12 : age < 7 * DAY ? 5 : 0; }
|
||||
if (c.surfWei && BigInt(c.surfWei) > 0n) s += 10;
|
||||
if ((c.surfWei && BigInt(c.surfWei) > 0n) || Number(c.surfCredits) > 0) s += 10; // InstantAdPay reports surfing as ad credits earned
|
||||
if (c.games && c.games.earnedWei && BigInt(c.games.earnedWei) > 0n) s += 10;
|
||||
return s;
|
||||
}
|
||||
@@ -118,6 +118,7 @@ function manual(d, coach, person, ctx, now) {
|
||||
function record(d, act, res, now) {
|
||||
if (act.type === 'skip') { d.made.push({ slot: slotLabel(act.slot), round: act.slot.round, n: act.slot.n, coach: act.slot.coach, skipped: act.why, at: now }); d.clockAt = now; }
|
||||
else if (res && res.ok) { d.made.push({ slot: slotLabel(act.slot), round: act.slot.round, n: act.slot.n, coach: act.coach, person: act.person, auto: act.type === 'auto', fromQueue: !!act.fromQueue, pickId: res.pickId || null, at: now }); d.taken.push(act.person); d.clockAt = now; }
|
||||
else if (res && res.skip) { d.made.push({ slot: slotLabel(act.slot), round: act.slot.round, n: act.slot.n, coach: act.coach, skipped: res.skip, at: now }); d.clockAt = now; } // the tank refused the COACH (no account there, full, ...): the slot passes, nobody is burned
|
||||
else { d.unavailable.push(act.person); } // the tank refused this person (locked a moment ago, adopted elsewhere): the same coach chooses again
|
||||
return d;
|
||||
}
|
||||
@@ -130,6 +131,7 @@ async function run(d, ctx, adopt, now, maxSteps) {
|
||||
if (a.type === 'done') { if (d.status === 'live') finish(d, a.why, now); return d; }
|
||||
if (a.type === 'skip') { record(d, a, null, now); continue; }
|
||||
const res = await adopt(a);
|
||||
if (res && res.wait) return d; // the tank did not answer: nothing recorded, the next tick tries the same slot again
|
||||
record(d, a, res, now);
|
||||
}
|
||||
return d;
|
||||
|
||||
Reference in New Issue
Block a user