Skip to content

Fix manual compression resume lifecycle - #24

Draft
marcmy wants to merge 6 commits into
masterfrom
agent/fix-manual-resume-state
Draft

Fix manual compression resume lifecycle#24
marcmy wants to merge 6 commits into
masterfrom
agent/fix-manual-resume-state

Conversation

@marcmy

@marcmy marcmy commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • make saved manual-compression checkpoints belong to the folder rather than only to the add-folder flow
  • when a folder remains in Home after Save progress, Compress again followed by Compress Selected now loads the saved checkpoint instead of starting with a fresh progress baseline
  • when adding a folder with saved progress and choosing Resume, prepare the folder for resumed compression but do not start immediately
  • after choosing Resume on add, keep the folder in the pending/Idle state so the user can explicitly start it with Compress Selected
  • restore the saved compression options whenever a checkpoint is consumed
  • when an action would actually exit CompactGUI during an active manual compression run, show the existing compression stop dialog before shutdown
  • wait for Save Progress / Leave As Is cleanup to finish before exiting; choosing Cancel aborts the exit and resumes the compression if it was paused for the dialog
  • remove Undo Progress from the stop dialog to avoid accidental decompression; users can still uncompress manually afterward
  • stop a multi-folder manual batch after the current folder when exit has been requested, so shutdown cannot silently advance into the next selected folder

Root cause

The resume implementation introduced in PR #7 passed SavedCompressionSession objects only from AddFoldersAsync into CompressFoldersAsync. A folder that stayed in the Home list after saving progress therefore had no resume session when Compress again was used, while the add-folder Resume path explicitly invoked CompressFoldersAsync immediately.

The exit paths were also independent of the manual compression lifecycle: tray Exit and true window-close exits could reach Application.Current.Shutdown() without first asking the active Core.Compactor to stop and persist/leave its current work.

Expected behavior after this change

Resume without removing the folder

  1. Start manual compression from Home.
  2. Stop and choose Save progress.
  3. Leave the folder in the Home list.
  4. Click Compress again, then Compress Selected.
  5. Compression resumes using the saved checkpoint/progress baseline.

Resume after re-adding

  1. Add a folder that has saved progress.
  2. Choose Resume in the resume dialog.
  3. The folder is added and prepared, but compression does not start yet.
  4. Click Compress Selected to begin the resumed run.

Stop / exit during manual compression

  1. Start a manual compression run.
  2. Stop it, or use an action that actually exits CompactGUI while it is active.
  3. CompactGUI pauses the active run and shows the stop dialog.
  4. Save Progress preserves a resumable checkpoint; Leave As Is stops without undoing already-compressed files.
  5. The dialog's cancel/X choice cancels the stop/exit and returns to the active compression run.
  6. Undo Progress is intentionally not offered here; decompression remains available through the normal Uncompress action.

Normal window close-to-tray behavior for watched folders is unchanged because that action does not exit the app.

Scope

  • CompactGUI/ViewModels/HomeViewModel.vb
  • CompactGUI/ViewModels/MainWindowViewModel.vb
  • CompactGUI/Services/WindowService.vb
  • no Core compressor changes
  • no background-compressor changes

Validation

  • Windows x64 restore: passed
  • self-contained publish: passed
  • packaging and artifact upload: passed
  • supply-chain audit: passed

Runtime checks

  • Save progress, keep folder loaded, Compress again -> Compress Selected; verify progress resumes rather than resetting
  • Remove/re-add a folder with saved progress, choose Resume; verify it waits for Compress Selected
  • Choose Discard Saved Progress; verify later compression starts fresh
  • Complete a resumed run; verify the checkpoint is removed as before
  • Verify the stop dialog no longer offers Undo Progress
  • Exit during active manual compression, choose Save Progress; verify shutdown occurs only after the checkpoint is written
  • Exit during active manual compression, cancel the stop dialog; verify shutdown is cancelled and compression resumes
  • Test Leave As Is through the exit path and verify it does not undo already-compressed files
  • With multiple folders selected, request exit during the first active folder and verify the batch does not begin the next folder

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant