Repository navigation
feat(machine-health): add the storage-top-n check - #8922
Conversation
Size the folders directly under the profile and the reclaim locations and list the 15 largest per root as mutable folder items. The walk is a manual directory stack that never descends a cloud sync root or another reparse directory and never opens an enumerated file outside the allocated-size pass; each skipped sync root is listed with no size. One 60 s budget in Measure-FolderSize covers the scan and the allocated pass, shared equally across roots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…place Test-StorageTopN.ps1 now holds the budget, top-N and allocated file cap and passes them to Measure-FolderSize, which no longer defaults them. The skip and cloud-attribute masks are named values that the code, its comments and the check's commands read. Each root and folder record carries the caller's root string as `input`, so the check joins reclaim hints without re-normalizing paths. A root itself goes through Test-FolderDescent, budget checks share one form, and Test-PathUnder is the one path-prefix rule. The catalog names attributes only and cites the SKILL.md per-check timeout. Adds a junction-root case and an end-to-end check run over a TestDrive tree through a test-only -RootPath override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b71fb3b0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed No security issues found in the incremental change since 5b71fb3 (5 files). I read
No command, path or template injection, credential handling, or authorization surface is touched. The instruction-surface lens had nothing to check, because no standing instruction or guardrail was removed. |
|
claude-review reviewed No findings: the incremental changes since 5b71fb3 hold up on a read of the code. I did not run the Pester suite; the Windows-only tests and the OneDrive probe in the PR body are author-claimed and unverified by me. Placeholder handling. The enumeration no longer skips placeholders. Instead a directory carrying Offline, RECALL_ON_OPEN or RECALL_ON_DATA_ACCESS is refused in Files-only root. Wrapping the child walk in Removed budget pre-check. The check in the root listing is gone, so a spent budget now opens the directory before stopping. A spent budget with an empty root leaves Tests. The new Offline directory and Offline file cases assert both the count and that |
…in storage-top-n The enumeration no longer skips placeholder attributes, so a directory carrying Offline or a RECALL bit reaches the never-descend rule and is counted instead of vanishing; placeholder files are filtered per entry and never sized. Each root's listing is consumed lazily so the budget can cut it, and a root with no subfolders no longer adds a null folder entry. Test paths use an X:\Profile placeholder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No related issue: Phase 4 of the owner-approved machine-health PC-checkup plan (ADR 0081, #8906; builds on #8917).
Summary
Adds
storage-top-n, which answers "what's eating my storage". It lists the 15 largest folders under each reclaim location and the user profile as mutable FindingItems of kindfolder, each with a reclaim hint.The scan never downloads OneDrive cloud-only files. It never descends a reparse directory or a cloud sync root, and it never opens a file it enumerates. Each sync root it skips is listed as one item, "skipped: cloud sync root", with no size.
Fix
lib/Measure-FolderSize.ps1walks each root with a manual directory stack.AttributesToSkipcovers Offline plus both RECALL bits, and never Hidden, System or ReparsePoint.GetCompressedFileSizeW. It never runs on a file that is itself a reparse point.allocated_bytes = null.checks/Test-StorageTopN.ps1holds its numbers once (budget, top-N, file cap) and passes them to the adapter. The summary and command text interpolate them. It declares-MutedKeys.scan_complete,allocated_complete,inaccessible_count,skipped_reparse_dirs,skipped_sync_roots,items_count,muted_count.storage-top-n(categorystorage,needs_admin: false) andcheck-catalog.mdsection 20. Section 20 states the OneDrive rule as a decision plus a pointer, with an as-of date and a recheck trigger.minor).Verification
run-tests.ps1exits 0: 654 passed, 0 failed, 1 skipped. TheMeasure-FolderSizesuite passes 22 tests andTest-StorageTopN10. One test is unmocked and runs over a TestDrive tree.skipped_reparse_dirs= 1);$env:OneDriveis never descended and is listed as one skipped item;inaccessible_count;scan_complete = false;allocated_bytes = null;allocated_bytes = null;Get-Content,OpenRead,LinkTargetorResolveLinkTarget, and the check contains noStopwatch.OneDriveandOneDriveCommercial, withskipped_sync_roots = 1. That means the refusal path ran and nothing was downloaded.-DryRun) exits 0, andstorage-top-nran inelapsed_ms=40403, under the 75,000 ms ceiling against the 90 s dispatch timeout.Related
The next checks (startup items, app last-use, Defender, intruder inventories, top processes, backup) follow the same FindingItem contract.
🤖 Generated with Claude Code