Commit graph

152 commits

Author SHA1 Message Date
jedarden
d43cf83471 feat(evolver): island cross-pollination every 50 generations per §10.2
Adds cross-pollination logic that copies the top program from each island
to a random other island every 50 generations. When source and target
islands use different languages, the LLM translates the code. Generation
boundaries are tracked per-island to prevent duplicate events.

- New crosspoll package with boundary detection, migration, and LLM translation
- Added MaxGenerationByIsland DB query for generation counter tracking
- Integrated into RunEvolutionLoop with observability logging
- Tests for boundary logic, translation prompts, and target selection

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 15:13:27 -04:00
jedarden
04927a76b0 feat(web): progressive disclosure — lazy-load, expand details, windowed lists per §16.15
Virtual list tracks expanded row heights for correct spacer calculations.
Leaderboard mobile cards use event delegation so toggles work inside lazy
sections. Mobile card details animate with max-height instead of display
toggle. Reduced-motion rules cover all expand/collapse patterns.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 15:06:55 -04:00
jedarden
c618f0b7a1 feat(worker): gzip replay compression at upload per §7.1
Worker now gzip-compresses replays before uploading to B2 with
key replays/{match_id}.json.gz and Content-Encoding: gzip.
Updated B2 client Upload to accept contentEncoding parameter.
Fixed downstream web consumers (matches, bot-profile, playlists)
to reference .json.gz URLs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 15:00:09 -04:00
jedarden
1451ca5a50 feat(web): mobile swipe-through playlist carousel per §16.16
TikTok-style full-screen vertical carousel for playlist matches on mobile.
Swipe up/down advances between replays, horizontal swipe reveals metadata
panel with match details. Director mode auto-adjusts speed based on action
density. Auto-advance with animated countdown ring after replay completion.
Desktop layout unaffected — carousel only activates on mobile (<768px).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 14:54:38 -04:00
jedarden
677fde5245 fix(engine): use core1 variable in spawn priority tiebreak test
The TestSpawnPriority_LowerIDBreaksTie test declared core1 but never
referenced it, causing a compile error. Added an assertion that
core1.LastSpawnedTurn remains 0 (confirming it didn't spawn).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 14:45:06 -04:00
jedarden
67d94cebbd feat(web): add theater component and playlist carousel
Commit the TheaterMode component (§16.17) and playlist carousel
referenced by recent commits. Includes bots page and playlists
page enhancements.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 14:31:08 -04:00
jedarden
4930d7a841 feat(web): integrate theater mode into replay viewer per §16.17
Wire the existing TheaterMode component into the replay page — adds
fullscreen toggle button on canvas, F key shortcut, auto-hiding
controls with 3s inactivity, vignette pulse on critical moments,
and mobile Fullscreen API support.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 14:28:54 -04:00
jedarden
5cf9a786d5 feat(web): progressive disclosure — lazy sections, expandable details per §16.15
Wire IntersectionObserver-based lazy rendering into bot profile (recent
matches below fold) and leaderboard (mobile cards). All three dense pages
(leaderboard, matches, bot-profile) now use expandable rows/cards for
secondary detail, windowed rendering for long lists, and keyboard-accessible
"Show more" affordances. Expand/collapse animations respect reduced-motion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 14:01:13 -04:00
jedarden
28f6d99bff feat(replay): smooth 400ms cross-fade between view modes per §16.11
Implement double-buffered canvas cross-fade when switching between
dots, Voronoi territory, and influence gradient views. Old layer fades
out while new layer fades in with ease-in-out cubic easing over 400ms.
Respects prefers-reduced-motion by snapping instantly when set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:57:42 -04:00
jedarden
a06129132e feat(k8s): add deployment manifests for acb-evolver and acb-api per §9.2
Staging manifests for sync to declarative-config/k8s/apexalgo-iad/ai-code-battle/:
- acb-evolver: Deployment + ServiceAccount with LLM/PG/R2 secrets
- acb-api: Deployment + Service + IngressRoute for api.ai-code-battle.ardenone.com

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:50:20 -04:00
jedarden
81940a1598 fix(api): fix getEnv stub and Dockerfile Go version for deployment readiness
The getEnv() function in server.go always returned the default value,
preventing ACB_R2_ENDPOINT/ACB_B2_ENDPOINT from being read at runtime.
Also updated Dockerfile from golang:1.24 to golang:1.25 to match go.mod.

K8s manifests for acb-evolver and acb-api already exist in
declarative-config/k8s/iad-acb/ai-code-battle/ (added Apr 21).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:29:45 -04:00
jedarden
9750d29618 feat(web): performance trifecta — preload-on-hover, skeleton screens, back-cache per §16.14
Three perceived-performance features:
- Preload on hover: internal links prefetch target JSON data after 150ms
  hover debounce using <link rel=prefetch>. Touch events prefetch
  immediately.
- Skeleton screens: every async page shows a shimmer-animated placeholder
  matching the final content layout (leaderboard rows, bot profile card,
  replay canvas, playlist grid, etc.) instead of generic "Loading..." text.
- Instant back-cache: back/forward navigation restores scroll position and
  cached HTML from an in-memory LRU cache (8 pages), making back navigation
  0ms.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:28:43 -04:00
jedarden
f6ce4588f4 fix(api): rename /api/ui-feedback to /api/feedback per plan §13.6
The community feedback endpoint was registered as /api/ui-feedback in
the Go API but the plan and annotation.ts client both use /api/feedback.
Rename the route and update agentation-overlay.ts to match. Add a
route-level test asserting the canonical path and that the old path
returns 404.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:22:47 -04:00
jedarden
5443e4d0ed fix(engine): enforce strict HMAC response signature verification per §4.4
Remove the lenient fallback that accepted bot responses missing the
X-ACB-Signature header. Missing or invalid signatures now cause the
response to be discarded and count toward the crash threshold (§4.5).
Add tests for missing-header, bad-signature, and crash-after-10 cases.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 13:18:10 -04:00
jedarden
80733f673e feat(replay): wire AnnotationOverlay to EventTimeline with annotation badges per §16.8
Sync annotations to both the canvas renderer (spatial markers) and the
event timeline (colored badge markers) so user feedback appears in both
the replay canvas and the timeline ribbon.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 18:07:44 -04:00
jedarden
d3f2068f8b feat(replay): implement Director Mode adaptive auto-speed playback per §16.10
Add director.ts component with action density computation, speed schedule
generation, and eased speed transitions. Integrate into replay viewer with
Director option in speed selector, target duration presets (30s/1min/2min/5min),
speed indicator display, and scrubbing pause/resume.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 17:57:10 -04:00
jedarden
eaa8193cac feat(replay): restore annotation imports for debug telemetry panel
Working tree had removed the annotation component imports while the
initAnnotations function and ANNOTATION_OVERLAY_STYLES template
reference still depended on them, causing TS build failures.
2026-04-21 17:25:20 -04:00
jedarden
30f2c63b20 feat(replay/enrichment): fix TS build, align annotations with §8.3
- Fix TS6133: rename _matchId → matchId in AnnotationOverlay and use
  this.matchId in filter so the field is actually read
- Align ANNOTATION_TAGS in feedback.ts to four types from plan §8.3:
  insight, mistake, idea, highlight (matching components/annotation.ts)
- Update LS_KEY to acb_annotations_v2 to avoid stale-format conflicts
- Fix duplicate import block in api-types.ts (re-exported evolution types)
- Remove unused debugPanelChevron ref in replay.ts; add annotation
  imports for AnnotationOverlay and createAnnotationForm

The AI commentary generation backend (enrichment.go) and client-side
subtitle display (replay-viewer.ts, embed.ts, home.ts) were already
complete in prior commits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 17:20:22 -04:00
jedarden
d8812b98ee feat(playlists/replay): n-player win prob, annotations, evolver metrics
Playlist curation per §10 is fully implemented in the index builder:
- generatePlaylists() writes /data/playlists/index.json and {slug}.json
- curateWeeklyHighlights() selects best-of-week by upsets, elite
  clashes, marathon turns, and closest finishes (last 7 days)
- persistGeneratedPlaylists() upserts to playlists/playlist_matches DB tables
- /data/playlists/ stub files seeded for all 12 curated collections

Replay viewer improvements shipped alongside:
- WinProbPoint refactored from {p0,p1} to {probs: number[]} for N players
- renderWinProbSparkline draws one line per player with matching colors
- replay.ts updated to build probs[] from replay.win_prob arrays
- Dynamic legend generated from replay.players instead of hardcoded P0/P1

New annotation overlay component (§16.8):
- AnnotationOverlay: timeline track, per-turn list, canvas markers
- createAnnotationForm: type selector, author, body, localStorage + API
- ANNOTATION_OVERLAY_STYLES: self-contained CSS for the overlay

Evolver: add mutations_per_hour metric to Totals (live.json §14)
Types: consolidate evolution types into types.ts, re-export from api-types.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 17:15:31 -04:00
jedarden
fd9ffbc048 feat(watch/replays): show featured playlists as curated sections per §10
Replace the flat horizontal playlist row with a curated layout:
- Top 3 featured playlists (Best of Week, Biggest Upsets, Closest Finishes)
  displayed as distinct visual sections in a 2:1:1 grid
- "Best of Week" highlighted with a primary accent style
- Remaining playlists shown in a scrollable "More Collections" row
- "Browse all →" header link routes to /watch/playlists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 17:11:16 -04:00
jedarden
b7fea448bd feat(mobile): implement mobile-first responsive design per §16.5
- Fix nav/home breakpoints from 768px → 639px to match design system
- Add leaderboard mobile card view with tap-to-expand stats and full-stats link
- Add canvas wrapper aspect-ratio:1 on phone (fills full width, square viewport)
- Add commentary text scroll on mobile, win-prob header stacking
- Replay viewer: mobile controls, pinch-to-zoom, tap-to-play, swipe scrub,
  floating view-mode toggle, debug telemetry slide-up sheet (already in place)
- Sandbox: desktop-required message with link already implemented

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 17:04:02 -04:00
jedarden
38269d1285 feat(home): redesign homepage per §16.3 — dynamic data, territory replay, compact layout
- Remove duplicate SWR cache (use shared fetchers from api-types.ts)
- Add territory view mode to featured replay embed
- Use demo replay fallback when no live matches available
- Compact layout with tighter spacing for 1080p above-the-fold
- Add missing placeholder data files: evolution/meta.json, seasons/index.json
- Fix unused import in cmd/acb-index-builder/s3_test.go

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 17:01:24 -04:00
jedarden
80af92b022 feat(replay): add debug telemetry panel and fix test build
Add debug telemetry UI to replay viewer with player toggles,
priority-based target markers, and stacked reasoning boxes.
Fix undefined generateTestImage in main_test.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:57:15 -04:00
jedarden
80040fa501 test(index-builder): add tests for fast playlist lookup helpers
Covers buildFirstMatchPerBot, isNewBotDebutFast, buildPairFrequency,
isRivalryMatchFast, and integration test for playlist generation with
the optimized lookups.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:48:20 -04:00
jedarden
be3843d9ac fix(index-builder): correct series/season exempt queries, optimize playlist curation
- Fix deploy.go to query actual table names (series_games not series_matches,
  join through series_games for seasons instead of non-existent season_matches)
- Add playlist_matches table to exempt match IDs from R2 pruning
- Pre-build lookup maps for O(1) playlist match filtering instead of O(n²)
- Enhance home page featured replay to prefer AI-enriched matches
- Add enrichment test coverage (shouldEnrich criteria validation)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:47:13 -04:00
jedarden
aa1c78c9d7 docs: document series/season scheduler verification in PROGRESS.md
Verified all §11 deliverables are fully implemented:
series scheduler, seasonal ELO reset, bracket display, season leaderboard.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:39:43 -04:00
jedarden
33e443c199 docs: document series scheduler and seasonal ELO reset in PROGRESS.md
The series scheduler (series_season.go) and season management were already
fully implemented but not tracked in PROGRESS.md. Updates the file listing
to include series_season.go, series_season_test.go, Dockerfile in the
matchmaker, and series.ts, seasons.ts, season-detail.ts in pages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:29:50 -04:00
jedarden
46ff42ef84 feat(playlists): add static playlist placeholder files for dev mode
Populate web/public/data/playlists/ with all 12 playlist slug JSON files
and update index.json so the frontend fetch calls work during local
development without requiring the index builder to have run.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:22:30 -04:00
jedarden
513ca42d7a chore: minor import cleanup in predictions page
Remove unused API_BASE constant and reorder imports in predictions.ts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:16:24 -04:00
jedarden
9d7a2e2e3c fix(web): remove unused imports in predictions.ts to fix TypeScript build
PredictionHistoryEntry was imported but never used, and API_BASE was
declared but never read. These caused tsc to fail with TS6196/TS6133.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:15:33 -04:00
jedarden
b1121ed6f8 feat(playlists): add playlist curation and rebuild logic per §10, with series/seasons/enrichment
Implement auto-curated playlists in the index builder: 12 playlist types
(closest finishes, upsets, comebacks, marathons, rivalry classics, etc.)
with weekly highlight curation. Add DB persistence, R2 pruning exemptions,
frontend pages, and AI commentary enrichment pipeline.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 16:11:27 -04:00
jedarden
70b7337867 feat(blog): add rivalry context to spotlight prompt and fix narrative tests
The buildSpotlightPrompt function accepted a rivalries parameter but never
used it. This adds top rivalry data to the LLM prompt so the generated
Counter-Strategy Spotlight can reference active rivalries. Test updated to
verify rivalry data appears in prompt output.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 15:45:33 -04:00
jedarden
1796f2a27e feat(matchmaker): add series game result propagation to scheduler
The series scheduler was scheduling games and creating series_games rows,
but never updated winner_id or incremented a_wins/b_wins when individual
matches completed. This left series in perpetual "active" state since
finalizeCompletedSeries checks win counts that were never incremented.

Add updateSeriesGameResults step that:
- Finds series_games with completed matches but NULL winner_id
- Updates winner_id from match_participants
- Increments a_wins or b_wins on the series table

Called as step 0 in tickSeriesScheduler, before finalization checks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 15:31:33 -04:00
jedarden
51edf35d22 feat(sandbox): integrate Go WASM engine with multi-player support per §13.1
Enhance the WASM game sandbox with production-accurate Go engine:

- Add multi-player support (2-4 players) to Go WASM engine via JS callbacks
- New acbEngine.addPlayer/clearPlayers/runMatchMulti API for N-player matches
- Sandbox auto-loads Go WASM engine in background, falls back to TS engine
- Engine selector: Auto (Go WASM → TS fallback), Go WASM only, or TS only
- Engine status indicator shows which engine is active
- Performance panel reports which engine was used

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 15:28:35 -04:00
jedarden
347ae4f1df feat(predictions): resolve predictions on match completion, add API endpoints and frontend
- Worker resolves open predictions after writing match results (resolvePredictions + upsertPredictorStats)
- API endpoints: POST /api/predict, GET /api/predictions/open, GET /api/predictions/history
- Frontend /watch/predictions page with polling, prediction submission, and history display
- predictor_stats table tracks streaks and accuracy per predictor
- Series format selection: fix threshold from >200 to >=200 for bo3 eligibility

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 14:08:15 -04:00
jedarden
0d887ebeb2 fix(starters): fix Java starter HMAC timing attack and code quality
Replace plain String.equals() with MessageDigest.isEqual() for
constant-time HMAC signature comparison. Switch from manual StringBuilder
JSON to Jackson ObjectMapper. Add typed Java records for game state,
moves, and config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 14:04:42 -04:00
jedarden
7bf6566823 feat(starters,web): add 6-language bot starter kits per §6
Add forkable starter kit templates for Python, Go, JavaScript, Rust,
Java, and C# — each with HTTP server scaffold, HMAC auth, game types,
random strategy, Dockerfile, and GHCR workflow. Update /compete/docs
page with starter kit links and registration instructions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 13:58:27 -04:00
jedarden
91d807cec2 feat(web,cmd): enhance evolution dashboard, series/seasons pages, and matchmaker
- Evolution page: live polling (10s), activity feed, candidate tracking,
  statistics section, island overview with live.json schema
- Series page: detailed series view with game-by-game results
- Seasons page: season list with status and champion display
- Predictions page: enhanced prediction UI with open matches
- API types: add CycleInfo, Candidate, ActivityEntry, Totals for live.json
- Embed: improved embeddable replay widget
- Mobile CSS: responsive breakpoints and bottom tab bar
- Exporter: enhanced live.json generation with full cycle/candidate data
- Matchmaker: series scheduling support with config
- Worker: additional database queries for series/season data

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 13:42:20 -04:00
jedarden
c5a83cbe32 feat(web): code splitting per §16.7 — reduce app entry chunk 84% (10KB → 1.6KB gz)
Extract all inline page renderers from app.ts into lazy-loaded modules and
remove 500+ lines of duplicated replay viewer code. Every route now uses
dynamic import() so page code loads on-demand.

Changes:
- Remove duplicated replay viewer (renderReplayPage, initReplayViewer) from
  app.ts — now uses lazy import from pages/replay.ts
- Extract Watch Hub, Compete Hub, Season Detail, Docs, and 404 pages into
  their own modules (pages/watch-hub.ts, compete-hub.ts, season-detail.ts,
  docs.ts, not-found.ts)
- app.ts is now a pure routing module (~120 lines) with only lazy loaders
- Update vite.config.ts manualChunks: add replay-page, home, leaderboard
  chunks; add node_modules guard to prevent vendor code in page chunks
- All §16.7 budget targets pass: app.js 1.6KB (target 30KB), replay 13KB
  (target 80KB), sandbox 8.4KB (target 20KB), agentation separate

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 12:41:33 -04:00
jedarden
5215cd7e57 fix(web): remove unused colors parameter from drawThreatLines call
- Minor fix to match function signature
- Add lazy loaders for feedback and docs-api pages
2026-04-21 09:02:22 -04:00
jedarden
00069b1870 feat(acb-api): implement bot registration, job coordination, and replay endpoints per plan §12 Phase 4
- POST /api/register: bot registration with URL + shared secret validation
- GET /api/job: worker polls for next pending match job (authenticated)
- POST /api/job/:id/result: worker submits match result (winner, replay JSON)
- GET /api/replay/🆔 serve replay JSON from R2 warm cache (falls back to B2)
- GET /api/bot/🆔 bot profile JSON (rating, elo, record, metadata)
- GET /api/bots: leaderboard snapshot with pagination
- POST /api/ui-feedback: accept Agentation UI feedback

Authentication via Bearer token (worker API key). Shared secrets encrypted
with AES-256-GCM using ACB_ENCRYPTION_KEY.
2026-04-21 08:58:42 -04:00
jedarden
206189f914 feat(engine): integrate Monte Carlo win probability computation into match runner
Collect GameState snapshots during match execution (one per turn), then
run 100 random-play rollouts per snapshot post-match to compute per-turn
win probabilities and detect critical moments (|delta| > 0.15). Results
are stored in the replay JSON as win_prob and critical_moments fields.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 08:46:39 -04:00
jedarden
1d0a942e2e chore(ci): disable GitHub Actions — CI/CD is handled by Argo Workflows
GH Actions are not used in this project (all CI/CD runs on Argo Workflows
in iad-ci). The acb-build WorkflowTemplate handles builds; the index-builder
handles Cloudflare Pages deploys internally via wrangler.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:43:22 -04:00
jedarden
3b8bd66575 feat(acb-evolver): add Dockerfile for evolver container with multi-language runtime support
Installs Python 3, Node.js/TypeScript for bot validation sandbox.
Base image includes Go; Java/Rust/PHP validation is deferred to follow-up bead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:41:10 -04:00
jedarden
9850020c53 feat(web): win probability sparkline + critical moment navigation
Add §13.2 win probability graph and critical moment navigation to the
replay viewer.

- types.ts: add ReplayCriticalMoment interface; extend Replay with
  win_prob ([][]float per turn) and critical_moments fields
- replay-viewer.ts: export CriticalMomentMarker; draw dashed vertical
  lines with delta labels for critical moments on the sparkline canvas;
  add setCriticalMoments / getCriticalMomentMarkers; update
  createWinProbSparkline to accept click-to-scrub callback and replace
  existing canvas on reload; refresh sparkline on every render()
- app.ts: add win-probability section below main canvas with prev/next
  critical moment buttons, description label, and player legend;
  initWinProb converts win_prob array to WinProbPoint[] and wires up
  setCriticalMoments; graceful hide when win_prob absent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:36:42 -04:00
jedarden
72addb2089 feat(web): add Agentation feedback overlay for UI annotation
Mounts the Agentation React component (v3) as a thin overlay on the vanilla TS
app via a React root shim. The toolbar appears bottom-right and lets users click
any element, annotate it, and generate structured markdown for AI agent feedback.
Submissions are persisted in localStorage and POSTed to /api/ui-feedback when
the API is available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:26:00 -04:00
jedarden
dcdca5147f fix(index-builder): stream-copy web assets to avoid large-file OOM
Replace os.ReadFile+os.WriteFile with io.Copy so large files (e.g. the 21MB
demo-replay-v2-6p.json) are never fully loaded into RAM during copyWebAssets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 07:35:42 -04:00
jedarden
498cd0e5d7 fix(index-builder): include web frontend in Pages deployment
Add a web-builder stage to the Dockerfile (Vite/TS build) and copy the
resulting dist/ into the runtime image at /app/web/dist. Call copyWebAssets
each build cycle so HTML/JS/CSS is merged into the output dir before wrangler
deploys — previously only JSON data files were uploaded, causing CF Pages to
serve 404 at the root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 07:23:45 -04:00
jedarden
82d5ecba1f fix(index-builder): set wrangler CWD to /tmp for Pages deploy
wrangler creates .wrangler/tmp relative to its working directory.
The container runs as non-root user acb with WORKDIR=/app (root-owned),
so mkdir /app/.wrangler/tmp fails with EACCES. Setting cmd.Dir=/tmp
gives wrangler a writable CWD while keeping the /data output path
(absolute) unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 07:03:20 -04:00
jedarden
6743d1f670 fix(index-builder): use player_slot when comparing to matches.winner
matches.winner is an INTEGER (player slot), not a bot_id VARCHAR.
Fix two queries that compared mp.bot_id = m.winner (type mismatch)
to use mp.player_slot = m.winner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 23:37:22 -04:00