Holding-tank readiness on the tank cards (Marty 2026-11-18, warm-up stage 1, no email)

Each waiting lead on My line > Holding tank and Admin > Members tank card now shows how they got into the tank, a stage chip (New / Warming / Engaged / Activated / Ready, real actions only), the network heat score 0-100 with its band, and their last real action. Computed on the network hub (POST /v1/tank/readiness); tankready.js sends this site's facts (own last sign-in, wallet, entry reason from the adoption records and join data; sponsor usernames, never emails) and caches the answer. Tank list sorts hottest first by default (grace and ready-to-activate grouping unchanged), new Heat sort and "Warm or hot" filter on the tank only. Hub down = the card exactly as before. No mail, no Telegram, no sponsor moves; adoption rules, caps and the v2 batch untouched. qa/tank-readiness.test.mjs (against a local hub) added to member + tankhold. tankready.js?v=20261118rd, my.js / admin.js / site.css ?v=20261118rd. iap-qa member ALL PASSED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-18 19:01:46 -06:00
parent e57efd9e7c
commit 52f0a5496b
10 changed files with 304 additions and 12 deletions
+7 -2
View File
@@ -36,6 +36,7 @@ const kb = require('./kb'); // the assistant's knowledge base:
const fraud = require('./fraud');
const coach = require('./coach'); // coaching view, nudges, digest, prospects, link stats
const tank = require('./tank');
const tankready = require('./tankready'); // holding-tank readiness from the network hub (2026-11-18): entry reason, stage, heat, last action on the tank cards. No mail.
const walletnudge = require('./walletnudge');
const milestone = require('./milestone'); // players with POL waiting in the games and no wallet (2026-10-07) // holding tank: unsponsored free members, adoptions, pay-it-forward
const legacy = require('./legacy'); // Faucet Wave / Tier One Ads bridge: welcome-back credits for listed emails
@@ -743,6 +744,7 @@ async function boot() {
sponsorAccount: em => accounts.byEmail(em),
wouldCycle: async (email, sp) => { let cur = sp; const seen = new Set(); for (let i = 0; cur && i < 60; i++) { if (cur.email === email || seen.has(cur.email)) return true; seen.add(cur.email); cur = await accounts.sponsorOf(cur.email); } return false; },
activationOf: a => a.address ? activationByAddress().get(String(a.address).toLowerCase()) || null : null });
tankready.init({ site: 'iap', accounts, tank, followGet: e => followStore.get(e) }); // read-only: sends this site's facts, keeps the hub's answer for the tank cards
tank.init({ capOpen: () => siteConfig().tankAdoptCap, dataDir: DATA_DIR, chain, accounts, messages, mailer, ads, site: 'https://instantadpay.com', follow, store: followStore,
// activation hold + 24-hour safety net (2026-10-27): a tank member is never bound under the fallback position
// network hub rule 3 (2026-11-14, only with HUB_ENABLED): the hub's sponsor comes first for alignment, and nobody it reports
@@ -1696,6 +1698,7 @@ async function tankAdminAlert(text) {
// who linked a wallet, run the safety net, and tell the shared payments topic once per member who became ready
async function tankReadyTick() {
const r = await tank.readyTick();
tankready.refresh().catch(() => {}); // readiness: send the hub this site's entry facts and refresh the card cache (no mail, no sponsor change)
if (r.aligned || r.assigned.length || r.held || r.fresh.length || (r.reminders || []).length) console.log('tank ready tick', JSON.stringify({ fresh: r.fresh.length, aligned: r.aligned, assigned: r.assigned.length, held: r.held, payReminders: (r.reminders || []).map(x => x.stage) }));
const sc = siteConfig();
if (!r.fresh.length || !sc.telegramBotToken || !sc.telegramEchoChatId) return r;
@@ -3627,7 +3630,8 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/my/tank' && req.method === 'GET') {
const s = await auth.fromRequest(req);
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
return json(res, 200, await tank.view(s.email));
const v = await tank.view(s.email); v.waiting = await tankready.attach(v.waiting); // readiness (hub): entry, stage, heat, last action
return json(res, 200, v);
}
// -- achievement badge -> Telegram (payments topic + the main group), once per badge per member.
// The browser composes the personalised image (canvas, same as Share) and posts it here.
@@ -3927,7 +3931,8 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/admin/tank/batches' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, await tankbatch.adminView()); }
if (p === '/api/admin/tank' && req.method === 'GET') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
return json(res, 200, await tank.adminView());
const v = await tank.adminView(); v.waiting = await tankready.attach(v.waiting); v.readiness = Object.assign(tankready.status(), { counts: tankready.counts() });
return json(res, 200, v);
}
// an adoption made for a member (Marty 2026-11-14: sponsors who lost people when the contract sponsor won get a few from the
// tank). The same tank.adopt as the member's own button: their eligibility and cap, the adoptee's email and chat. No payments-topic