fix: avoid history reclamation during structure-only upgrades

Ordinary database schema upgrades previously ran VACUUM on free pages and
showed misleading history-cleanup progress. Separate structure upgrades from
required legacy conversions, retaining reclamation intent only for retries
within the same startup. Preserve released data without new schema versions
or persistent migration markers; Agent and normal writes remain unchanged.

Add real SQLite and Worker regressions, bilingual operation-specific startup
copy, and migration documentation. Synchronize native Electron drag input
with actual resize state without weakening layout assertions.

Validation: 47 focused migration tests passed; typecheck, lint and diff checks
passed. Final full suite: 5137 passed, 74 skipped, 2 unrelated Electron failures.
Both failing Electron tests passed an isolated rerun; full CI remains unverified.

Release note: 修复普通数据库结构升级再次整理历史和回收空间的问题;仅在需要转换旧数据时执行相关处理,启动页准确显示当前升级操作。
This commit is contained in:
mesalogo
2026-09-26 12:42:08 +08:00
parent e6ac0734de
commit 4c7193e1ea
21 changed files with 441 additions and 61 deletions
@@ -1,5 +1,30 @@
# 工作栏实现与验证进度
## 2026-09-26 结构升级与历史回收分离(未发布)
- schema 45/46 的回归先复现普通结构升级执行 `VACUUM`,修复后不转换历史、
不回收正常空闲页,保留聊天、笔记、事件及 SQLite 完整性。
- 启动决定在内存中分别保留笔记转换与回收需求,Worker 重试复用原决定;
不增加 schema 或持久标记,不修改正常写入。规则见
[旧库升级](./execution-history-storage.md#旧库升级)。
- 真实 Node Worker 验证结构升级、旧笔记转换、取消与重试、文件大小和内容保留;
启动调度回归验证允许/禁止回收的两种重试,中英文页面区分实际操作。
六个定向测试文件 **47 项通过**,类型检查、lint 和 `git diff --check` 通过。
- 完整 `npm test`:**5,138 通过、74 跳过、1 失败**。未修改的
`tests/magic-notes-layout.electron.test.ts` 原生拖拽断言失败:首次索引列保持 168,
单独复跑则 AI 列保持 280,均未达到拖动后的预期宽度。该 fixture 直接加载
Magic Notes 和模拟 API,不运行本次存储升级路径。随后修正测试的原生输入同步:
等待焦点、拖拽建立、宽度更新及结束,并明确左键按下状态,未弱化断言或改变产品
布局;独立复跑及随后完整测试中的该用例通过。
- 最终完整重跑:**5,137 通过、74 跳过、2 失败**,迁移相关及布局拖拽均通过。
`inline-help.electron.test.ts` 超时,`overlay-layering.electron.test.ts` 子进程退出码
为 null;这两个未修改的用例随后一起独立复跑 **2 项通过**,未提高超时或修改断言。
最终 typecheck、lint、`git diff --check` 均通过。独立复跑不替代完整测试结果,
不宣称本次全量或 CI 全绿。
- 本机与托管 SSH 历史共用 Desktop 数据库升级路径;Agent、Runtime、模型桥和
远程协议未变,不需要部署 Host 补丁。本次未调用模型,未改写用户数据库,
尚无本次修复的 CI 或发布验证。
## 2026-09-21 重复历史迁移补修(Desktop 0.13.9 候选)
- 0.13.8 的检查仍在已有笔记时把 `freelist_count > 0` 当作迁移依据;正常聊天更新