Skip to content

[Data-integrity] Transient yesterday-snapshot failure flags every user as NEW, erasing rank arrows #378

Description

@vedant7007

Problem

scripts/sync-leaderboard.jscomputeRankChanges() (~lines 203-231) starts with previousRanks = {} and only populates it if getYesterdaySnapshot() returned an array. That helper (~lines 194-200) returns null on any error.

Impact (data integrity / correctness)

On any network/GitHub-API error, rate-limit, or missing commit, getYesterdaySnapshot() returns null, previousRanks stays empty, and the loop hits previousRanks[user.id] === undefined for every user → sets user.rankChange = "NEW". One transient hiccup renders the whole leaderboard as [new] for all users with no up/down deltas, and it's persisted to JSON so it sticks until the next clean run.

Suggested fix (tiny)

If previousData is null / not an array, skip rank-change computation (leave prior rankChange/"=") instead of defaulting everyone to "NEW". Optionally distinguish "snapshot unavailable" from "genuinely new user."

Would love to take this under GSSoC '26.

Metadata

Metadata

Assignees

Labels

BackendTask mainly involving backendlevel:beginnerIndicates the difficultytype:bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions