Skip to content

[Bug] ISSUE-0021: rebuild live leaderboard and local E2E #33

Closed

Description

@lora-sys

Context

The latest local walkthrough exposed that the MVP completion claim is not supported by the current implementation or evidence:

  • Battle.sol correctly emits ChallengeCreated with only challengeId, challenger, and opponent indexed, but the backend ABI and parseAbiItem mark all five fields indexed.
  • handleChallengeResolved compares an address to a token ID, so winner/loser addresses are not derived correctly and leaderboard rows remain empty.
  • /leaderboard is still hard-coded demo data and explicitly says the live indexer is future work.
  • Monster detail screenshots show broken images despite committed PNG art.
  • The backend has no tests, CI only type-checks/builds it, and the current E2E evidence has no mobile, console, a11y, or resolved-live-leaderboard proof.

Goal

Deliver a reproducible fresh-Anvil flow from mint/hatch/train/battle through indexed API data and rendered live UI, with evidence strong enough to support the MVP acceptance claims.

Scope / allow-list

  • backend/**
  • frontend/**
  • .github/workflows/ci.yml
  • contracts/test/** only if an event-contract regression assertion is required
  • scripts/** for deterministic local E2E orchestration
  • docs/evidence/0021/**
  • PROJECT_STATUS.md, sessions/**, memory/**, docs/INDEX.md, ENGINEERING.md, TESTING.md for truthful status and durable lessons

Non-goals

Acceptance criteria

  • Backend event ABI exactly matches the Solidity event declarations; ChallengeCreated decodes both token IDs and both addresses from a real Anvil log without ad hoc topic assumptions.
  • ChallengeResolved maps winner/loser token IDs to the correct trainer addresses, awaits post-battle monster synchronization, and records turns/draw/transaction metadata.
  • Starting from a fresh SQLite DB after the battle has resolved replays history into one correct battle row and a non-empty leaderboard; restarting from the checkpoint is idempotent.
  • Backend has automated tests for event decoding, resolution mapping, leaderboard ranking, API validation, replay, and restart behavior; CI runs them.
  • Frontend leaderboard consumes the live backend API and implements loading, populated, empty, and unavailable states with no demo entries or Phase 2 placeholder copy.
  • Monster detail art uses committed assets and renders successfully for the E2E species/stage.
  • A one-command or documented deterministic local E2E run starts fresh Anvil, deploys contracts, executes two-wallet mint/hatch/train/battle, runs indexer/API/frontend, and asserts contract/API/UI state.
  • Desktop 1440x900 and mobile 390x844 screenshots prove the populated live leaderboard and monster details; browser console is clean and axe reports no serious/critical findings.
  • Contract tests, backend tests/typecheck/build, frontend tests/typecheck/lint/build, and GitHub CI pass.
  • PROJECT_STATUS.md and session/memory records match the verified state and distinguish local proof from pending testnet deployment.

Evidence requirements

Store change-summary.md, implementation-plan.md, raw test logs, API/contract traces, desktop/mobile screenshots, Playwright/axe results, reviewer reports, and verification.md under docs/evidence/0021/.

Reviewers

Required cold-start roles: bug-hunter, behavior-reviewer, architecture-reviewer, security-reviewer, and ui-reviewer. No Critical/High finding may remain open.

Activity

  1. added a commit that references this issue on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions