Member erase (Marty 2026-11-15, ticket LS-1021): POST /api/admin/erase {email, dryRun (default true), force} + the hub's member.erased event

erase.js runs inside the app so the documents modules keep in memory and the MySQL docs rows stay consistent. Refused
unless force: a main wallet, an on-chain member number, positions, a team here, ads running or queued. Removes the
account, their spin links with every click row in rot_hits and conversions (rotator.eraseOwner, docstore.rowsWhere),
and scrubs every document that mentions them with scrub.js (same file as InstantAdPay) through the owning module's live
copy: accounts, audiences, coach, convtrack, earned (unspent credits go away), hubsync, iapsync, mail-intro, postbacks,
registry, rotator, sponsorfollow; others (updates-log, ...) through docstore. A 30-day email-hash tombstone (erase.json)
stops the InstantAdPay registry sync and hub events from bringing them back; the log keeps hashes and counts only.
hubsync handles member.erased {emailHash}. qa/erase.test.cjs 6 pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 12:29:33 -06:00
parent e2af298317
commit f4789156b8
18 changed files with 349 additions and 14 deletions
+1 -1
View File
@@ -143,4 +143,4 @@ async function tick(force) {
finally { ticking = false; }
}
function adminView() { const st = load(); return { on: on(), url: URL_(), tracked: Object.keys(st.hashes).length, pushed: st.pushed, knownSkipped: st.known, last: st.last, errors: st.errors, lastError: st.lastError || null, pendingTouches: pending.size }; }
module.exports = { init, touch, tick, adminView, on };
module.exports = { init, touch, tick, adminView, on, /* member erase (erase.js, 2026-11-15): the live copy */ _state: load, _save: save, _forget: e => pending.delete(norm(e)) };