Skip to content

Issue: Missing Directory Creation Check for Daily Snapshots #406

Description

@Yashaswini-K-P

File Name

scripts/sync-leaderboard.js

Problem

While the script explicitly creates the user-data directory using fsPromises.mkdir({ recursive: true }) before writing files, it does not ensure that the daily directory (DATA_DIR/daily) exists. If the daily folder is missing (e.g., in a fresh repository clone or after a clean-up step), writing the daily snapshot via atomicWrite will crash with an ENOENT error.

Proposed Solution

Explicitly create the daily output directory recursively prior to writing daily JSON files, similar to how user-data is handled.

Implementation Details

  • Directory Initialization: Add a directory creation check before writing daily data:
    await fsPromises.mkdir(path.join(DATA_DIR, "daily"), { recursive: true });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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