Skip to content

fix(dashboard): resolve leaderboardView crash; isolate auth session tests - #31

Closed
rudra496 wants to merge 4 commits into
Riddlrealm:mainfrom
rudra496:fix/ci-red-tests
Closed

rudra496 wants to merge 4 commits into
Riddlrealm:mainfrom
rudra496:fix/ci-red-tests

Conversation

@rudra496

Copy link
Copy Markdown
Contributor

Follow-up to #30. With npm ci working again, CI's test step finally ran on main and surfaced 3 real failures (48/51 passing, run 32965733805):

1. ReferenceError: leaderboardView is not defined — Dashboard.tsx:164 (both Dashboard tests)

a85edcb (leaderboard backend rework) wired <Leaderboard view={...} /> but never declared the variable — the Dashboard page throws during render for every visitor. This wires up the existing useLeaderboard() hook exactly like LeaderboardPage.tsx:61 does, and drops mockLeaderboardPlayers which that rework left unused (tsc flags it with TS6133 under noUnusedLocals).

2. AuthService "fails closed when the response is missing token/user"

The success cases earlier in the file persist a real token; this case then read that stale entry instead of null. signIn itself validates before persisting — the gap was test isolation. Added localStorage.clear() in beforeEach.

Verification

  • tsc -p tsconfig.app.json --noEmit → clean
  • targeted vitest files can't run on my Windows/Node 26 box (local jsdom wiring quirk unrelated to these changes — even previously-green files fail locally), so CI here is the authoritative run

Merging this plus #30 gets main back to fully green, which also unblocks the pending checks on #26/#27.

npm ci has been failing on main since #24 (Install dependencies step,
run 32722050710) and still fails after #25. The lockfile was left
missing several entries that the tree requires: the istanbul chain used
by coverage (make-dir, html-escaper, nested semver), the vitest
coverage stack (@vitest/coverage-v8, @bcoe/v8-coverage,
ast-v8-to-istanbul, magicast), and a few nested helpers.

This adds back exactly those entries with registry metadata. No
dependency version changes - every existing pin is untouched, so
resolved behavior is identical to before #24.
… render

a85edcb wired <Leaderboard> to a view prop but never declared
leaderboardView, throwing ReferenceError during render (Dashboard.tsx:164)
— caught by the Dashboard tests once CI could run them again. Call the
existing useLeaderboard() hook like LeaderboardPage does, and drop the
mockLeaderboardPlayers import left unused by the same rework (TS6133).
The success cases persist a real token; the later fail-closed case then
read that stale entry instead of null. Clear storage in beforeEach so
the cases stay order-independent.
Copilot AI lite review requested due to automatic review settings August 26, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rudra496

Copy link
Copy Markdown
Contributor Author

Same story as #30: the Dashboard/test-isolation fixes here reached main via other merges, and the lockfile has since shifted under multiple PRs — a rebased version would be a third competing repair. Standing down; the two gameplay PRs this was unblocking are already merged and credited. 👍

@rudra496 rudra496 closed this Aug 27, 2026
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.

2 participants