Skip to content

Bug: Manifest backup files accumulate indefinitely with no cleanup #4

Description

@Vishwaspatel2401

Description

Every time discover runs, a timestamped backup of the manifest is created
(e.g. manifest.json.backup-1234567890) but old backups are never cleaned up.
On long-running systems this causes unbounded disk growth.

Affected File

  • src/commands/discover.js

Expected Behavior

Old backups should be pruned automatically — for example, keep only the last
5 backups or delete backups older than 30 days.

Suggested Fix

After creating a new backup, scan for existing backups and remove all but the
most recent N (e.g. 5):

const backups = fs.readdirSync(manifestDir)
  .filter(f => f.startsWith('manifest.json.backup-'))
  .sort()
  .slice(0, -5); // keep last 5
backups.forEach(f => fs.unlinkSync(path.join(manifestDir, f)));

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions