fix(desktop): show marker after archived history cleanup - #3758
Open
PeaceMaker-best wants to merge 1 commit into
Open
fix(desktop): show marker after archived history cleanup#3758PeaceMaker-best wants to merge 1 commit into
PeaceMaker-best wants to merge 1 commit into
Conversation
Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/drizzle/scripts/0101_furry_garia.ts | 通过 PRAGMA 检查后幂等添加可空整数列,符合仓库现有脚本迁移执行方式。 |
| apps/desktop/src/main/localDb/dbSlimmingMaintenance.ts | 在消息删除所在事务内为同一目标集写入单调递增的维护清理时间,失败时不会产生部分提交。 |
| apps/desktop/src/main/localDb/mapper.ts | 将数据库毫秒时间安全转换为可选 ISO 会话字段,同时兼容旧式或手工投影。 |
| apps/desktop/src/main/localDb/schema.ts | 为 sessions schema 增加与迁移一致的可空 maintenance_cleared_at 字段。 |
| apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 在用户清理或维护清理任一标记存在时复用现有历史清理提示。 |
| apps/desktop/src/renderer/lib/ccAgent.types.ts | 将维护清理时间声明为可选字段,以兼容旧版桌面端会话载荷。 |
Sequence Diagram
sequenceDiagram
participant Startup as 桌面启动流程
participant Migration as 迁移运行器
participant Slimming as 数据库瘦身
participant DB as SQLite 会话库
participant Projection as 会话投影
participant UI as 会话消息流
Startup->>Migration: 执行 0101 SQL 与同名脚本
Migration->>DB: 添加 maintenance_cleared_at
Startup->>Slimming: 在打开正常 DbClient 前恢复维护请求
Slimming->>DB: 事务内删除目标历史
Slimming->>DB: 写入 maintenance_cleared_at
DB-->>Projection: 返回会话行
Projection-->>UI: maintenanceClearedAt
UI->>UI: 显示既有“历史内容已清除”提示
Reviews (1): Last reviewed commit: "fix(desktop): show marker for maintenanc..." | Re-trigger Greptile
MagicLizi
requested changes
Sep 2, 2026
MagicLizi
left a comment
Contributor
There was a problem hiding this comment.
格式门未通过,请按仓库 PR 模板补全缺失段落后再请求审查。
当前 description 缺少模板要求的段落:
- 怎么验证的
「这次改了什么」和风险信息已有,但门禁按一级标题识别。请把验证命令改挂到 ## 怎么验证的 下(已通过的 db:validate / migration replay / 投影测试 / typecheck,以及包装脚本失败、Windows 环境失败等未执行或无关失败)。现有「## 验证」请改成这个标题,或把内容挪过去。
另外本 PR 含 drizzle 迁移,风险段请继续保留 SQLite / migration 分类。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这次改了什么
摘要
数据库瘦身会物理删除过期归档任务的消息,但此前没有留下可供会话界面识别的维护标记,用户重新打开任务时会看到一片空白。本 PR 新增独立的
maintenance_cleared_at标记:维护任务实际清理历史后写入该字段,列表投影将其传到渲染层,并复用现有“历史内容已清除”提示。变更类型
Fixes #3709
包含范围
maintenance_cleared_at列与幂等迁移。/clear的cleared_at语义。不包含
/clear的行为。用户可见行为
打开被数据库瘦身清理过的归档任务时,不再只显示空白消息区,而会显示现有的“历史内容已清除”分隔提示。
UI 变化与效果证据
没有新增 UI 设计;仅扩大现有
HistoryClearedMarker的触发条件。改动后仍使用原有结构、设计 token 和 i18n 文案:DESIGN.md 说明:不涉及新的视觉决策,复用已有组件及
--border-default、--text-tertiary设计变量。验证
已通过
pnpm --filter desktop db:validate:全部 6 个迁移校验步骤通过。pnpm --filter desktop exec vitest run src/main/localDb/__tests__/migrationReplay.test.ts:6/6 通过。sessionListProjection.test.ts:9/9 通过。pnpm --filter desktop typecheck:通过。环境限制 / 未完整通过
pnpm --filter desktop test:migration-replay的包装脚本在测试前下载无关 Pi 0.84.4 runtime 时失败;同一迁移回放测试已直接执行并 6/6 通过。pnpm test:unit:related因当前 fork 基线较旧而扩大到全仓:脚本 runner、mobile 和其他 package 通过;desktop 有 30,516 个通过、97 个跳过,并出现 2 个与本改动无关的 Windows 环境失败(真实命令执行超时、创建 symlink 时 EPERM)。风险与回滚
影响:只增加一个可空时间字段;旧数据和旧投影均通过可选字段兼容。维护逻辑在迁移列尚不存在时会安全跳过写入。
回滚:可以回退读写和展示逻辑;已应用的追加式迁移会留下未使用的可空列,不需要破坏性删除列。
提交检查
upstream/main