Skip to content

feat(stats): server Stats page, character Lifetime panel + live stat Explorer - #178

Merged
VortexUK merged 2 commits into
mainfrom
feat/server-stats
Jul 25, 2026
Merged

feat(stats): server Stats page, character Lifetime panel + live stat Explorer#178
VortexUK merged 2 commits into
mainfrom
feat/server-stats

Conversation

@VortexUK

Copy link
Copy Markdown
Owner

Summary

Adds a per-server Stats section built on the census character.stat aggregate family, plus a live per-character stat Explorer.

/stats page — Server Records tab

  • Population + aggregate date header, server lifetime totals (kills, deaths, quests, collections, crafts, rares)
  • Class population distribution bars + class averages table with global K/D comparison
  • 7 named leaderboards (kills, deaths, K/D with 1,000-kill floor, biggest melee/magic hit, crafts, rare harvests). Two-key hit records can't census-sort — resolved via range-filter near the aggregate max + client-side sort.

/stats page — Explorer tab

"Show me the highest ABMod Templars": live top-20 by whitelisted stat with optional class scope.

  • Combat snapshots (stats.combat.*, health/power): ability mod, potency, crit bonus/chance, multi attack, DPS mod, attack speed, flurry, block chance, strikethrough, max HP/power
  • Progression scalars: quests/collections completed, achievement points/completed, AA points spent — projected narrowly (c:show=achievements would drag the 500+-item list)
  • Lifetime statistics.*: kills, deaths, K/D, crafts, rare harvests
  • Class filter uses numeric type.classid (string type.class filters silently return empty)

Character sheet

  • New Lifetime panel: kills/deaths/K:D, biggest hits with ability names resolved via spells.db crc lookup, crafts, rares + class-average comparison line

Resilience

  • /api/stats/server never builds inline: cold cache → 202 {building} + lock-deduped background build, startup prewarm, 60s failure cooldown → 503; frontend polls every 5s
  • Explorer: 15-min cache per world+stat+class, stale-beats-error
  • Stats page rides out transient connection failures (server restart/deploy) with retries instead of dead-ending

Test plan

  • 12 backend tests (payload shaping vs committed classes.db, 202/503 lifecycle, crc ability resolution vs real spells.db, explore whitelist/classid/kd-floor/narrow-projection/cache/stale-beats-error)
  • 5 frontend tests (full render, 503, 202→poll→data, network-retry recovery, explorer tab + class narrowing)
  • Live smokes against Wuoshi: all 7 leaderboards named; explorer verified for ABMod Templars, potency, K/D, achievement points, quests (Templar-scoped), AA points, collections
  • Full gates: 1623 backend / 250 frontend tests, ruff + pyright + tsc clean

🤖 Generated with Claude Code

VortexUK and others added 2 commits July 25, 2026 12:54
…Explorer

Server-wide statistics from the census character.stat aggregate family plus
a live per-character stat explorer:

- GET /api/stats/server: population, class distribution, lifetime totals,
  named leaderboards (7 boards; two-key hit records via range-filter +
  client-side sort), class averages w/ global comparison. Never builds
  inline - cold cache answers 202 {building} and kicks a lock-deduped
  background build; startup prewarm; failed build -> 60s cooldown -> 503.
- GET /api/stats/character/{name}: lifetime panel on the character sheet
  (kills/deaths/K:D/biggest hits with ability names via spells.db crc
  lookup, crafts, rare harvests + class-average comparison line).
- GET /api/stats/explore?stat=&cls=: live top-20 by whitelisted stat -
  combat snapshots (stats.combat.*/health/power), progression scalars
  (quests/collections/achievements/AA points spent, projected narrowly),
  lifetime statistics.*. Class scope via numeric type.classid (string
  class filters silently return empty). 15-min cache, stale-beats-error.
- /stats page: Server Records + Explorer tabs, 202 polling, transient
  network failures retry instead of dead-ending.
- CensusClient: stat aggregate/leader/range/statistics/worldid methods.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…RSC CSRF

GHSA-qwww-vcr4-c8h2 (published 2026-07-24) flags react-router >=7.12.0
<8.3.0 for an RSC-mode CSRF bypass. Not applicable here - the app is a
client-only SPA (BrowserRouter, no RSC/server actions) - and no 7.x patch
exists; the fix is the react-router 8 major.

npm audit has no native ignore flag, so the CI step now mirrors the
.pip-audit-ignore pattern: frontend/.npm-audit-ignore lists GHSA IDs with
rationale; only unallowlisted high/critical advisories fail the build.
A missing/errored audit report still fails loudly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VortexUK
VortexUK merged commit 952a03a into main Jul 25, 2026
6 checks passed
@VortexUK
VortexUK deleted the feat/server-stats branch July 25, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant