fix: patch all P2 quality/performance issues from project review

- ipc-handlers: withLog extracts actual connection ID from args[0] (P2#20)
- updater: add initialized guard to prevent duplicate IPC registration (P2#25)
- win-state: log writeFile errors instead of empty callback (P2#26)
- format: detectFormat samples up to 4096 chars instead of 100 (P2#28)
- commandLogger: add 30+ missing write commands to WRITE_COMMANDS (P2#32)
- ReJsonEditor: bind Monaco theme to monacoTheme computed (P2#19)
- keys: normalize empty SCAN pattern to '*' (P2#21)
- SlowLogView: remove duplicate <style scoped> block (P2#29)
- CliView: deduplicate XGROUP in writeCommands Set (P2#33)
- key store: use connectionStore instead of IPC for separator (P2#22)
- NewConnectionDialog: add visible guard after async watch (P2#30)
- KeyList: remove dangerouslyUseHTMLString, use plain text + i18n (P2#31)
- KeyList: batch DUMP export with Promise.allSettled (batch=20) (P2#23)
- HashEditor: lazy load field TTL on click instead of bulk HTTL (P2#24)
- P2#27 already fixed in P0#2; P2#34 is feature (N4); P2#35 not a bug
- docs: update PROJECT_REVIEW.md with P2 fix status
This commit is contained in:
2026-07-12 14:30:18 +08:00
parent 70db25b337
commit 1a5e4dd706
19 changed files with 94 additions and 110 deletions
+22 -22
View File
@@ -4,7 +4,7 @@
> 审查方式:并行扫描主进程、渲染进程、IPC 契约一致性
> 审查范围:主进程 10 文件、渲染进程 ~40 文件、IPC 65 通道
> 发现问题:54 个(P0×6, P1×12, P2×17, P3×19)
> 已修复:**P0×6 + P1×11 全部修复** (2026-07-12)
> 已修复:**P0×6 + P1×11 + P2×14 全部修复** (2026-07-12)
> 可开发需求:26 项(高优先级 6,中 11,低 9)
---
@@ -49,27 +49,27 @@
| 17 | `StreamEditor.vue:357-361` | **Trim 对话框无确认按钮**:添加 Cancel/Confirm 按钮调用 `trimStream()` | **已修复** |
| 18 | `KeyBrowser.vue` + `DbSelector.vue` | **双重扫描**:移除 KeyBrowser watch 的 `{ immediate: true }` | **已修复** |
### P2 - 应修复(质量/性能)
### P2 - 应修复(质量/性能) - 全部已处理
| # | 位置 | 问题 |
|---|------|------|
| 19 | `ReJsonEditor.vue:88` | Monaco 主题硬编码 `vs-dark`,亮色主题下对比度极差。 |
| 20 | `ipc-handlers.ts:13,16` | `withLog` 记录 `'current'` 而非实际连接 ID,命令日志无用。 |
| 21 | `keys.ts:96` | 空模式 `''` 导致 SCAN 匹配空字符串键,应规范化为 `'*'` |
| 22 | `key.ts:115-119` | 每次扫描都调 `getConnections()` IPC,连接信息已在 store 中。 |
| 23 | `KeyList.vue:143-180` | 批量导出串行 DUMP,1000 key = 1000 次 IPC 往返。 |
| 24 | `HashEditor.vue:80-89` | 逐个字段 HTTL,大 hash 数百次 IPC。 |
| 25 | `updater.ts:15,25,35` | 重复调用 `initUpdater` `ipcMain.handle` 抛重复注册错误。 |
| 26 | `win-state.ts:47` | 写错误回调静默吞噬。 |
| 27 | `format.ts:56-58` | 临时目录 `mkdtemp` 创建后成功路径不清理,`/tmp/jrdm-fmt-*/` 累积。 |
| 28 | `format.ts:46` | `detectFormat` 检查前 100 字符,前 100 为 ASCII 的二进制值误判为 text。 |
| 29 | `SlowLogView.vue:241-283` | 重复 `<style scoped>` |
| 30 | `NewConnectionDialog.vue:46-95` | 异步 watch 返回后可能对话框已关闭仍在设状态。 |
| 31 | `KeyList.vue:254` | `dangerouslyUseHTMLString: true` 潜在 XSS(依赖 escapeHtml 完整性)。 |
| 32 | `commandLogger.ts:16-25` | `WRITE_COMMANDS` `JSON.SET`/`JSON.DEL`/`COPY`/`RESTORE` 等。 |
| 33 | `CliView.vue:167-183` | `writeCommands` Set 重复 `XGROUP` 三次。 |
| 34 | 所有编辑器 | 大数据量无虚拟滚动,数万条记录一次性渲染。 |
| 35 | `StatusView.vue:144` | `refreshTimer` 模块级变量,重新挂载丢引用。 |
| # | 位置 | 问题 | 状态 |
|---|------|------|------|
| 19 | `ReJsonEditor.vue:88` | Monaco 主题改为 `:theme="monacoTheme"` 动态绑定 | **已修复** |
| 20 | `ipc-handlers.ts:13,16` | `withLog` `args[0]` 提取实际连接 ID | **已修复** |
| 21 | `keys.ts:96` | 空模式规范化为 `'*'` | **已修复** |
| 22 | `key.ts:115-119` | 改从 `useConnectionStore()` 获取 separator,消除 IPC 往返 | **已修复** |
| 23 | `KeyList.vue:143-180` | 批量导出改为 `Promise.allSettled` 分批并行(每批 20) | **已修复** |
| 24 | `HashEditor.vue:80-89` | HTTL 改为点击字段时按需加载(延迟加载) | **已修复** |
| 25 | `updater.ts` | `initUpdater` 添加 `initialized` 守卫防重复注册 | **已修复** |
| 26 | `win-state.ts:47` | 写错误回调改为 `console.error` | **已修复** |
| 27 | `format.ts:56-58` | 临时目录清理(随 P0#2 修复) | **已修复** |
| 28 | `format.ts:46` | `detectFormat` 检查范围扩大到 4096 字符 | **已修复** |
| 29 | `SlowLogView.vue:241-283` | 删除重复 `<style scoped>` | **已修复** |
| 30 | `NewConnectionDialog.vue:46-95` | async watch 中 await 后加 `if (!props.visible) return` 守卫 | **已修复** |
| 31 | `KeyList.vue:254` | 移除 `dangerouslyUseHTMLString`,改用纯文本 + i18n | **已修复** |
| 32 | `commandLogger.ts:16-25` | `WRITE_COMMANDS` 补充 30+ 缺失写命令 | **已修复** |
| 33 | `CliView.vue:167-183` | `writeCommands` Set 去除重复 `XGROUP` | **已修复** |
| 34 | 所有编辑器 | 大数据量无虚拟滚动(属需求 N4,不在修复范围) | **需求** |
| 35 | `StatusView.vue:144` | `refreshTimer` 已在 `<script setup>` 内,`onUnmounted` 正确清理 | **非 bug** |
### P3 - 代码质量改进
@@ -191,7 +191,7 @@
- **审查范围**:主进程 10 文件、渲染进程 ~40 文件、IPC 65 通道
- **发现问题**:54 个(P0×6, P1×12, P2×17, P3×19)
- **已修复**:P0×6 + P1×11 = **17** (2026-07-12)
- **已修复**:P0×6 + P1×11 + P2×14 = **31 个** (2026-07-12)
- **安全问题**:6 个(P0 全部已修复)
- **死代码**:6 处
- **可开发需求**:26 项(高优先级 6,中 11,低 9)