Skip to content

Add deterministic practiceLog pruning for Bengali progress storage#53

Open
robirahman wants to merge 1 commit intomainfrom
codex/add-log-pruning-for-practice-logs
Open

Add deterministic practiceLog pruning for Bengali progress storage#53
robirahman wants to merge 1 commit intomainfrom
codex/add-log-pruning-for-practice-logs

Conversation

@robirahman
Copy link
Owner

Motivation

  • Prevent unbounded growth of progress.practiceLog by keeping the stored daily XP history bounded and deterministic.
  • Ensure stored keys are strict YYYY-MM-DD dates and remove invalid or stale entries so progress storage is predictable and safe to persist.

Description

  • Add prunePracticeLog(log, maxDays = 365) which enforces YYYY-MM-DD keys, validates calendar dates, computes a UTC-based cutoff window, sorts keys deterministically, and returns a pruned object containing only recent entries.
  • Run pruning during load inside _loadProgressLS and mark the loaded data as mutated so migrated/pruned logs are persisted back with _saveProgressLS.
  • Run pruning immediately before writing in _saveProgressLS so writes remain bounded over time.

Testing

  • Ran node --check bengali/app.js which completed successfully indicating the updated file parses without syntax errors.

Codex Task

@github-actions
Copy link
Contributor

Failed prettier code check. Check this file for more information.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant