43e841721a
override.js: the weekly payer for the 3% level-4 override. It pays only when overrideMode is 'live' AND overrideGoLive is set AND OVERRIDE_PAYER_KEY (or _FILE) is present; otherwise the Monday dry-run report runs as before. Default stays 'dryrun'. Nothing in this commit moves money. - Week = Monday 00:00 to Monday 00:00 Central; settled from 9 AM CT the Monday after, weeks in order. - Plan frozen once per week (claim plan:<week>), one row per recipient (POL wei summed), on the volume. - Claims fail closed: exclusive file create on the shared volume plus event_marks when MySQL is on. - Row marked 'sending' before the tx, tx hash stored on acceptance; lost answers become 'review' and are never re-sent (settled from the chain index or by the admin). Pre-flight revert = carried, no gas. - Dust under overrideDustPol (0.01) carried to next week; overridePayCapPol (100) holds the whole week; wallet must cover total + gas or nothing is sent; Telegram alerts once each. - Telegram summary to Marty's private chat says PAID with tx links. - Members: AwardPaid from the payer emails + on-site notice "Your Level 4 override is paid" and shows in Earnings as "Level 4 override" (common.js / my.js tags bumped to 20261023ov). - Admin: /api/admin/override adds week status + payer state; POST /api/admin/override/pay (only when live) and /api/admin/override/resolve; P&L pane card with "Pay this week now" shown only when live. - Comp plan (earning.html) + Platform Facts card hidden behind data-when="override-live" (shown only when overrideMode is live). Chatbot copy drafted in D:/tmp/override-copy, TODO in chatbot.js. - qa/override.test.cjs (bash qa/run.sh override): 30 checks on a fake chain/signer/DB, throwaway data. Reconciliation 2026-10-23: the dry run reads every Purchase in chain-index (229 events, full history); per Central week it matches the index exactly. The ~$1,775 figure was the rolling 7 days 09-10..09-17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
4.0 KiB
Bash
72 lines
4.0 KiB
Bash
#!/usr/bin/env bash
|
|
# InstantAdPay QA harness runner. From the site dir:
|
|
# bash qa/run.sh public # live public pages only (no local server)
|
|
# bash qa/run.sh member # local copy: member + admin walk
|
|
# bash qa/run.sh earn # local copy: earning flows end to end (~2-3 min)
|
|
# bash qa/run.sh all # public + member + earn
|
|
# bash qa/run.sh kb # chat knowledge base: retrieval unit test + chat endpoint e2e on a local copy with a mock OpenRouter
|
|
# bash qa/run.sh sponsorfollow # sponsor follow rule + network tank unit tests and the two-server e2e (local IAP + local LinkSpin, throwaway data)
|
|
# bash qa/run.sh door # Spooky Doors door + costume shop flows on their own local copy (qa/door.mjs boots it)
|
|
# bash qa/run.sh gamepass # Game Pass buy flow + account-wide POL caps (polgrant) on their own local copy (qa/gamepass.mjs boots it)
|
|
# bash qa/run.sh sov-passes # pass tiers (Explorer/Champion/Sovereign/Legend): store unit checks + admin buys Explorer + Sovereign with seeded purchased credits on a local copy (screenshots D:/tmp/sov-passes)
|
|
# bash qa/run.sh login-queue # prepaid login-ad line: JSON store end to end + the MySQL path's lease/guard logic against a fake SQL layer (no server, throwaway data)
|
|
# bash qa/run.sh gamepass-games # the REAL games' polgrant.js + PolHunter's tournament payer against a local copy (needs the sibling game repos)
|
|
# bash qa/run.sh override # level-4 override: week math, hunt, house, dust carry, cap, balance, two concurrent payers (fake chain + signer, throwaway data)
|
|
# Each local run boots server.js on its own port with a throwaway data dir (JSON store, no DB, no
|
|
# mail key, devCode sign-in), so nothing touches production data. Reports land in qa/out/.
|
|
set -u
|
|
cd "$(dirname "$0")/.."
|
|
MODE="${1:-all}"
|
|
OUT="qa/out"; mkdir -p "$OUT"
|
|
TMP="${TMPDIR:-${TEMP:-/tmp}}/iap-qa-$$"
|
|
status=0
|
|
|
|
start_local() { # $1 = port
|
|
local port="$1"
|
|
rm -rf "$TMP-$port"; mkdir -p "$TMP-$port/uploads"
|
|
(PORT="$port" DATA_DIR="$TMP-$port" ADMIN_EMAIL="${ADMIN_EMAIL:-martybostick@gmail.com}" ADMIN_PASSWORD=localtest node server.js > "$OUT/server-$port.log" 2>&1 &)
|
|
for i in $(seq 1 20); do curl -s -m 2 "http://127.0.0.1:$port/api/config" >/dev/null && return 0; sleep 1; done
|
|
echo "local server on :$port did not come up"; return 1
|
|
}
|
|
stop_local() { # $1 = port
|
|
for p in $(netstat -ano 2>/dev/null | grep ":$1 " | awk '{print $5}' | sort -u); do taskkill //F //PID "$p" >/dev/null 2>&1; done
|
|
rm -rf "$TMP-$1"
|
|
}
|
|
|
|
if [ "$MODE" = "public" ]; then
|
|
node qa/walk.mjs public || status=1
|
|
node qa/chatbot-sync.mjs || status=1
|
|
elif [ "$MODE" = "member" ]; then
|
|
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
|
|
elif [ "$MODE" = "sponsorfollow" ]; then
|
|
node qa/sponsorfollow.test.cjs || status=1
|
|
node qa/sponsorfollow-e2e.mjs || status=1
|
|
elif [ "$MODE" = "kb" ]; then
|
|
node qa/kb-retrieval.cjs || status=1
|
|
node qa/kb-chat.mjs || status=1
|
|
elif [ "$MODE" = "door" ]; then
|
|
node qa/door.mjs || status=1
|
|
elif [ "$MODE" = "gamepass" ]; then
|
|
node qa/gamepass.mjs || status=1
|
|
elif [ "$MODE" = "sov-passes" ]; then
|
|
node qa/sov-passes-store.cjs || status=1
|
|
node qa/sov-passes-local.mjs || status=1
|
|
elif [ "$MODE" = "login-queue" ]; then
|
|
node qa/login-queue.cjs || status=1
|
|
node qa/login-queue-sql.cjs || status=1
|
|
elif [ "$MODE" = "override" ]; then
|
|
node qa/override.test.cjs || status=1
|
|
elif [ "$MODE" = "gamepass-games" ]; then
|
|
node qa/gamepass-games.cjs || status=1
|
|
elif [ "$MODE" = "earn" ]; then
|
|
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
|
|
else
|
|
node qa/walk.mjs public || status=1
|
|
node qa/chatbot-sync.mjs || status=1
|
|
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
|
|
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
|
|
fi
|
|
echo
|
|
echo "reports: $OUT/walk-report.txt $OUT/earn-report.txt (screenshots alongside)"
|
|
exit $status
|