Conversation
|
There was a problem hiding this comment.
Pull Request Overview
This hotfix adds support for injecting the Electron userData path into background workers by introducing a setUserDataPath API, refactors file utility usage, cleans up a leftover debug log, updates tests, and bumps the version.
- Introduce
setUserDataPathinfileUtilsand remove directappdependency. - Extend
WorkerMessageand propagateuserDataPathfrommain.tsinto both scan workers. - Remove stray
console.loginappDataCleaner, update tests for the new API, and bump version.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/developer-cleaner.ts | Adjust WorkerMessage to include userDataPath |
| src/main/main.ts | Call setUserDataPath early and pass it to workers |
| src/main/fileUtils.ts | Add setUserDataPath, guard path usage, remove app |
| src/main/developerScanWorker.ts | Switch to fileUtils import and apply userDataPath |
| src/main/appDataScanWorker.ts | Refactor imports, wire userDataPath into scanner |
| src/main/appDataCleaner.ts | Remove debug console.log |
| src/main/tests | Update tests to call setUserDataPath and adapt mocks |
| package.json | Bump version to 1.2.6 |
Comments suppressed due to low confidence (4)
src/main/fileUtils.ts:8
- [nitpick] The parameter
pathshadows the importedpathmodule. Consider renaming the parameter todataPathoruserDataDirfor clarity and to avoid confusion.
export function setUserDataPath(path: string) {
src/main/tests/fileUtils.test.ts:40
- Add a test case that verifies
getSavedFoldersPath()andgetSavedDeveloperProjectsPath()throw or error whensetUserDataPathhas not been called, to cover the new error branch.
setUserDataPath(mockUserDataPath);
src/main/tests/appDataScanWorker.test.ts:17
- The tests mock
setUserDataPathbut never assert it was called withmessage.userDataPath. Consider adding an assertion to verify the worker invokesfileUtils.setUserDataPathwith the correct argument.
setUserDataPath: vi.fn()
src/types/developer-cleaner.ts:34
- The
WorkerMessagetype was changed to only allow"stop"and made optional, removing the"scan"variant; this will break message dispatching. It should include both"scan"and"stop"(e.g.,type: "scan" | "stop";) while makingtypeoptional only if intended.
type?: "stop";
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.