Real-Time Backup State
As a user, I want to see the state of my backups updated in real-time in a file, So that I can continuously monitor the progress of my backup jobs.
Given data is present in the update queue,
When the write interval is reached (e.g., 500ms),
Then the state.json file is updated in a single disk write operation.
Given an inactive backup job,
When the state file is generated,
Then the fields specific to active jobs (remaining files, progress, paths) are either not generated or set to zero.
Given the state.json file is generated,
When it is opened in a basic editor like Notepad,
Then it contains readable line breaks between the JSON elements.
Given a backup job starts or stops,
When the state file is generated,
Then the "State" field clearly indicates "Active" or "Inactive" and the "Last action timestamp" is updated.