feat(storage): consolidate lifecycle safeguards#944
Closed
luoye520ww wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 14, 2026
Collaborator
Author
|
Superseded by #941, which now contains the same storage lifecycle safeguards together with the validated packaging/CI smoke fix. Closing this duplicate to keep review scope consolidated. |
Collaborator
Author
|
Superseded by #941. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Storage-related capabilities were split across three small branches, making review noisy and leaving the usage scanner without a root symlink boundary.
Root cause
The usage scanner used
lstatfor child entries but opened the configured root directly. A symlink or junction supplied as the root could therefore be followed before the safety check.Scope
This PR consolidates the storage usage report, safe cleanup policy, and data-retention contract into one reviewable storage-lifecycle change. It does not delete data, add UI, or perform migrations.
Changes
Safety
lstatis used before opening roots and child entries.Typecheck
npm.cmd run typechecknpm.cmd --prefix kun run typecheckBoth passed.
Tests
npm.cmd exec vitest run src/main/services/storage-usage-report.test.ts src/main/services/storage-cleanup-policy.test.ts src/shared/data-retention.test.tsActual validation
Used real temporary directories and files, including a symlink root, nested files, missing roots, and bounded traversal. The scanner remained read-only and did not traverse the linked target.
Review performed
PR size
Non-goals
Automatic cleanup, retention UI, backup integration, and database repair remain separate follow-ups.
Supersedes