Add While You Were Away session summary modal and indexer endpoint #338
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#338
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Gap analysis follow-up from #331.
Current codebase
/v1/arena/timers,/v1/arena/podiums,/v1/arena/buys,/v1/arena/activity,/v1/arena/wallet/{address}/stats, epoch pricing, WarBow feeds./v1/arena/platform-usage) but is unused on play (parent rejected wiring it — do not add intensity chip here).localStorageused for feature tutorial flags only.Why needed
Approved: when a player reopens the dapp after closing the browser, show a "While You Were Away" modal summarizing arena deltas since last visit. Storage is per browser (not per wallet): client persists last-close timestamp; indexer computes summary for
since=<ms>(and optional connected wallet for personalized rows).Constraints / guardrails
INV-FRONTEND-294shared primitives); screenshots on desktop, tablet, mobile required on this issue.localStoragekey e.g.yieldomega.arena.lastClosedAt.v1— not server-side browser tracking.since(+ optionalwallet) query params; no PII storage server-side beyond indexed chain data.since— winners, prizes; congratulate if connected wallet wonRelevant files
indexer/src/api_arena.rs(+ new module e.g.arena_session_summary.rs)idx_arena_buy, podium finalize / payout tables, wallet statsindexer/tests/integration_stage2.rsWhileYouWereAwayModal.tsxfrontend/src/pages/arena/ArenaSimplePage.tsxorTimeArenaPage.tsxfrontend/src/lib/indexerApi.tsvisibilitychange/pagehideto persist close timeRecommended direction
GET /v1/arena/session-summary?since_ms=<unix_ms>&wallet=<optional>returning JSON:elapsed_ms,total_buys,unique_players,podium_epochs_ended[](podium, epoch, winners, prizes),wallet_summary?(rank_delta, wins, buy_count).block_timestamp >= sincewith sane caps (limit epochs / rows).lastClosedAtexists and age > threshold (e.g. 60s), fetch summary and open modal once per session; updatelastClosedAton tab close.Acceptance criteria
Test plan
cd indexer && cargo testYIELDOMEGA_PG_TEST_URL=... cargo test --test integration_stage2cd frontend && npm run typecheck && npm run lint && npm testbash scripts/verify-podium-live-anvil.shcd frontend && CI=1 npm run test:e2e -- --workers=5 e2e/anvil-arena-03-wallet-writes.spec.tsHappy: activity between visits → modal populated. Sad:
since_msin future → empty summary; indexer down → no modal / graceful skip.Attack / abuse test plan
since_msclamped (reject >30d ago or future skew abuse); limit response size.walletparam uses existing address validation.Verification criteria
lastClosedAt, run Anvil buy swarm, reload → modal shows buy count > 0.curlsession-summary with fixturesince_msreturns expected JSON keys.mentioned in issue #331
mentioned in merge request !511
Implementation complete — MR !511
Merge request: https://gitlab.com/PlasticDigits/yieldomega/-/merge_requests/141
Verified (PASS)
cd indexer && cargo testYIELDOMEGA_PG_TEST_URL=postgres://yieldomega:password@127.0.0.1:5433/yieldomega_indexer_test cargo test --test integration_stage2 arena_session_summary_fixture_since_activitycd frontend && npm run typecheck && npm run lint && npm testbash scripts/verify-podium-live-anvil.shdocs/testing/screenshots/issue-338/{desktop,tablet,mobile}.pngScreenshots
docs/testing/screenshots/issue-338/desktop.pngdocs/testing/screenshots/issue-338/tablet.pngdocs/testing/screenshots/issue-338/mobile.pngRegenerate:
cd frontend && CI=1 npm run test:e2e -- --workers=1 e2e/wywa-modal-screenshots.spec.tsOptional (not run)
cd frontend && CI=1 npm run test:e2e -- --workers=5 e2e/anvil-arena-03-wallet-writes.spec.tsIssue left open for MR review/merge.
mentioned in commit
a7d3b64ee4mentioned in commit
0fdf405b4eVerification complete — issue #338
Verified on
mainat8821b2df(MR !511 merged). Independent QA pass of acceptance criteria, test plan, attack/abuse checks, and invariants.Acceptance criteria
localStorage)cd frontend && npm test -- src/lib/arenaSessionClose.test.ts— keyyieldomega.arena.lastClosedAt.v1,visibilitychange/pagehidelistenersarena_session_summary_fixture_since_activity(total_buys=2, podium_epochs_ended len=1);WhileYouWereAwayModal.test.tsx(elapsed, aggregates, rank delta)readArenaLastClosedAt()null →useWhileYouWereAwayno-op; covered inarenaSessionClose.test.tsWhileYouWereAwayModal.test.tsxassertsdata-testid="wywa-congrats"docs/testing/screenshots/issue-338/{desktop,tablet,mobile}.pngpresent in repoindexer/README.md§ session-summary,docs/indexer/design.md,docs/frontend/arena-views.md, invariantsINV-INDEXER-338-SESSION-SUMMARY/INV-FRONTEND-338-WYWA-MODALTest plan
cd indexer && cargo testYIELDOMEGA_PG_TEST_URL=postgres://yieldomega:password@127.0.0.1:5433/yieldomega_indexer_test cargo test --test integration_stage2 arena_session_summary_fixture_since_activitycd frontend && npm run typecheck && npm run lint && npm testbash scripts/verify-podium-live-anvil.shread_block=24,live_rows=12)cd frontend && CI=1 npm run test:e2e -- --workers=5 e2e/anvil-arena-03-wallet-writes.spec.tsVerification criteria (manual / curl)
curlGET /v1/arena/session-summary?since_ms=…&wallet=0x…— JSON keyselapsed_ms,total_buys,unique_players,podium_updates,podium_epochs_ended,wallet_summary:3100)since_ms(>60s skew) → 400since_ms_in_futurewallet→ 400invalid_addresstotal_buys=2+ modal unit test; full headed Rabby reopen not re-run)Attack / abuse
since_msclamped to 30d; future skew rejectedarena_session_summary::tests::*, integration smoke, live curl)walletusesvalid_0x_address20Screenshots
docs/testing/screenshots/issue-338/desktop.pngdocs/testing/screenshots/issue-338/tablet.pngdocs/testing/screenshots/issue-338/mobile.pngRegenerate:
cd frontend && CI=1 npm run test:e2e -- --workers=1 e2e/wywa-modal-screenshots.spec.tsClosing — all criteria pass on merged
main; no follow-up MR from this verification pass.mentioned in commit
916025477amentioned in merge request !514
mentioned in issue #339
mentioned in merge request !515
mentioned in issue #340
mentioned in issue #342
mentioned in issue #364
mentioned in issue #365