Migrate hierarchical preferences storage#489
Conversation
WalkthroughThis PR refactors preference storage to a namespaced ChangesPreference namespace migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.23.0)owlplug-client/src/main/java/com/owlplug/core/controllers/options/InstallationOptionsController.java┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.30][ERROR]: unable to find a config; path owlplug-client/src/main/java/com/owlplug/core/controllers/options/PluginScanOptionsController.java┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.30][ERROR]: unable to find a config; path owlplug-client/src/main/java/com/owlplug/core/controllers/options/ProjectsOptionsController.java┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.15][ERROR]: unable to find a config; path
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
owlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.java (1)
217-217: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueConfirm the default-format fallback is intentional. When
formatmatches none of the branches, the method falls back to the VST2 directory rather than an empty/neutral path. This preserves prior behavior, but worth confirming it's still desired post-migration.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@owlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.java` at line 217, The fallback in PluginService#getPluginDirectory currently returns the VST2 preference when format does not match any branch, so confirm this legacy default is still intended after migration. If not, update the method’s default path to a neutral/empty result or a format-appropriate fallback, and keep the behavior aligned with the other format-specific branches in PluginService.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@owlplug-client/src/main/java/com/owlplug/core/controllers/MainController.java`:
- Line 149: `Prefs.Auth.SELECTED_ACCOUNT` is being used as a long account id in
`MainController` and must not be initialized as a boolean anywhere else. Update
the `OptionsService` seeding path so the same preference key is stored as a long
sentinel value (for example an unset account id) or left unset until selection,
and keep the `MainController` read/write logic consistent with
`getLong()`/`putLong()` semantics.
In
`@owlplug-client/src/main/java/com/owlplug/core/controllers/options/PluginScanOptionsController.java`:
- Line 135: The `LOADER_TIMEOUT` default is inconsistent between
`PluginScanOptionsController` and `NativeHostService.init()`, so unify the
fallback value used when reading `Prefs.Plugins.NativeHost.LOADER_TIMEOUT`.
Update the timeout read in `PluginScanOptionsController` to use the same
centralized default as the runtime path, or extract a shared constant/helper for
the default so both the UI and `NativeHostService` always show and apply the
same value.
In `@owlplug-client/src/main/java/com/owlplug/core/services/OptionsService.java`:
- Around line 93-95: The auth.selected_account preference in OptionsService is
being seeded with the wrong type, which breaks the long-based contract used by
AuthenticationService and MainController. Update the null-initialization logic
in OptionsService so it writes a long-compatible sentinel instead of a boolean,
or remove the seed if it is unnecessary, and keep the key consistent with the
putLong/getLong callers such as MainController.refreshAccounts().
- Around line 43-44: The startup dependency is only added on OptionsService, but
ApplicationMonitor, TelemetryService, and NativeHostService also read migrated
Prefs values during `@PostConstruct` and can still run too early. Update those
beans to depend on preferencesMigration as well, or move the migration earlier
in startup so all migrated-pref readers initialize after the copy; use the
existing preferencesMigration symbol and the bean class names to apply the fix
consistently.
In
`@owlplug-client/src/main/java/com/owlplug/core/services/TelemetryService.java`:
- Around line 61-62: Telemetry ID initialization in TelemetryService should wait
for PreferencesMigration so existing installs keep their migrated user ID
instead of generating a new one. Update the TelemetryService bean initialization
to depend explicitly on the migration bean (for example with
`@DependsOn`("preferencesMigration")), and keep the Prefs.Telemetry.USER_ID
read/write in the `@PostConstruct` path after that dependency is enforced.
---
Nitpick comments:
In `@owlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.java`:
- Line 217: The fallback in PluginService#getPluginDirectory currently returns
the VST2 preference when format does not match any branch, so confirm this
legacy default is still intended after migration. If not, update the method’s
default path to a neutral/empty result or a format-appropriate fallback, and
keep the behavior aligned with the other format-specific branches in
PluginService.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4a27dd89-a814-45f4-82ae-728013c042ce
📒 Files selected for processing (27)
owlplug-client/src/main/java/com/owlplug/auth/services/AuthenticationService.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationDefaults.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationMonitor.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationPreferences.javaowlplug-client/src/main/java/com/owlplug/core/components/PreferencesMigration.javaowlplug-client/src/main/java/com/owlplug/core/controllers/HomeController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/MainController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/CrashRecoveryDialogController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/WelcomeDialogController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/ApplicationOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/InstallationOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/PluginScanOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/ProjectsOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/services/OptionsService.javaowlplug-client/src/main/java/com/owlplug/core/services/TelemetryService.javaowlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.javaowlplug-client/src/main/java/com/owlplug/plugin/components/PluginTaskFactory.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginInfoController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginTableController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginsController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/DisablePluginDialogController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/NewLinkController.javaowlplug-client/src/main/java/com/owlplug/plugin/services/NativeHostService.javaowlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.javaowlplug-client/src/main/java/com/owlplug/project/components/ProjectTaskFactory.javaowlplug-client/src/main/java/com/owlplug/project/services/ProjectService.javaowlplug-client/src/test/java/com/owlplug/AppTestContext.java
2362bff to
6629f1a
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@owlplug-client/src/main/java/com/owlplug/core/components/PreferencesMigration.java`:
- Around line 75-94: PreferencesMigration should not access
Preferences.userRoot() directly; it needs to use the injected
ApplicationPreferences abstraction instead. Update migrate() in
PreferencesMigration to read, write, and remove values through
ApplicationPreferences helpers (get, put, remove, getInt, putInt) so the
migration stays aligned with the rest of the app and any test/stub backing
store.
In
`@owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java`:
- Around line 349-365: Sanitize the STORE_DIRECTORY preference before appending
it in InstallStepDialogController so it cannot escape the intended install root.
Update the logic around shouldStoreInDirectory to validate or normalize the
value returned from getPreferences().get(Prefs.Explore.STORE_DIRECTORY, "")
before passing it to new File(selectedDirectory, relativeDirectoryPath), and
ensure only a safe relative child path is accepted. Keep the existing creator
subfolder handling unchanged, but apply the same path-safety rules consistently
in the directory-building flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 59366a99-aac7-4a97-8b9b-7e5d36e0ea8e
📒 Files selected for processing (27)
owlplug-client/src/main/java/com/owlplug/auth/services/AuthenticationService.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationDefaults.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationMonitor.javaowlplug-client/src/main/java/com/owlplug/core/components/ApplicationPreferences.javaowlplug-client/src/main/java/com/owlplug/core/components/PreferencesMigration.javaowlplug-client/src/main/java/com/owlplug/core/controllers/HomeController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/MainController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/CrashRecoveryDialogController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/WelcomeDialogController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/ApplicationOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/InstallationOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/PluginScanOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/controllers/options/ProjectsOptionsController.javaowlplug-client/src/main/java/com/owlplug/core/services/OptionsService.javaowlplug-client/src/main/java/com/owlplug/core/services/TelemetryService.javaowlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.javaowlplug-client/src/main/java/com/owlplug/plugin/components/PluginTaskFactory.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginInfoController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginTableController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginsController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/DisablePluginDialogController.javaowlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/NewLinkController.javaowlplug-client/src/main/java/com/owlplug/plugin/services/NativeHostService.javaowlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.javaowlplug-client/src/main/java/com/owlplug/project/components/ProjectTaskFactory.javaowlplug-client/src/main/java/com/owlplug/project/services/ProjectService.javaowlplug-client/src/test/java/com/owlplug/AppTestContext.java
✅ Files skipped from review due to trivial changes (1)
- owlplug-client/src/test/java/com/owlplug/AppTestContext.java
🚧 Files skipped from review as they are similar to previous changes (24)
- owlplug-client/src/main/java/com/owlplug/core/services/TelemetryService.java
- owlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginInfoController.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/WelcomeDialogController.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/options/ApplicationOptionsController.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/MainController.java
- owlplug-client/src/main/java/com/owlplug/core/services/OptionsService.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/HomeController.java
- owlplug-client/src/main/java/com/owlplug/core/components/ApplicationPreferences.java
- owlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginsController.java
- owlplug-client/src/main/java/com/owlplug/project/components/ProjectTaskFactory.java
- owlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginTableController.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/options/ProjectsOptionsController.java
- owlplug-client/src/main/java/com/owlplug/plugin/services/NativeHostService.java
- owlplug-client/src/main/java/com/owlplug/project/services/ProjectService.java
- owlplug-client/src/main/java/com/owlplug/core/components/ApplicationDefaults.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/CrashRecoveryDialogController.java
- owlplug-client/src/main/java/com/owlplug/plugin/services/PluginService.java
- owlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/DisablePluginDialogController.java
- owlplug-client/src/main/java/com/owlplug/plugin/components/PluginTaskFactory.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/options/InstallationOptionsController.java
- owlplug-client/src/main/java/com/owlplug/core/controllers/options/PluginScanOptionsController.java
- owlplug-client/src/main/java/com/owlplug/plugin/controllers/dialogs/NewLinkController.java
- owlplug-client/src/main/java/com/owlplug/auth/services/AuthenticationService.java
- owlplug-client/src/main/java/com/owlplug/core/components/ApplicationMonitor.java
No description provided.