Skip to content

Cache files that cannot save space with WOF compression - #25

Draft
marcmy wants to merge 1 commit into
agent/harden-background-compressor-stallsfrom
agent/cache-not-beneficial-files
Draft

Cache files that cannot save space with WOF compression#25
marcmy wants to merge 1 commit into
agent/harden-background-compressor-stallsfrom
agent/cache-not-beneficial-files

Conversation

@marcmy

@marcmy marcmy commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • persist files for which WofSetFileDataLocation returns ERROR_COMPRESSION_NOT_BENEFICIAL
  • skip unchanged cached files on later manual and background compression runs
  • key cache entries by file path and WOF compression algorithm
  • automatically invalidate a cached entry if the file size or last-write timestamp changes
  • keep the cache in CompactGUI's existing LocalAppData folder as compression-not-beneficial.json

Why

Windows documents ERROR_COMPRESSION_NOT_BENEFICIAL as the WOF result used when compression was attempted but saved no disk space. Retrying the same unchanged file with the same algorithm on every run only wastes time.

Behavior

The first non-beneficial attempt still appears as a failed file for that run and is written to the cache. Future normal compression work-list builds omit that unchanged file for the same algorithm. If the file changes, or the user selects another WOF algorithm, CompactGUI tries it again.

Explicit file lists are intentionally not filtered by this cache so restore/undo operations are never blocked by a cached compression result.

Scope

This PR is stacked on #23 because both modify CompactGUI.Core/Compactor.cs. Relative to #23 it changes only:

  • CompactGUI.Core/Compactor.cs
  • CompactGUI.Core/CompressionNotBeneficialCache.cs

After #23 merges, this PR can be retargeted to master without carrying unrelated changes.

Validation

  • clean final head built against master to exercise the repository's PR build workflow
  • Windows x64 restore: passed
  • self-contained publish: passed
  • packaging and artifact upload: passed
  • supply-chain audit: passed

Runtime checks

  1. Compress a file that reports "Compressing this object would not save space."
  2. Run compression again with the same algorithm and unchanged file; verify it is absent from the work list.
  3. Modify/replace the file and run again; verify it is tried again.
  4. Switch compression algorithm and verify the file is tried under the new algorithm.
  5. Restart CompactGUI and verify the unchanged file remains skipped.

@marcmy
marcmy changed the base branch from agent/harden-background-compressor-stalls to master August 18, 2026 10:05
@marcmy
marcmy force-pushed the agent/cache-not-beneficial-files branch from d5e77e0 to 121b3b9 Compare August 18, 2026 10:07
@marcmy
marcmy changed the base branch from master to agent/harden-background-compressor-stalls August 18, 2026 10:09
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