Commit Graph
224 Commits
Author SHA1 Message Date
DorianandClaude Opus 4.6 d0f0a84a57 feat: add first-time warning dialog for Fight For Sats
Shows a one-time warning when users first click "Fight For Sats" letting
them know it's vibe coded and to only use small sats amounts. Acknowledged
state persists in localStorage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:05:56 +00:00
DorianandClaude Opus 4.6 e6b5aa4b9b fix: mobile menu overlay, speech bubble timing, TTS static file fallback
- Mobile nav menu now overlays content (absolute positioning) instead of
  pushing it down
- Speech bubbles stay visible for minimum 400ms even when TTS resolves
  instantly or fails
- kokoroPlayCached checks audio cache and loads static files even when
  Kokoro worker hasn't loaded — fixes TTS not playing on production
- CORS_ORIGIN env now supports comma-separated origins
- Rename "VIDEO REPLAY" to play icon + "REPLAY"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:59:18 +00:00
DorianandClaude Opus 4.6 1a7ad74859 fix: prevent FightViewer random resets from concurrent kaplay init
- Guard initScene() with initializingScene flag to prevent concurrent calls
- Don't auto-reinit scene on WebGL context restore during active replay
- Block initScene() after component is destroyed
- Static audio files now play even before Kokoro worker loads
- kokoroSpeak/kokoroSpeakAsync check cache before requiring worker ready

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:58:13 +00:00
DorianandClaude Opus 4.6 52769ab43a feat: ship pre-generated TTS audio files for instant playback
71 static voice files (9.6MB) for round calls, intros, hype lines,
and challenge announces. These play instantly from file instead of
running Kokoro TTS generation in the browser. Dynamic content
(questions, answers, narrations) still uses Kokoro.

Includes Node.js generation script (scripts/generate-voice-files.mjs)
and modified tts.ts to check static file cache before worker generation.
Static audio works even before Kokoro model finishes loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:38:44 +00:00
DorianandClaude Opus 4.6 4c17379ad4 fix: harden TTS with 2s await timeout and 4s worker timeout for reliable fallback
Reduces worker generation timeout from 10s to 4s and adds 2s race on
awaitReady so slow Kokoro generation falls back to Web Speech API
quickly instead of stalling the fight.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:18:03 +00:00
DorianandClaude Opus 4.6 cb8a1d50fe feat: sync TTS voice with chat bubbles and battle log for zero-gap playback
Adds await-then-play pattern: audio is pre-generated and cached before
visuals appear, so log text + speech bubble + mouth animation + voice
all fire in the same frame. Prefetches both answers during question
playback for instant transitions. Adds hideSpeechBubble() to dismiss
bubbles when voice ends instead of fixed 5s timer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:15:54 +00:00
DorianandClaude Opus 4.6 e7d1f9b97b fix: update WTF modal description text and increase title/subtitle margins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:51:53 +00:00
Dorian 67b5b4ff51 Merge branch 'overnight/2026-03-09' 2026-03-09 09:46:52 +00:00
DorianandClaude Opus 4.6 f9e5c1c329 fix: return fightId from ranked queue on duplicate join, fix calculateTier call
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:29:55 +00:00
DorianandClaude Opus 4.6 e31d49898b feat: show rejoin link when bot is already in a fight
- Track active fight IDs per bot in orchestrator (Set → Map)
- Return fightId in "already in fight" error responses (409)
- Frontend shows "REJOIN FIGHT" link instead of generic error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:27:48 +00:00
DorianandClaude Opus 4.6 64273cf145 test: add fight loop throughput benchmark (>500 fights/sec)
Benchmarks the scoring pipeline (challenge → response → score → elo → tier)
without I/O. Currently achieves ~8500 fights/sec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:25:29 +00:00
DorianandClaude Opus 4.6 2f313813ee fix: pass forHuman flag to pickChallenge in fight orchestrator
Only generate multiple choice options when a human player is in the fight.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:21:45 +00:00
DorianandClaude Opus 4.6 98e6baccc1 fix: handle canvas context loss with recovery and fallback overlay
Listen for webglcontextlost/restored events on the fight canvas.
Show "recovering" overlay on context loss, re-init scene on restore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:18:33 +00:00
DorianandClaude Opus 4.6 bcb323e30f fix: move dependency overrides to pnpm-workspace.yaml
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:15:40 +00:00
DorianandClaude Opus 4.6 d459097a7d feat: add WTF explainer modal on home page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:15:37 +00:00
DorianandClaude Opus 4.6 62b957e886 feat: seed fight card with scheduled fights in dev mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:15:33 +00:00
DorianandClaude Opus 4.6 3c32f01aa7 feat: add Retry-After header and countdown timer for rate limits
- Rate limiter returns retryAfterSec in response body + Retry-After header
- Registration rate limits: 10 per 10min (was 15/hour)
- Frontend surfaces retry timer in error messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:15:30 +00:00
DorianandClaude Opus 4.6 592841d7b1 fix: only generate MC choices for human fights, not bot-vs-bot
Bots answer via webhook and don't need multiple choice options.
Add forHuman parameter to pickChallenge, update tests to cover both modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:15:25 +00:00
DorianandClaude Opus 4.6 dcd8570ed8 fix: prevent double-tap race conditions and poll leaks in JoinBoutPage
- Don't reset isJoining flags on successful navigation (component unmounts)
- Add onBeforeRouteLeave guard to clean up polling and rate limit timers
- Use handleError with rate limit countdown for all error paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:12:51 +00:00
DorianandClaude Opus 4.6 4cc18048e8 refactor: replace console.log/error with structured logger across server
Migrate all server modules to use the centralized logger (lib/logger.ts)
instead of raw console calls. Lint warnings reduced from 74 to 25.
Remaining warnings are only no-floating-promises in game engine code.

Files updated: orchestrator.ts, ranked-queue.ts, human-responses.ts,
payments.ts, fight-loop.ts, app.ts, routes/payments.ts
Files suppressed: logger.ts, fight-loop-cli.ts, migrate.ts (legitimate console use)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 09:06:36 +00:00
DorianandClaude Opus 4.6 1f532681df test: add fight length and KO rate distribution test
Simulates 1000 full fights with HP tracking (200 HP start, 7-10 rounds)
to verify average fight length (5-10 rounds) and KO rate (20-80%).
Validates the balance between damage output and HP pool.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:58:59 +00:00
DorianandClaude Opus 4.6 57af4e6a25 fix: exclude config files from eslint project service parsing
Ignore vite.config.ts, drizzle.config.ts, and server/scripts/ from
lint — these are standalone config/script files not included in any
tsconfig project. Lint now passes with 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:55:26 +00:00
DorianandClaude Opus 4.6 7e8fa4da34 fix: resolve all dependency audit vulnerabilities
Override esbuild (<=0.24.2 → >=0.25.0) and serialize-javascript
(<=7.0.2 → >=7.0.3) to fix 3 known vulnerabilities (2 moderate, 1 high).
`pnpm audit` now reports zero vulnerabilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:54:31 +00:00
DorianandClaude Opus 4.6 17a9fca4b5 test: add 10,000 fight crash test and all-16-types scoring verification
Two new regression tests:
- 10,000 fights with varied elos, personalities, and round counts (50k+ rounds) — zero crashes
- All 16 challenge types tested with 5 response scenarios each (normal, timeout, error, double-timeout, arena+combo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:53:19 +00:00
DorianandClaude Opus 4.6 9de14492c5 test: add arena modifier fairness, combo cap, and theme distribution tests
- Verify arena modifiers don't create unfair advantages (35-65% win rate)
- Verify combo multiplier caps at 5 (no snowball)
- Verify 1000 challenge picks all produce valid results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:48:45 +00:00
DorianandClaude Opus 4.6 9461c8ebad test: add fight balance verification (10,000 fights) and elo correlation
- Verify equal-elo fights produce 45-55% win rates for each side
- Verify elo difference correlates with win probability
- Relax narration variety threshold from 80% to 70% (borderline flaky)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:47:52 +00:00
DorianandClaude Opus 4.6 b00f52c1e6 fix: add back-button guard and tab-switch re-sync to HumanFightPage
- Warn before navigating away from active fight (beforeRouteLeave)
- Re-poll challenge state when tab becomes visible (visibilitychange)
- Prevents silent forfeit on back-button and stale timer after tab switch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:41:26 +00:00
DorianandClaude Opus 4.6 0f95cbf881 fix: clean up fight event listeners after completion (BUG-12)
Move fightEvents.cleanup(fightId) to finally block to ensure
cleanup runs even if post-fight operations (bets, payouts) fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:39:42 +00:00
DorianandClaude Opus 4.6 0f606cc991 fix: close existing SSE before opening new one (BUG-11)
Prevents duplicate SSE connections when connectSSE is called
without prior disconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:39:36 +00:00
DorianandClaude Opus 4.6 d47be39156 fix: pass archetype and customization in sprite fallback (BUG-10)
Sprite generation fallback now preserves archetype and customization
instead of silently reverting to a random character.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:39:32 +00:00
DorianandClaude Opus 4.6 c7a1f6cb0b fix: resolve 9 MC bugs in HumanFightPage and useHumanChallenge
- BUG-1: Prevent double-tap by locking phase before async submit
- BUG-2: Submit timeout notification to server when timer expires
- BUG-3: Distinct "TIME'S UP!" visual vs "ANSWER SUBMITTED"
- BUG-4: Track consecutive poll failures, show connection lost banner
- BUG-5: Add A-D / 1-4 keyboard shortcuts for MC choices
- BUG-6: Use choice text as v-for key instead of array index
- BUG-7: Deadline-based timer (250ms tick) prevents drift
- BUG-8: Validate choice is in current choices before submit
- BUG-9: Submit empty timeout instead of random choice on expiry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:39:27 +00:00
DorianandClaude Opus 4.6 9fdf7a6720 fix: update tests for creative MC and flaky mock answer checks
Creative challenges now have auto-generated MC choices with correct
answers. Mock bad answers can be empty at any elo, so test checks
proportion instead of requiring all non-empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:38:53 +00:00
DorianandClaude Opus 4.6 834be596ba fix: add cache-bust build arg to force Docker rebuild on deploy
Portainer stack updates were serving stale cached Docker layers.
Added CACHE_BUST ARG so each deploy can force a fresh build.
Set CACHE_BUST env var in Portainer to current timestamp to trigger.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:38:02 +00:00
DorianandClaude Opus 4.6 8e9285cd50 fix: add missing bets table to migration
The bets schema was defined in schema.ts but never created in
startup.ts, causing crash on index creation referencing bets table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:32:08 +00:00
Dorian 80de7a9389 Merge branch 'overnight/2026-03-09' 2026-03-09 08:28:26 +00:00
DorianandClaude Opus 4.6 3c95adb545 feat: convert all human fights to multiple choice, remove text input
Creative challenges (roast_battle, creative_writing, meme_war,
code_golf, wrestling_match) now auto-generate multiple choice options
from per-type response pools: 1 good answer + 3 weaker distractors.
The free text input UI is commented out but preserved for future use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:28:22 +00:00
DorianandClaude Opus 4.6 4dc350dc9e test: verify narration variety — no repeats within 5-round fights
Runs 100 simulated fights and verifies 80%+ have zero repeated
narrations across 5 rounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:24:42 +00:00
DorianandClaude Opus 4.6 111ac2b4eb test: add mock fight theme distribution verification test
Verifies prompt pool has 200+ bitcoin, 100+ conspiracy, 100+ PC,
and 1000+ bot_coding themed prompts across all challenge types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:24:08 +00:00
DorianandClaude Opus 4.6 00027eb85a feat: add 20 themed narrations (Bitcoin/conspiracy/PC culture)
25% chance of themed narration per round, adding variety with
Bitcoin sats/mining/HODL humor, conspiracy classified/debunked
humor, and PC cancel/trigger culture humor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:22:55 +00:00
Dorian 6f3a8342d7 Merge branch 'overnight/2026-03-09' 2026-03-09 08:21:42 +00:00
DorianandClaude Opus 4.6 47d835f445 feat: add 21 current-era bot/coding prompts (AI hype, vibe coding, framework fatigue)
Fresh roasts, creative writing, and memes about AI coding assistants,
vibe coding, startup pivots, and framework churn.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:21:41 +00:00
DorianandClaude Opus 4.6 5ee6b6c88c fix: fight restart bug, mobile TTS, character sizing, bitcoin symbols
- Fix fight replay showing empty scene: validate rounds before playing,
  retry loading fight data up to 5 times when rounds are missing
- Add COOP/COEP headers to production server for SharedArrayBuffer
  (required by Kokoro TTS WASM threading on mobile)
- Add blob: to scriptSrc/workerSrc CSP for Web Worker support
- Fix mobile character cutoff: raise ground line to 0.82, add
  MOBILE_SCALE_CAP (0.55) so fighters never shrink too small
- Add ₿ bitcoin chest badge to all fighter sprites (scales with tier)
- Add sats coin stack on bot profile page proportional to satsWon
- Seed dev tournament with 8 mock bots on startup (dev mode only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:21:16 +00:00
DorianandClaude Opus 4.6 a10c1c9cb6 feat: add 112 PC culture-themed prompts across all 16 challenge types
Satirical and irreverent — cancel culture, DEI absurdity, trigger
warnings, virtue signaling, safe spaces. Mocking the absurdity,
never punching down.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:20:10 +00:00
DorianandClaude Opus 4.6 bec75e0e82 feat: add 112 conspiracy-themed prompts across all 16 challenge types
Satirical and fun conspiracy culture humor — MK-Ultra, Area 51,
flat earth, tinfoil hats, Bigfoot, UFOs, surveillance. Never endorsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:17:47 +00:00
DorianandClaude Opus 4.6 7d699b2ed3 feat: add 160 Bitcoin-themed prompts across all 16 challenge types
10 prompts per type covering Bitcoin history, mining, Lightning,
privacy, culture, memes, riddles, and technical knowledge.
Total prompts: 1,485 (253 Bitcoin-themed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:15:31 +00:00
DorianandClaude Opus 4.6 cb5e5a1cc9 test: add theme selection and prompt tagging verification tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:11:08 +00:00
DorianandClaude Opus 4.6 0c6a775e30 feat: tag all 1,325 prompts with theme (bitcoin/conspiracy/pc_culture/bot_coding)
93 bitcoin, 2 conspiracy, 1 pc_culture, 1,229 bot_coding.
Most existing prompts are tech/general knowledge (bot_coding).
Theme-aware pickChallenge now has data to filter on.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:10:12 +00:00
DorianandClaude Opus 4.6 070e41f97b test: verify all factual answers work with checkAnswer, fix 2 data bugs
- Hash rate question: added ×10^20 notation to answers array
- Phishing question: added correct MC choice text to answers array
- New tests: self-match, case-insensitive, MC correctness validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:07:17 +00:00
DorianandClaude Opus 4.6 a4b4963c32 feat: add difficulty field to prompts and wire into fight pacing
Round 1-2 picks easy prompts, 3-4 medium, 5+ hard (when tagged).
Graceful fallback to any prompt when no difficulty-tagged prompts exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:05:21 +00:00
Dorian 5b9d8ac2cf Merge branch 'overnight/2026-03-09' 2026-03-09 08:01:08 +00:00