Engine Room panel on the LinkSpin Ads screen (Fuel Your Offers stage 4, Marty approved 2026-10-24): engine.js + engine-room.js are the same files as InstantAdPay's. LinkSpin's facts (credits, campaigns, clicks this week and last via coach.clicksSince, free login slots, conversion-pixel goals this month from the Central 1st via convtrack.countSince, conversions in 30 days, and the Banner Spin / spin link / page / testing part states from bannerspin, rotator and pages) are combined with InstantAdPay's facts and the streak from signed /api/partner/engine on InstantAdPay (cached a minute; when it does not answer the panel says so). LinkSpin answers /api/partner/engine for InstantAdPay's tab. /api/my/engine, /api/my/engine/goal (forwarded to InstantAdPay, where the goal lives with the streak). Hidden while refuelStreak is off; greyed "Refuel to start your engine" until the first counted refuel. Chatbot CANNED + FACTS cover it. qa/refuel-engine.test.cjs checks the shared files have not drifted from InstantAdPay's and runs its engine test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-24 05:55:12 -05:00
parent 4749d711f4
commit 018101f011
8 changed files with 260 additions and 4 deletions
+19
View File
@@ -0,0 +1,19 @@
// Engine Room on LinkSpin: engine.js, kit.js, admin-kits.js and engine-room.js are the SAME files as InstantAdPay's.
// This checks they have not drifted, then runs InstantAdPay's engine test (it covers build() and the LinkSpin facts).
// Run: node qa/refuel-engine.test.cjs
'use strict';
const fs = require('fs');
const path = require('path');
const { spawnSync } = require('child_process');
const ROOT = path.join(__dirname, '..');
const IAP = path.join(ROOT, '..', '..', 'onchain-ad-membership', 'site');
if (!fs.existsSync(path.join(IAP, 'engine.js'))) { console.log('skip: InstantAdPay repo not beside this one'); process.exit(0); }
let fails = 0;
for (const f of ['engine.js', 'kit.js', 'public/assets/admin-kits.js', 'public/assets/engine-room.js']) {
const same = fs.readFileSync(path.join(ROOT, f)).equals(fs.readFileSync(path.join(IAP, f)));
console.log((same ? 'ok ' : 'FAIL ') + f + (same ? ' matches InstantAdPay' : ' differs from InstantAdPay: copy the newer one across'));
if (!same) fails++;
}
const r = spawnSync(process.execPath, [path.join(IAP, 'qa', 'refuel-engine.test.cjs')], { encoding: 'utf8' });
process.stdout.write(r.stdout || ''); if (r.status !== 0) fails++;
process.exit(fails ? 1 : 0);