From 7f57aedcb6d233dcef042cd10529df0f5ca5dabb Mon Sep 17 00:00:00 2001 From: martbost Date: Sun, 15 Nov 2026 07:20:13 -0600 Subject: [PATCH] hubsync: ask the hub for ids on /v1/locked (hub id + first door per row) and expose hubInfo(email) / resolvePerson(q) for the 5xYourTeam draft pool Read-only. A hub without hub 1e99713 ignores ids: true and the draft pool falls back to opaque i_ ids. hubsync.test 19/19. Co-Authored-By: Claude Opus 5.5 --- hubsync.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hubsync.js b/hubsync.js index f93904a..99a13d3 100644 --- a/hubsync.js +++ b/hubsync.js @@ -311,7 +311,7 @@ async function refreshHeld(emails, timeout) { try { for (let i = 0; i < miss.length; i += HELD_CHUNK) { const part = miss.slice(i, i + HELD_CHUNK); - const r = await hubPost('/v1/locked', { emails: part, detail: true }, timeout || 5000); + const r = await hubPost('/v1/locked', { emails: part, detail: true, ids: true }, timeout || 5000); // ids: hub id + door per row (a hub without it ignores the flag) if (r.status !== 200 || !r.body || !r.body.found || typeof r.body.found !== 'object') throw new Error('hub locked ' + r.status); if (held.size > 60000) held.clear(); const at = Date.now(); for (const e of part) held.set(e, { at, row: r.body.found[e] || null }); @@ -348,9 +348,11 @@ async function hubSponsor(email) { return sp && sp !== e ? { sponsorEmail: sp, via: l !== undefined ? 'network hub, InstantAdPay contract' : 'network hub' } : null; } +// the hub id and first door of a person the tank cache holds (5xYourTeam draft pool, 2026-11-15): { id, door } | null. Read-only, no call. +function hubInfo(email) { const c = held.get(norm(email)); return c && c.row && c.row.id ? { id: c.row.id, door: c.row.door || null } : null; } function adminView() { const s = load(); return Object.assign({ enabled: enabled(), on: on(), site: SITE(), url: URL_(), since: s.since, outbox: s.outbox.length, retrying: Object.keys(s.tries).length, disagree: Object.keys(s.disagree).length, tankCache: held.size, tankHubDownUntil: heldDownUntil || null }, s.stats, { disagreements: Object.entries(s.disagree).slice(-25).map(([email, d]) => Object.assign({ email }, d)), recent: s.log.slice(-25).reverse() }); } -module.exports = { init, enabled, on, receive, touch, wallet, onChain, flush, reconcile, start, adminView, heldAmong, lockedAnywhere, hubSponsor, _sign: sign, _heldReset: () => { held.clear(); heldDownUntil = 0; }, _heldAge: ms => { for (const c of held.values()) c.at -= ms; } }; +module.exports = { init, enabled, on, receive, touch, wallet, onChain, flush, reconcile, start, adminView, heldAmong, lockedAnywhere, hubSponsor, hubInfo, resolvePerson: q => resolve(q), _sign: sign, _heldReset: () => { held.clear(); heldDownUntil = 0; }, _heldAge: ms => { for (const c of held.values()) c.at -= ms; } };