Skip to content

fix(analyze): zero disk usage instead of apparent size for online-only files - #692

Open
AdamMagued wants to merge 1 commit into
dundee:masterfrom
AdamMagued:fix-issue-688-onedrive-online-only
Open

AdamMagued wants to merge 1 commit into
dundee:masterfrom
AdamMagued:fix-issue-688-onedrive-online-only

Conversation

@AdamMagued

Copy link
Copy Markdown
Contributor

Fixes #688.

Problem

In #609, support was added to detect cloud "online-only" files (such as OneDrive placeholders) via Windows file attributes FILE_ATTRIBUTE_RECALL_ON_OPEN (0x100000) and FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS (0x400000). However, setPlatformSpecificAttrs set file.Size = 0 (apparent size) instead of zeroing file.Usage (disk usage), while keeping file.Usage = f.Size(). Consequently:

  1. Online-only files were still reported with full allocated disk usage in default views, exports, and directory rollups.
  2. The apparent size was cleared to 0 instead of retaining the logical length.
  3. Auxiliary helpers getPlatformSpecificUsageAndMli and getSyscallStats did not account for recall flags when querying file usage.

Solution

  • Updated setPlatformSpecificAttrs in pkg/analyze/dir_other.go to preserve file.Size and set file.Usage = 0 when isRecallFile evaluates to true.
  • Updated getPlatformSpecificUsageAndMli and getSyscallStats to return usage = 0 for files matching recall attributes.
  • Added unit tests in pkg/analyze/dir_other_test.go covering regular files, recall on open, recall on data access, combined attributes, and fallback behavior.

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.74%. Comparing base (387cf50) to head (e67d225).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #692      +/-   ##
==========================================
+ Coverage   90.73%   90.74%   +0.01%     
==========================================
  Files          76       76              
  Lines        6843     6843              
==========================================
+ Hits         6209     6210       +1     
  Misses        633      633              
+ Partials        1        0       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Windows: online-only OneDrive files still counted as disk usage after #609 (Size zeroed instead of Usage)

1 participant