Sponsor follow + one network holding tank + Sponsor check (Marty, 2026-10-22, approved 1-3)

Same design as InstantAdPay (shared sponsorfollow.js). Deliberate sponsor changes (tank adoption, rescue, release,
adoption window ending, admin edit) are recorded and travel on the iapsync rows; InstantAdPay's deliberate changes are
applied here only when the member is not bound or binding on the LinkSpin contract (memberId, wallet on chain, or an
engine activation in flight), newer than our own, and both sides agreed before (or no sponsor here). Bound / diverged /
race cases change nothing and are logged. Ordinary rows keep the fill-empty rule, except a sponsor emptied on purpose
here is not refilled by an ordinary row.

Carry: an InstantAdPay batch holds its members (carry.hold) so no auto-activation starts mid-batch; ensureOnChain waits,
then re-reads the account so the contract binds the settled sponsor; wallets from a batch are linked after every sponsor
decision; the wallet hook skips activation while a follow is pending and activates once it is settled.
Registry keeps the follow record (loop guard) and a deliberate clear. Network tank, Admin > Members > Sponsor check and
the partner endpoints as on InstantAdPay. Rows without the new facts hash as before (no resend on deploy).

Tests: qa/sponsorfollow.test.cjs 27/27, qa/carry-hold.test.cjs ok, two-server e2e (in the InstantAdPay repo) 20/20,
QA member walk 0 bugs. No sponsor was changed on production.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-22 09:05:20 -05:00
parent eedbd7280f
commit a5c2c38106
11 changed files with 889 additions and 33 deletions
+7
View File
@@ -28,6 +28,13 @@ const J = {
if (k === 'firstProperty' && cur.firstProperty) continue; // first contact is history: an InstantAdPay echo of a LinkSpin-first row must not relabel it (2026-10-15)
cur[k] = k === 'wallet' || k === 'sponsorEmail' ? norm(rec[k]) : rec[k];
}
// a deliberate sponsor change on InstantAdPay (sponsorfollow.js, 2026-10-22): the registry holds that record too, so
// iapsync can tell our echo of it apart from a change of our own; a deliberate clear (back to the tank) clears it here
if (rec.sponsorSetBy && Number(rec.sponsorSetAt) > 0) {
cur.sponsorSetAt = Number(rec.sponsorSetAt); cur.sponsorSetBy = String(rec.sponsorSetBy);
cur.sponsorPrevEmail = rec.sponsorPrevEmail ? norm(rec.sponsorPrevEmail) : null; cur.sponsorSetOrigin = rec.sponsorSetOrigin ? norm(rec.sponsorSetOrigin) : null;
if (!rec.sponsorEmail) cur.sponsorEmail = null;
}
cur.updated = Date.now(); this.db.byEmail[e] = cur; this.save(); return cur;
},
async all() { if (!this.db) this.load(); return Object.values(this.db.byEmail); },