Summary
Add a --dry-run flag to parler cleanup that shows what would be deleted without actually removing anything. This is a safe, confidence-building option for operators running cleanup in production environments.
Background
parler cleanup currently prunes stale run bundles and temp audio files immediately when invoked. There is no way to preview what will be removed before committing. A --dry-run mode is a standard UX pattern for any destructive CLI command and makes the tool easier to trust.
What to implement
Add a --dry-run flag to the cleanup command in parler/cli.py:
# Preview only — prints what would be removed, removes nothing
parler cleanup --dry-run --older-than-days 7
# Current behaviour unchanged
parler cleanup --older-than-days 7
Expected dry-run output (text mode):
[dry-run] Would remove 3 run bundle(s) and 1 temp audio file(s) older than 7.0 day(s).
Expected dry-run output (--json mode):
{
"dry_run": true,
"older_than_days": 7.0,
"would_remove_runs": 3,
"would_remove_temp_audio": 1
}
When --dry-run is set, the function should call the existing prune_* helpers with a counting approach but skip deletion — or add a dry_run=True parameter to prune_run_summaries and prune_managed_audio_files in parler/runlog.py and parler/audio/ingester.py.
Files to look at
| File |
What to understand |
parler/cli.py — cleanup command (~line 956) |
Where to add the --dry-run option and conditional logic |
parler/runlog.py — prune_run_summaries() |
The existing prune logic to make dry-run-aware |
parler/audio/ingester.py — prune_managed_audio_files() |
Same, for temp audio |
tests/unit/test_cli_commands.py — TestOperationalCommands |
Where to add tests |
Acceptance criteria
Setting up
git clone https://github.com/AbdelStark/mistral-parler && cd mistral-parler
uv sync --locked --group dev
uv run parler doctor # verify environment
uv run pytest tests/unit/test_cli_commands.py -q # confirm baseline
Tips for first-timers
- All CLI commands use Click. Adding a boolean flag is a one-liner:
@click.option("--dry-run", is_flag=True, help="...")
- The
cleanup command already receives runs: bool and temp_audio: bool flags — pattern your dry-run logic similarly
- Use
CliRunner from click.testing for tests (see existing test_runs_list_show_and_cleanup for a reference)
Summary
Add a
--dry-runflag toparler cleanupthat shows what would be deleted without actually removing anything. This is a safe, confidence-building option for operators running cleanup in production environments.Background
parler cleanupcurrently prunes stale run bundles and temp audio files immediately when invoked. There is no way to preview what will be removed before committing. A--dry-runmode is a standard UX pattern for any destructive CLI command and makes the tool easier to trust.What to implement
Add a
--dry-runflag to thecleanupcommand inparler/cli.py:Expected dry-run output (text mode):
Expected dry-run output (
--jsonmode):{ "dry_run": true, "older_than_days": 7.0, "would_remove_runs": 3, "would_remove_temp_audio": 1 }When
--dry-runis set, the function should call the existingprune_*helpers with a counting approach but skip deletion — or add adry_run=Trueparameter toprune_run_summariesandprune_managed_audio_filesinparler/runlog.pyandparler/audio/ingester.py.Files to look at
parler/cli.py—cleanupcommand (~line 956)--dry-runoption and conditional logicparler/runlog.py—prune_run_summaries()parler/audio/ingester.py—prune_managed_audio_files()tests/unit/test_cli_commands.py—TestOperationalCommandsAcceptance criteria
parler cleanup --dry-runprints what would be removed and exits 0--dry-runis set--dry-runcomposes correctly with--older-than-days,--runs,--no-runs,--temp-audio,--no-temp-audio--dry-run --jsonemits a JSON object with a"dry_run": truekey alongside the countsruff checkandruff format --checkpassSetting up
Tips for first-timers
@click.option("--dry-run", is_flag=True, help="...")cleanupcommand already receivesruns: boolandtemp_audio: boolflags — pattern your dry-run logic similarlyCliRunnerfromclick.testingfor tests (see existingtest_runs_list_show_and_cleanupfor a reference)