Desktop: Use the OS temp directory for CEF caches#4030
Merged
timon-schelling merged 2 commits intomasterfrom Apr 15, 2026
Merged
Desktop: Use the OS temp directory for CEF caches#4030timon-schelling merged 2 commits intomasterfrom
timon-schelling merged 2 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors CEF instance directory management by introducing a TempDir utility that leverages the Drop trait for automatic cleanup, replacing the previous manual implementation. It also adds global temporary directory cleanup on application startup and handles legacy data removal. Review feedback suggests improving the robustness of the directory clearing logic by avoiding panics, optimizing the generation of random suffixes, and preventing potential panics during the teardown of multithreaded contexts.
Contributor
There was a problem hiding this comment.
5 issues found across 8 files
Confidence score: 2/5
- There are multiple high-confidence, user-impacting risks in teardown and temp directory handling, so merge risk is elevated rather than minimal.
- Most severe: in
desktop/src/dirs.rs, usingcreate_dir_allforTempDircan adopt an existing directory and delete it on drop; switching tocreate_diravoids that destructive behavior. desktop/src/cef/context/multithreaded.rsanddesktop/src/dirs.rsstill have panic paths (unwrap()inDrop, panic on temp cleanup read failure) that can crash shutdown/startup flows instead of failing gracefully.- Pay close attention to
desktop/src/dirs.rs,desktop/src/cef/context/multithreaded.rs,desktop/src/persist.rs,desktop/src/cef/context/singlethreaded.rs- teardown/cleanup paths can panic, skip cleanup, or leave stale cache/temp data.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="desktop/src/dirs.rs">
<violation number="1" location="desktop/src/dirs.rs:14">
P2: Avoid panicking on temp cleanup read failures; log and return so startup can continue.</violation>
<violation number="2" location="desktop/src/dirs.rs:64">
P1: Use `create_dir` (not `create_dir_all`) so `TempDir` creation fails when the target path already exists; otherwise a pre-existing directory can be adopted and then deleted on drop.</violation>
</file>
<file name="desktop/src/persist.rs">
<violation number="1" location="desktop/src/persist.rs:123">
P2: The old CEF cache cleanup is gated behind successful state loading, so it is skipped on common early-return paths (missing/corrupt state file). Move this cleanup outside the success-only path so stale cache data is consistently removed.</violation>
</file>
<file name="desktop/src/cef/context/singlethreaded.rs">
<violation number="1" location="desktop/src/cef/context/singlethreaded.rs:15">
P2: Temp directory cleanup is now single-shot; if CEF still holds file handles during shutdown, cache directories can be left behind.</violation>
</file>
<file name="desktop/src/cef/context/multithreaded.rs">
<violation number="1" location="desktop/src/cef/context/multithreaded.rs:62">
P1: Avoid `unwrap()` in `Drop`; a channel disconnect here can panic during teardown.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
No description provided.