Severity
Critical — Silently corrupts leaderboard data without any error
Location
scripts/sync-leaderboard.js:100, 104, 145, 149, 190, 194
Description
Variables are assigned without declaration keywords. The file lacks "use strict",
so these become properties on the global object:
dailyData = JSON.parse(JSON.stringify(overallData)); // implicit global
previousData = []; // implicit global
weeklyData = JSON.parse(JSON.stringify(overallData)); // implicit global
monthlyData = JSON.parse(JSON.stringify(overallData)); // implicit global
If code paths run in parallel (Promise.all, async), shared global state causes
silent data corruption — wrong scores, swapped rankings, duplicate entries —
without any error being thrown.
Why It Matters
- Silent corruption is worse than a crash — users see incorrect rankings
- The sync script is the backbone of the entire application
- Three parallel blocks (daily/weekly/monthly) share the same implicit globals
- "use strict" would make this an immediate runtime error
Fix
"use strict";
let dailyData = JSON.parse(JSON.stringify(overallData));
let previousData = [];
let weeklyData = JSON.parse(JSON.stringify(overallData));
let monthlyData = JSON.parse(JSON.stringify(overallData));
Severity
Critical — Silently corrupts leaderboard data without any error
Location
scripts/sync-leaderboard.js:100, 104, 145, 149, 190, 194
Description
Variables are assigned without declaration keywords. The file lacks "use strict",
so these become properties on the global object:
If code paths run in parallel (Promise.all, async), shared global state causes
silent data corruption — wrong scores, swapped rankings, duplicate entries —
without any error being thrown.
Why It Matters
Fix