fix: Windows autostart self-healing and call-order safety#26
fix: Windows autostart self-healing and call-order safety#26shiqkuangsan wants to merge 3 commits intomainfrom
Conversation
- Rust (lib.rs): On Windows startup, if DB has auto_start=true, re-call autostart_manager().enable() to repair registry entries that are silently deleted after first boot (plugins-workspace#771) - TypeScript (settings-store.ts): For auto_start, call the platform plugin first; only write to DB and update UI on success. This prevents the toggle from showing "enabled" when system registration actually failed. - TypeScript (settings-store.ts): After enable(), verify with isEnabled() and warn to console if verification fails (e.g. path-spaces issue on Windows) - Tests: add isEnabled mock, assert DB not updated when plugin fails Co-authored-by: shiqkuangsan <shiqkuangsan@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughOn Windows, startup now reads the DB Changes
Sequence Diagram(s)sequenceDiagram
participant App as App Startup
participant DB as Database
participant Plugin as Autostart Plugin
participant Registry as Windows Registry
App->>DB: query `auto_start`
alt DB == "true"
DB-->>App: "true"
App->>Plugin: enable()
Plugin->>Registry: write/re-register entry
Registry-->>Plugin: success
Plugin-->>App: success
App->>Plugin: isEnabled()
Plugin->>Registry: verify entry
Registry-->>Plugin: present
Plugin-->>App: true
App->>App: continue initialization
else
DB-->>App: "false" or null
App->>App: skip autostart repair
end
sequenceDiagram
participant User as User
participant UI as Settings UI
participant Store as Settings Store
participant Plugin as Autostart Plugin
participant Backend as Backend (invoke)
participant DB as Database
User->>UI: toggle autostart -> true
UI->>Store: updateSetting("auto_start","true")
Store->>Plugin: enable()
alt Plugin success
Plugin-->>Store: resolved
Store->>Plugin: isEnabled()
Plugin-->>Store: true
Store->>Backend: invoke("set_setting", {key:"auto_start", value:"true"})
Backend->>DB: persist
DB-->>Backend: ok
Backend-->>Store: success
Store->>UI: update state -> "true"
else Plugin fails
Plugin-->>Store: rejected
Store->>UI: keep previous state
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/stores/__tests__/settings-store.test.ts (1)
33-46: TestDEFAULT_SETTINGSis missingshow_tray_icon.The
DEFAULT_SETTINGSconstant in this test file is missing theshow_tray_iconproperty that exists in the actualSettingsinterface andDEFAULT_SETTINGSinsettings-store.ts. While this may not break current tests, it could cause issues if future tests rely on a complete default settings object.🔧 Suggested fix
const DEFAULT_SETTINGS: Settings = { shortcut: "CommandOrControl+Shift+V", auto_start: "false", theme: "system", language: "system", retention_policy: "unlimited", retention_days: "0", retention_count: "0", max_item_size_mb: "10", close_on_blur: "true", update_check_interval: "weekly", panel_position: "bottom", flat_mode_tb: "false", + show_tray_icon: "true", };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/stores/__tests__/settings-store.test.ts` around lines 33 - 46, The test's DEFAULT_SETTINGS object is missing the show_tray_icon property from the Settings interface; update the DEFAULT_SETTINGS constant in src/stores/__tests__/settings-store.test.ts to include show_tray_icon with the same default value/type used in the real DEFAULT_SETTINGS in settings-store.ts so the test object fully matches the Settings shape (refer to DEFAULT_SETTINGS and Settings to locate the exact property name and expected default).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/stores/__tests__/settings-store.test.ts`:
- Around line 33-46: The test's DEFAULT_SETTINGS object is missing the
show_tray_icon property from the Settings interface; update the DEFAULT_SETTINGS
constant in src/stores/__tests__/settings-store.test.ts to include
show_tray_icon with the same default value/type used in the real
DEFAULT_SETTINGS in settings-store.ts so the test object fully matches the
Settings shape (refer to DEFAULT_SETTINGS and Settings to locate the exact
property name and expected default).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 553582d9-2162-42ff-a235-2e2d8ca42a3c
📒 Files selected for processing (3)
src-tauri/src/lib.rssrc/stores/__tests__/settings-store.test.tssrc/stores/settings-store.ts
|
@claude fix |
|
Claude finished @shiqkuangsan's task in 33s —— View job Fix applied
Added |
Co-authored-by: shiqkuangsan <shiqkuangsan@users.noreply.github.com>
|
CI failed. logs: Run cargo check --target x86_64-pc-windows-msvc error[E0599]: no method named For more information about this error, try fix |
|
Claude finished @shiqkuangsan's task in 54s —— View job Fix applied
Root cause: |
ManagerExt trait is implemented on AppHandle, not &mut App. Co-authored-by: shiqkuangsan <shiqkuangsan@users.noreply.github.com>
|
Closed — this PR has a compilation error on Windows: The correct method is Superseded by #27. |
Fixes #25
Changes:
enable()if DB hasauto_start=trueto repair registry entries deleted after first bootauto_start, call platform plugin first; only write DB/UI on successenable(), verify withisEnabled()and warn if verification failsisEnabledmock, assert DB not updated when plugin failsGenerated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests