-
Notifications
You must be signed in to change notification settings - Fork 603
feat(update): switch to GitHub releases auto-update #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughSwitches CI publishing to GitHub, adds changelog generation and a macOS ARM64 electron-builder config, bumps package version, updates build/rebrand scripts, and reworks the auto-update flow to use electron-updater + GitHub Releases with asynchronous changelog fetching; minor renderer/store UI adjustments included. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Renderer UI
participant Store as Upgrade Store
participant Presenter as UpgradePresenter
participant Updater as electron-updater
participant GitHub as GitHub Releases
UI->>Presenter: checkForUpdates(allowPrerelease)
activate Presenter
Presenter->>Updater: checkForUpdates(allowPrerelease)
activate Updater
Updater->>GitHub: request release metadata (latest.yml / releases)
GitHub-->>Updater: UpdateInfo (version, assets, prerelease)
Updater-->>Presenter: UpdateInfo
deactivate Updater
alt update available
Presenter->>Presenter: buildVersionInfo(UpdateInfo)
Presenter->>Store: emit "available" + VersionInfo
Presenter->>GitHub: async fetch changelog.md
GitHub-->>Presenter: changelog.md or 404
Presenter->>Presenter: refreshReleaseNotes -> update VersionInfo
Presenter->>Store: emit updated info (with release notes)
else no update / error
Presenter->>Store: emit "no-update" / "error"
end
Store->>UI: update state / show dialog
deactivate Presenter
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/renderer/src/stores/upgrade.ts (2)
19-19: Use English for comments.The comment on line 19 is in Chinese, which violates the coding guideline requiring English for all logs and comments in TypeScript files.
🔎 Suggested fix
- // 添加在 const updateInfo = ref<any>(null) 附近 + // Update progress tracking
156-156: Use i18n key for user-facing error message.The hardcoded Chinese error message violates coding guidelines requiring English and proper i18n usage for all user-facing strings in renderer code.
🔎 Suggested fix
- updateError.value = error || '更新出错' + updateError.value = error || t('update.error')Note: You'll need to add the corresponding key to your i18n locale files.
🧹 Nitpick comments (3)
scripts/rebrand.js (1)
171-174: The URL regex pattern won't match the new GitHub provider config.The publish configuration in
electron-builder-macarm.ymlnow usesprovider: githubwithownerandrepofields instead of aurlfield. This regex will never match, making the URL replacement ineffective for users who want to customize the GitHub repository settings during rebranding.Consider updating the rebrand logic to handle the GitHub provider format:
🔎 Proposed fix to support GitHub provider rebranding
// 替换 productName content = content.replace(/productName: .+/, `productName: ${config.app.productName}`) - // 替换 publish URL - if (config.update && config.update.baseUrl) { - content = content.replace(/url: https:\/\/cdn\.deepchatai\.cn\/upgrade\//, `url: ${config.update.baseUrl}`) + // 替换 publish owner/repo (GitHub provider) + if (config.update && config.update.githubOwner) { + content = content.replace(/owner: .+/, `owner: ${config.update.githubOwner}`) + } + if (config.update && config.update.githubRepo) { + content = content.replace(/repo: deepchat/, `repo: ${config.update.githubRepo}`) }src/renderer/src/stores/upgrade.ts (1)
76-77: Consider defining a proper type for IPC event payload.Using
anyfor the event parameter reduces type safety. Consider defining an interface for the UPDATE_EVENTS.STATUS_CHANGED payload to improve type checking and IDE support.🔎 Suggested refactor
Define the event payload type:
interface UpdateStatusEvent { status: 'available' | 'not-available' | 'downloading' | 'downloaded' | 'error' type?: string info?: { version: string releaseDate: string releaseNotes: string githubUrl?: string downloadUrl?: string } error?: string }Then use it in the handler:
- // eslint-disable-next-line @typescript-eslint/no-explicit-any - window.electron.ipcRenderer.on(UPDATE_EVENTS.STATUS_CHANGED, (_, event: any) => { + window.electron.ipcRenderer.on(UPDATE_EVENTS.STATUS_CHANGED, (_, event: UpdateStatusEvent) => {scripts/generate-changelog.mjs (1)
8-21: Consider adding try-catch for more graceful error handling.While the current implementation will fail with a stack trace if file operations throw, wrapping the file operations in a try-catch block would provide more user-friendly error messages for build failures.
🔎 Suggested enhancement
+try { if (!fs.existsSync(sourcePath)) { console.error('CHANGELOG.md not found at project root.') process.exit(1) } const content = fs.readFileSync(sourcePath, 'utf8').trim() if (!content) { console.error('CHANGELOG.md is empty.') process.exit(1) } fs.mkdirSync(path.dirname(outputPath), { recursive: true }) fs.writeFileSync(outputPath, `${content}\n`, 'utf8') console.log(`Generated changelog at ${outputPath}`) +} catch (error) { + console.error('Failed to generate changelog:', error.message) + process.exit(1) +}
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
.github/workflows/build.yml.github/workflows/release.ymlCHANGELOG.mdelectron-builder-macarm.ymlelectron-builder-macx64.ymlelectron-builder.ymlpackage.jsonresources/model-db/providers.jsonscripts/generate-changelog.mjsscripts/rebrand.jssrc/main/presenter/upgradePresenter/index.tssrc/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
🧰 Additional context used
📓 Path-based instructions (30)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.tsscripts/rebrand.jssrc/main/presenter/upgradePresenter/index.ts
**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling
Files:
src/renderer/src/components/ui/UpdateDialog.vue
src/renderer/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components
src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'
Files:
src/renderer/src/components/ui/UpdateDialog.vue
src/renderer/src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*.{vue,ts,tsx}: All user-facing strings must use i18n keys with vue-i18n framework in the renderer
Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files
Use the dynamic locale.value property to switch languages at runtime
Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
src/renderer/**/*.{vue,js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Renderer process code should be placed in
src/renderer(Vue 3 application)
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability in Vue.js applications
Implement proper state management with Pinia in Vue.js applications
Utilize Vue Router for navigation and route management in Vue.js applications
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/src/**/*.vue
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
Use scoped styles to prevent CSS conflicts between Vue components
Files:
src/renderer/src/components/ui/UpdateDialog.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Avoid enums; use const objects instead
Use arrow functions for methods and computed properties
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statementsVue 3 app code in
src/renderer/srcshould be organized intocomponents/,stores/,views/,i18n/,lib/directories with shell UI insrc/renderer/shell/
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/**
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Use lowercase with dashes for directories (e.g., components/auth-wizard)
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use TypeScript with Vue 3 Composition API for the renderer application
All user-facing strings must use vue-i18n keys insrc/renderer/src/i18n
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.ts
src/renderer/src/components/**/*.vue
📄 CodeRabbit inference engine (AGENTS.md)
src/renderer/src/components/**/*.vue: Use Tailwind for styles in Vue components
Vue component files must use PascalCase naming (e.g.,ChatInput.vue)
Files:
src/renderer/src/components/ui/UpdateDialog.vue
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/renderer/src/components/ui/UpdateDialog.vuesrc/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
src/renderer/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use the
usePresenter.tscomposable for renderer-to-main IPC communication to call presenter methods directly
Files:
src/renderer/src/stores/upgrade.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/renderer/src/stores/upgrade.tsscripts/generate-changelog.mjsscripts/rebrand.jssrc/main/presenter/upgradePresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/pinia-best-practices.mdc)
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}: Use modules to organize related state and actions in Pinia stores
Implement proper state persistence for maintaining data across sessions in Pinia stores
Use getters for computed state properties in Pinia stores
Utilize actions for side effects and asynchronous operations in Pinia stores
Keep Pinia stores focused on global state, not component-specific data
Files:
src/renderer/src/stores/upgrade.ts
src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Use TypeScript for all code; prefer types over interfaces
Files:
src/renderer/src/stores/upgrade.ts
src/renderer/**/stores/*.ts
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Use Pinia for state management
Files:
src/renderer/src/stores/upgrade.ts
src/renderer/src/stores/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use Pinia for state management
Files:
src/renderer/src/stores/upgrade.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/renderer/src/stores/upgrade.tssrc/main/presenter/upgradePresenter/index.ts
package.json
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
package.json: Node.js >= 22 required
pnpm >= 9 required
Files:
package.json
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/upgradePresenter/index.ts
🧠 Learnings (7)
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to package.json : pnpm >= 9 required
Applied to files:
package.jsonelectron-builder.yml
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to package.json : Node.js >= 22 required
Applied to files:
package.jsonelectron-builder.yml
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/**/*.ts : Use EventBus from `src/main/eventbus.ts` for main-to-renderer communication, broadcasting events via `mainWindow.webContents.send()`
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/**/*.ts : Use EventBus for inter-process communication events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Electron main process code belongs in `src/main/` with presenters in `presenter/` (Window/Tab/Thread/Mcp/Config/LLMProvider) and `eventbus.ts` for app events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/upgradePresenter/index.ts (3)
src/main/eventbus.ts (1)
eventBus(151-151)src/main/events.ts (1)
UPDATE_EVENTS(78-84)src/renderer/src/events.ts (1)
UPDATE_EVENTS(54-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (20)
electron-builder.yml (1)
101-104: LGTM!The Linux publish configuration correctly switches to GitHub provider with the appropriate owner and repo. Unlike the macOS configs, Linux doesn't require an architecture-specific channel since it uses a single config file.
electron-builder-macx64.yml (1)
81-85: LGTM!The macOS x64 publish configuration correctly sets the GitHub provider with
channel: x64, which aligns with theautoUpdater.channellogic inupgradePresenter/index.tsthat selects the channel based onprocess.arch.CHANGELOG.md (1)
1-12: LGTM!The changelog structure is clear with version entries and bilingual descriptions for user accessibility. This file will be processed by
generate-changelog.mjsto producedist/changelog.mdfor release assets.scripts/rebrand.js (1)
513-513: LGTM!The function call is correctly placed in the main flow alongside other electron-builder config updaters.
electron-builder-macarm.yml (1)
1-86: LGTM!The new macOS ARM64 build configuration is comprehensive and follows the same structure as the x64 config. The
channel: arm64setting correctly differentiates ARM builds for the auto-updater's channel-based selection.package.json (1)
40-40: LGTM!The build script correctly references the new
electron-builder-macarm.ymlconfiguration file, aligning with the introduction of the dedicated ARM64 build configuration.src/main/presenter/upgradePresenter/index.ts (6)
27-35: LGTM!Clean extraction of GitHub release URL constants with helper functions. The naming is clear and the URL construction logic is straightforward.
63-65: LGTM!The channel selection correctly maps
process.archto the corresponding electron-builder channel (arm64orx64), ensuring macOS users receive the correct architecture-specific updates.
97-115: LGTM!Good async pattern: the update is announced immediately with basic info, while release notes are fetched asynchronously in the background via
void this.refreshReleaseNotes(info). The previous-failure handling correctly falls back to manual update mode with a user-friendly error message.
258-259: LGTM!Correctly implements the update channel model:
allowPrereleaseis enabled only for canary users, ensuring stable users only receive non-pre-release updates. This aligns with the PR objective of using GitHub pre-releases for canary builds.
426-442: LGTM!The async release notes refresh is well-designed: it fetches the changelog, updates the version info, and notifies the renderer. Error handling appropriately logs without disrupting the update flow—release notes are supplementary information.
444-463: LGTM!Robust changelog fetching with appropriate timeout (15s), proper response validation, and a user-friendly fallback that links to the GitHub release page when the changelog is unavailable.
.github/workflows/build.yml (4)
67-68: LGTM!Changelog generation step correctly placed after the build to ensure
dist/changelog.mdis included in the uploaded artifacts. This will be packaged into releases whereupgradePresenterfetches it viafetchChangelog().
124-125: LGTM!Linux build correctly includes the changelog generation step, consistent with other platform builds.
189-190: LGTM!Mac build correctly includes the changelog generation step, ensuring all platforms produce the changelog artifact uniformly.
67-68: The changelog generation script properly handles edge cases.The
scripts/generate-changelog.mjsscript exists and includes comprehensive error handling. It validates that CHANGELOG.md exists at the project root, verifies the file is not empty after trimming whitespace, and creates the output directory (dist) with the recursive flag to ensure parent directories are created if needed.src/renderer/src/stores/upgrade.ts (1)
108-116: LGTM! Consistent updateInfo population pattern.This change correctly populates
updateInfoduring the 'downloading' phase, mirroring the pattern used in other status branches. This enables the UI (specifically UpdateDialog.vue) to access version information and the optionaldownloadUrlduring the download phase..github/workflows/release.yml (1)
52-53: LGTM! Necessary metadata files for electron-updater.The addition of
latest*.ymland*.blockmapfiles to release assets is essential for the GitHub releases auto-update mechanism:
latest*.ymlfiles contain version metadata that electron-updater reads to check for updates*.blockmapfiles enable efficient differential updateschangelog.mdprovides release notes for usersThe use of
2>/dev/null || trueappropriately handles cases where files might not exist for certain platforms.Also applies to: 69-70, 77-78, 85-92
scripts/generate-changelog.mjs (1)
1-21: LGTM! Clear and focused changelog generation script.The script correctly reads, validates, and copies the changelog to the build output directory. The validation checks for missing or empty CHANGELOG.md files are appropriate, and using
process.exit(1)is acceptable for build scripts.src/renderer/src/components/ui/UpdateDialog.vue (1)
47-47: LGTM! Appropriate conditional rendering.The addition of
v-if="upgrade.updateInfo?.downloadUrl"correctly ensures the netdisk download button is only displayed when a download URL is available. This aligns with the optionaldownloadUrlfield in the UpdateInfo type and prevents showing unavailable download options to users.
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const GITHUB_OWNER = 'ThinkInAIXYZ' | ||
| const GITHUB_REPO = 'deepchat' | ||
| const GITHUB_RELEASE_BASE_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}/releases` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hardcoding GitHub repo for updates
The update feed is now pinned to ThinkInAIXYZ/deepchat, which ignores the rebranding/update configuration (e.g., update.baseUrl / github.repository in the brand config). That means branded builds will still fetch release notes and update binaries from the upstream DeepChat repo, leading to incorrect update prompts or failed updates once the appId/assets don’t match. Consider deriving the owner/repo from config (or rewriting it during rebrand) instead of hardcoding it here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/build.yml (1)
60-60: Consider error handling for changelog generation.The
--publish=neverflag correctly disables automatic publishing from the build workflow. The changelog generation script (scripts/generate-changelog.mjs) exists in the codebase.However, there's no error handling for the changelog generation step—if the script fails, the entire build will fail. Consider adding
continue-on-error: trueif changelog creation is non-critical:- name: Generate changelog run: node scripts/generate-changelog.mjs --output dist/changelog.md continue-on-error: true
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-linux (x64)
- GitHub Check: build-mac (arm64)
- GitHub Check: build-mac (x64)
- GitHub Check: build-windows (x64)
- GitHub Check: build-check (x64)
🔇 Additional comments (2)
.github/workflows/build.yml (2)
117-117: Consistent changes for Linux builds.The changes mirror the Windows build configuration: disabling publish and generating the changelog. This consistency is good for maintainability.
The same verification and error handling considerations from the Windows build apply here.
Also applies to: 124-125
175-175: Consistent changes for Mac builds.The changes follow the same pattern as Windows and Linux, with the
--publish=neverflag and changelog generation. Each Mac architecture (x64, arm64) runs in a separate job and generates its own changelog in its owndist/directory, which is then uploaded to uniquely named artifacts.The same verification and error handling considerations from the Windows build apply here.
Also applies to: 189-190
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
electron-builder-macx64.yml (1)
67-71: Fix the YAML syntax forextendInfo.The
extendInfosection uses YAML list syntax (with dashes), but electron-builder expects a plain dictionary/object. This will cause the Info.plist to be malformed or the build to fail. This is the same issue present in the macarm configuration.🔎 Proposed fix
extendInfo: - - NSCameraUsageDescription: Application requests access to the device's camera. - - NSMicrophoneUsageDescription: Application requests access to the device's microphone. - - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. + NSCameraUsageDescription: Application requests access to the device's camera. + NSMicrophoneUsageDescription: Application requests access to the device's microphone. + NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. + NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
♻️ Duplicate comments (1)
src/main/presenter/upgradePresenter/index.ts (1)
27-29: Hardcoded GitHub repository ignores branding configuration.As noted in a previous review, pinning the repository to
ThinkInAIXYZ/deepchatbypasses any rebranding or update configuration. Branded builds will still fetch from the upstream repository, potentially causing update failures if appId/assets don't match.
🧹 Nitpick comments (2)
electron-builder-macx64.yml (1)
20-21: Add exclusion for electron-builder-macarm.yml for consistency.The macarm configuration excludes both config files (lines 21-22), but the macx64 configuration only excludes itself. For consistency and to avoid packaging unnecessary config files, consider adding the macarm exclusion.
🔎 Suggested addition
- '!electron-builder.yml' - '!electron-builder-macx64.yml' + - '!electron-builder-macarm.yml' - '!test/*'src/main/presenter/upgradePresenter/index.ts (1)
441-460: Good fallback handling, but use English for logs.The tolerant error handling with a user-friendly fallback message is appropriate. However, line 455 should use English for the log message per coding guidelines.
🔎 Minor log improvement
- console.warn('changelog not found', error) + console.warn('Changelog not found, using fallback message', error)As per coding guidelines: Use English for logs and comments.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
electron-builder-macarm.ymlelectron-builder-macx64.ymlsrc/main/presenter/upgradePresenter/index.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/main/presenter/upgradePresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/main/presenter/upgradePresenter/index.ts
🧠 Learnings (5)
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/**/*.ts : Use EventBus from `src/main/eventbus.ts` for main-to-renderer communication, broadcasting events via `mainWindow.webContents.send()`
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/**/*.ts : Use EventBus for inter-process communication events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Electron main process code belongs in `src/main/` with presenters in `presenter/` (Window/Tab/Thread/Mcp/Config/LLMProvider) and `eventbus.ts` for app events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/upgradePresenter/index.ts (3)
src/main/eventbus.ts (1)
eventBus(151-151)src/main/events.ts (1)
UPDATE_EVENTS(78-84)src/renderer/src/events.ts (1)
UPDATE_EVENTS(54-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-mac (arm64)
- GitHub Check: build-mac (x64)
- GitHub Check: build-linux (x64)
- GitHub Check: build-windows (x64)
- GitHub Check: build-check (x64)
🔇 Additional comments (3)
electron-builder-macarm.yml (1)
82-85: GitHub publish configuration looks correct.The GitHub provider configuration properly specifies the owner and repository, which aligns with the PR objective to switch from CDN to GitHub Releases for auto-updates.
electron-builder-macx64.yml (1)
82-84: GitHub publish configuration correctly updated.The switch from CDN URL to GitHub provider with owner and repository properly implements the PR objective to use GitHub Releases for auto-updates.
src/main/presenter/upgradePresenter/index.ts (1)
256-262: LGTM! Correctly implements GitHub releases update flow.The switch to
electron-updater'scheckForUpdates()withallowPrereleasecontrolled by the channel aligns perfectly with the PR objectives to use GitHub Releases for stable and canary channels.
| extendInfo: | ||
| - NSCameraUsageDescription: Application requests access to the device's camera. | ||
| - NSMicrophoneUsageDescription: Application requests access to the device's microphone. | ||
| - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. | ||
| - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the YAML syntax for extendInfo.
The extendInfo section uses YAML list syntax (with dashes), but electron-builder expects a plain dictionary/object. This will cause the Info.plist to be malformed or the build to fail.
🔎 Proposed fix
extendInfo:
- - NSCameraUsageDescription: Application requests access to the device's camera.
- - NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
+ NSCameraUsageDescription: Application requests access to the device's camera.
+ NSMicrophoneUsageDescription: Application requests access to the device's microphone.
+ NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
+ NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| extendInfo: | |
| - NSCameraUsageDescription: Application requests access to the device's camera. | |
| - NSMicrophoneUsageDescription: Application requests access to the device's microphone. | |
| - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. | |
| - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. | |
| extendInfo: | |
| NSCameraUsageDescription: Application requests access to the device's camera. | |
| NSMicrophoneUsageDescription: Application requests access to the device's microphone. | |
| NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. | |
| NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. |
🤖 Prompt for AI Agents
In electron-builder-macarm.yml around lines 68 to 72, the extendInfo block is
written as a YAML sequence (items prefixed with "-") but must be a
mapping/object for electron-builder to generate a correct Info.plist; change
extendInfo to a mapping by removing the dashes and using key: value pairs
(properly indenting under extendInfo) so each NSCameraUsageDescription,
NSMicrophoneUsageDescription, NSDocumentsFolderUsageDescription and
NSDownloadsFolderUsageDescription is declared as a key with its string value.
| if (this._previousUpdateFailed) { | ||
| console.log('上次更新失败,本次不进行自动更新,改为手动更新') | ||
| this._status = 'error' | ||
| this._error = '自动更新可能不稳定,请手动下载更新' | ||
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | ||
| status: this._status, | ||
| error: this._error, | ||
| info: this._versionInfo | ||
| }) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use English for new logs and error messages.
Lines 101 and 103 contain Chinese log and error messages. Per coding guidelines, new code should use English for logs and comments, even though legacy Chinese text exists elsewhere in the codebase.
🔎 Proposed English translations
- console.log('上次更新失败,本次不进行自动更新,改为手动更新')
+ console.log('Previous update failed, switching to manual update mode')
this._status = 'error'
- this._error = '自动更新可能不稳定,请手动下载更新'
+ this._error = 'Auto-update may be unstable, please download the update manually'As per coding guidelines: Use English for logs and comments.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (this._previousUpdateFailed) { | |
| console.log('上次更新失败,本次不进行自动更新,改为手动更新') | |
| this._status = 'error' | |
| this._error = '自动更新可能不稳定,请手动下载更新' | |
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | |
| status: this._status, | |
| error: this._error, | |
| info: this._versionInfo | |
| }) | |
| return | |
| } | |
| if (this._previousUpdateFailed) { | |
| console.log('Previous update failed, switching to manual update mode') | |
| this._status = 'error' | |
| this._error = 'Auto-update may be unstable, please download the update manually' | |
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | |
| status: this._status, | |
| error: this._error, | |
| info: this._versionInfo | |
| }) | |
| return | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/upgradePresenter/index.ts around lines 100 to 110, replace
the Chinese console log and error strings with English equivalents; change
console.log('上次更新失败,本次不进行自动更新,改为手动更新') to an English message such as
console.log('Previous update failed; disabling auto-update, please update
manually'), and change this._error = '自动更新可能不稳定,请手动下载更新' to an English message
such as this._error = 'Auto-update may be unstable; please download and install
the update manually', then keep the status/event emission logic identical.
| private async refreshReleaseNotes(info: UpdateInfo): Promise<void> { | ||
| try { | ||
| const changelog = await this.fetchChangelog(info.version) | ||
| if (!this._versionInfo) { | ||
| this._versionInfo = this.buildVersionInfo(info, changelog) | ||
| } else { | ||
| this._versionInfo.releaseNotes = changelog | ||
| } | ||
|
|
||
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | ||
| status: this._status, | ||
| info: this._versionInfo | ||
| }) | ||
| } catch (error) { | ||
| console.error('获取更新日志失败', error) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use English for error logs in new code.
Line 437 contains a Chinese error log message. Per coding guidelines, new code should use English for logs.
🔎 Proposed translation
- console.error('获取更新日志失败', error)
+ console.error('Failed to fetch changelog', error)As per coding guidelines: Use English for logs and comments.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private async refreshReleaseNotes(info: UpdateInfo): Promise<void> { | |
| try { | |
| const changelog = await this.fetchChangelog(info.version) | |
| if (!this._versionInfo) { | |
| this._versionInfo = this.buildVersionInfo(info, changelog) | |
| } else { | |
| this._versionInfo.releaseNotes = changelog | |
| } | |
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | |
| status: this._status, | |
| info: this._versionInfo | |
| }) | |
| } catch (error) { | |
| console.error('获取更新日志失败', error) | |
| } | |
| } | |
| private async refreshReleaseNotes(info: UpdateInfo): Promise<void> { | |
| try { | |
| const changelog = await this.fetchChangelog(info.version) | |
| if (!this._versionInfo) { | |
| this._versionInfo = this.buildVersionInfo(info, changelog) | |
| } else { | |
| this._versionInfo.releaseNotes = changelog | |
| } | |
| eventBus.sendToRenderer(UPDATE_EVENTS.STATUS_CHANGED, SendTarget.ALL_WINDOWS, { | |
| status: this._status, | |
| info: this._versionInfo | |
| }) | |
| } catch (error) { | |
| console.error('Failed to fetch changelog', error) | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/upgradePresenter/index.ts around lines 423 to 439, the
catch block logs an error message in Chinese; change the log to English per
coding guidelines — replace the console.error('获取更新日志失败', error) call with an
English message such as console.error('Failed to fetch changelog', error) (or
similar clear English text) and keep the error object passed through; ensure any
other new logs in this function use English as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
electron-builder-macx64.yml (1)
67-71: Fix the YAML syntax forextendInfo.The
extendInfosection uses YAML list syntax (with dashes), but electron-builder expects a plain dictionary/object. This will cause the Info.plist to be malformed or the build to fail.🔎 Proposed fix
extendInfo: - - NSCameraUsageDescription: Application requests access to the device's camera. - - NSMicrophoneUsageDescription: Application requests access to the device's microphone. - - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. + NSCameraUsageDescription: Application requests access to the device's camera. + NSMicrophoneUsageDescription: Application requests access to the device's microphone. + NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. + NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
♻️ Duplicate comments (4)
electron-builder-macarm.yml (1)
68-72: Fix the YAML syntax forextendInfo.The
extendInfosection uses YAML list syntax (with dashes), but electron-builder expects a plain dictionary/object. This will cause the Info.plist to be malformed or the build to fail.🔎 Proposed fix
extendInfo: - - NSCameraUsageDescription: Application requests access to the device's camera. - - NSMicrophoneUsageDescription: Application requests access to the device's microphone. - - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. + NSCameraUsageDescription: Application requests access to the device's camera. + NSMicrophoneUsageDescription: Application requests access to the device's microphone. + NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. + NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.src/main/presenter/upgradePresenter/index.ts (3)
27-35: Hardcoded GitHub repository prevents rebranding.The GitHub owner and repo are hardcoded, which will prevent branded builds from fetching updates from their own repositories. This issue was already raised in previous reviews.
103-113: Use English for logs and error messages.Lines 104 and 106 contain Chinese log and error messages. Per coding guidelines, new code should use English for logs and comments.
As per coding guidelines: Use English for logs and comments.
426-442: Use English for error logs.Line 440 contains a Chinese error log message. Per coding guidelines, new code should use English for logs.
As per coding guidelines: Use English for logs and comments.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/release.ymlelectron-builder-macarm.ymlelectron-builder-macx64.ymlsrc/main/presenter/upgradePresenter/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/release.yml
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/main/presenter/upgradePresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/main/presenter/upgradePresenter/index.ts
🧠 Learnings (13)
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to **/*.{js,ts,jsx,tsx,mjs,cjs} : Write logs and comments in English
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Provide meaningful error messages when catching errors
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Provide user-friendly error messages for user-facing errors in TypeScript components
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:27:39.200Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/provider-guidelines.mdc:0-0
Timestamp: 2025-11-25T05:27:39.200Z
Learning: Applies to **/*Provider**/index.ts : Error handling: use `error` event uniformly to carry error messages, avoid mixing errors into other event fields
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Implement error retry mechanisms for transient failures in TypeScript
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/**/*.ts : Use EventBus from `src/main/eventbus.ts` for main-to-renderer communication, broadcasting events via `mainWindow.webContents.send()`
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/**/*.ts : Use EventBus for inter-process communication events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Electron main process code belongs in `src/main/` with presenters in `presenter/` (Window/Tab/Thread/Mcp/Config/LLMProvider) and `eventbus.ts` for app events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/upgradePresenter/index.ts (1)
src/main/events.ts (1)
UPDATE_EVENTS(78-84)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-mac (arm64)
- GitHub Check: build-linux (x64)
- GitHub Check: build-mac (x64)
- GitHub Check: build-windows (x64)
- GitHub Check: build-check (x64)
🔇 Additional comments (8)
electron-builder-macarm.yml (1)
82-86: LGTM!The GitHub publish configuration is correct and aligns with the macOS ARM64 arch-specific channel (
arm64) set in the upgradePresenter. The configuration properly follows electron-updater's GitHub provider pattern.electron-builder-macx64.yml (1)
82-85: LGTM!The switch to GitHub publishing with the
x64channel is correct and aligns with the macOS arch-specific channel strategy implemented in the upgradePresenter. This change successfully addresses the PR objective to use GitHub Releases as the update provider.src/main/presenter/upgradePresenter/index.ts (6)
23-24: LGTM!Making
githubUrlanddownloadUrloptional in theVersionInfointerface is appropriate given the new asynchronous changelog fetching pattern. The code properly handles these optional fields throughout.
49-49: LGTM!The
_lastCheckTypeproperty appropriately tracks whether an update check was automatic or manual, enabling differentiated UI notifications.
63-65: LGTM!The macOS arch-specific channel configuration correctly maps ARM64 and x64 architectures to their respective update channels, aligning perfectly with the electron-builder publish configurations.
246-274: LGTM!The refactored
checkUpdatemethod correctly implements the PR objective by using electron-updater's standardcheckForUpdates()withallowPrereleasederived from the channel configuration. This eliminates custom feed URL management as intended.
416-424: LGTM!The
buildVersionInfomethod is well-structured, properly extracts data fromUpdateInfo, and correctly constructs theVersionInfoobject with the optional fields pattern.
444-463: Well-implemented changelog fetching with graceful fallback.The
fetchChangelogmethod properly handles the async changelog retrieval with appropriate timeout, error handling, and a user-friendly fallback message when the changelog is unavailable. The implementation is robust and follows best practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
src/main/presenter/upgradePresenter/index.ts (3)
27-35: Hardcoded GitHub repository bypasses brand configuration.This issue was previously flagged: hardcoding
ThinkInAIXYZ/deepchatignores rebranding/update configuration (e.g.,update.baseUrl/github.repositoryin brand config), which will cause branded builds to fetch updates from the wrong repository.
103-113: Use English for logs and error messages.This issue was previously flagged: lines 104 and 106 contain Chinese log and error messages. Per coding guidelines, new code should use English.
434-450: Use English for error logs.This issue was previously flagged: line 448 contains a Chinese error log message ('获取更新日志失败'). Per coding guidelines, new code should use English.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/presenter/upgradePresenter/index.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/main/presenter/upgradePresenter/index.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/main/presenter/upgradePresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/main/presenter/upgradePresenter/index.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/main/presenter/upgradePresenter/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/main/presenter/upgradePresenter/index.ts
🧠 Learnings (13)
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to **/*.{js,ts,jsx,tsx,mjs,cjs} : Write logs and comments in English
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Provide meaningful error messages when catching errors
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Provide user-friendly error messages for user-facing errors in TypeScript components
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:27:39.200Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/provider-guidelines.mdc:0-0
Timestamp: 2025-11-25T05:27:39.200Z
Learning: Applies to **/*Provider**/index.ts : Error handling: use `error` event uniformly to carry error messages, avoid mixing errors into other event fields
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:35.317Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-11-25T05:26:35.317Z
Learning: Applies to **/*.{ts,tsx} : Implement error retry mechanisms for transient failures in TypeScript
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/**/*.ts : Use EventBus from `src/main/eventbus.ts` for main-to-renderer communication, broadcasting events via `mainWindow.webContents.send()`
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/**/*.ts : Use EventBus for inter-process communication events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Electron main process code belongs in `src/main/` with presenters in `presenter/` (Window/Tab/Thread/Mcp/Config/LLMProvider) and `eventbus.ts` for app events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/upgradePresenter/index.ts (3)
src/main/eventbus.ts (1)
eventBus(151-151)src/main/events.ts (1)
UPDATE_EVENTS(78-84)src/renderer/src/events.ts (1)
UPDATE_EVENTS(54-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: build-linux (x64)
- GitHub Check: build-windows (x64)
- GitHub Check: build-mac (x64)
- GitHub Check: build-mac (arm64)
- GitHub Check: build-check (x64)
🔇 Additional comments (3)
src/main/presenter/upgradePresenter/index.ts (3)
63-65: LGTM: macOS architecture-based channel initialization.The initial channel assignment is appropriate and will be correctly overridden in
checkUpdatebased on the update channel configuration (canary vs stable).
90-93: LGTM: Check type tracking improves UX.Adding
type: this._lastCheckTypeto the status payload allows the renderer to differentiate between auto-check and manual-check flows, enabling better user feedback.
258-267: Verify the macOS channel logic with GitHub Releases.The channel configuration correctly implements canary vs stable distinction: clearing the channel for canary allows prerelease tag matching, while setting architecture-based channels for stable ensures correct platform asset selection. This works as expected with electron-updater's GitHub provider since the build process bakes the channel configuration into the generated metadata files (x64-mac.yml and arm64-mac.yml), which are published to GitHub releases.
| private async fetchChangelog(version: string): Promise<string> { | ||
| const url = getChangelogUrl(version) | ||
| try { | ||
| const response = await axios.get<string>(url, { | ||
| timeout: 15000, | ||
| responseType: 'text', | ||
| validateStatus: (status) => status >= 200 && status < 300 | ||
| }) | ||
|
|
||
| const content = typeof response.data === 'string' ? response.data.trim() : '' | ||
| if (content.length > 0) { | ||
| return content | ||
| } | ||
| } catch (error) { | ||
| console.warn('changelog not found', error) | ||
| } | ||
|
|
||
| const fallbackUrl = getReleasePageUrl(version) | ||
| return `Release notes are not available yet. [View release page](${fallbackUrl}).` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Search for releaseNotes usage in renderer components
rg -n "releaseNotes" src/renderer --type vue --type ts --type tsx -B 2 -A 2Repository: ThinkInAIXYZ/deepchat
Length of output: 92
🏁 Script executed:
# Check for markdown rendering libraries in package.json
rg -n "marked|markdown|showdown|remark" package.jsonRepository: ThinkInAIXYZ/deepchat
Length of output: 47
🏁 Script executed:
# Check the upgradePresenter file for more context on error handling and logging
wc -l src/main/presenter/upgradePresenter/index.tsRepository: ThinkInAIXYZ/deepchat
Length of output: 113
🏁 Script executed:
# Look for logger utility usage in the main process
rg -n "logger\.(error|warn|info|debug)" src/main --type ts -B 1 -A 1 | head -40Repository: ThinkInAIXYZ/deepchat
Length of output: 3310
🏁 Script executed:
# Search for how fetchChangelog result is used
rg -n "fetchChangelog" src/main/presenter/upgradePresenter --type ts -B 2 -A 5Repository: ThinkInAIXYZ/deepchat
Length of output: 1400
🏁 Script executed:
# Search for releaseNotes display without specifying vue type
rg -n "releaseNotes" src/renderer -B 2 -A 2Repository: ThinkInAIXYZ/deepchat
Length of output: 7550
🏁 Script executed:
# Look at the entire upgradePresenter file to understand error handling patterns
head -100 src/main/presenter/upgradePresenter/index.tsRepository: ThinkInAIXYZ/deepchat
Length of output: 3283
🏁 Script executed:
# Check if there are error type definitions used in the codebase
rg -n "UserError|NetworkError|SystemError|BusinessError" src --type ts | head -20Repository: ThinkInAIXYZ/deepchat
Length of output: 157
🏁 Script executed:
# Find NodeRenderer component
rg -n "NodeRenderer" src/renderer --type ts --type tsx -lRepository: ThinkInAIXYZ/deepchat
Length of output: 92
🏁 Script executed:
# View the complete fetchChangelog and surrounding error handling context
sed -n '452,484p' src/main/presenter/upgradePresenter/index.tsRepository: ThinkInAIXYZ/deepchat
Length of output: 1086
🏁 Script executed:
# Check error handling patterns in refreshReleaseNotes (caller of fetchChangelog)
sed -n '434,450p' src/main/presenter/upgradePresenter/index.tsRepository: ThinkInAIXYZ/deepchat
Length of output: 611
🏁 Script executed:
# Find NodeRenderer component without tsx type
rg -n "NodeRenderer" src/renderer -A 10 | head -50Repository: ThinkInAIXYZ/deepchat
Length of output: 4326
🏁 Script executed:
# Check for NodeRenderer definition
rg -n "export.*NodeRenderer|function NodeRenderer|const NodeRenderer" src --type ts -B 2 -A 5Repository: ThinkInAIXYZ/deepchat
Length of output: 47
🏁 Script executed:
# Look at logging imports in upgradePresenter to see if logger is available
head -30 src/main/presenter/upgradePresenter/index.tsRepository: ThinkInAIXYZ/deepchat
Length of output: 833
🏁 Script executed:
# Check if markstream-vue is in package.json
rg "markstream-vue" package.jsonRepository: ThinkInAIXYZ/deepchat
Length of output: 95
🏁 Script executed:
# Check logging utility availability in upgradePresenter imports
grep -n "logger\|log" src/main/presenter/upgradePresenter/index.ts | head -20Repository: ThinkInAIXYZ/deepchat
Length of output: 1215
🏁 Script executed:
# Search for logger import pattern in other presenter files
rg "import.*logger" src/main/presenter --type ts | head -5Repository: ThinkInAIXYZ/deepchat
Length of output: 487
Use structured logging and implement retry mechanism for transient network failures in changelog fetch.
-
Replace
console.warnwithlogger.warn: The current code uses console methods instead of the structured logger utility (imported in other presenters from'@shared/logger'). Per coding guidelines, uselogger.warn(),logger.error(), etc. -
Implement retry for transient failures: Add exponential backoff retry logic for the axios request—temporary network glitches currently cause immediate fallback to the generic message. This aligns with the guideline to implement error retry mechanisms for transient failures.
-
Markdown rendering is properly supported: The fallback message's markdown syntax
[View release page](${fallbackUrl})will render correctly since the UI uses NodeRenderer from 'markstream-vue', which handles markdown.
private async fetchChangelog(version: string): Promise<string> {
const url = getChangelogUrl(version)
+ const maxRetries = 2
+ let lastError: Error | undefined
+
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
try {
const response = await axios.get<string>(url, {
timeout: 15000,
responseType: 'text',
validateStatus: (status) => status >= 200 && status < 300
})
const content = typeof response.data === 'string' ? response.data.trim() : ''
if (content.length > 0) {
return content
}
} catch (error) {
- console.warn('changelog not found', error)
+ lastError = error instanceof Error ? error : new Error(String(error))
+ if (attempt < maxRetries) {
+ logger.warn(`Changelog fetch attempt ${attempt + 1} failed, retrying...`, lastError)
+ await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)))
+ }
}
+ }
+
+ logger.warn('Changelog not found after retries', lastError)
const fallbackUrl = getReleasePageUrl(version)
return `Release notes are not available yet. [View release page](${fallbackUrl}).`
}Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/main/presenter/upgradePresenter/index.ts around lines 452 to 471, replace
the console.warn usage with the shared structured logger (logger.warn) and
capture the error details; additionally implement a retry loop with exponential
backoff for the axios GET (e.g., 3 attempts with increasing delays like 500ms,
1000ms, 2000ms) that only retries on transient/network errors (network timeouts,
no response, or 5xx responses) and breaks/returns immediately on non-transient
errors (4xx); ensure each failed attempt logs the attempt number and error via
logger.warn, and if all retries fail preserve the existing fallback that returns
the markdown release-note link.
close #1202
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.