Skip to content

阶段2: 副本先行与外部删除保护 - #286

Merged
taekchef merged 5 commits into
mainfrom
codex/filemodel-phase2-backup-first
Aug 22, 2026
Merged

taekchef merged 5 commits into
mainfrom
codex/filemodel-phase2-backup-first

Conversation

@taekchef

@taekchef taekchef commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

[growth-exempt: WorkspaceStore.swift +11 行(fileMissingSinceByItemID 灰态状态字典、removeItemRegistration 清理、两处副本先行接入),阶段4 重构将随冗余锁拆除净减]

实际改动

  • 采用外部内容前副本先行:applyCourseFileObservations 检出外部改动、scheduleCourseNoteLoad 静默采纳磁盘时,先把未落盘内容(pending/草稿)入备份环
  • 外部删除灰态保护:文件首缺席置 fileMissingSinceByItemID 保留条目并显示「文件不存在」;连续两个对账周期(≈6 秒)仍缺席才移除,移除前未落盘内容副本先行;文件重现按相对路径认领回同一 itemID
  • 冲突条修复:resolveNoteEditorRecoveryConflict(useDisk: true) 执行前用户版本先入备份环,按钮 help 注明「魏碑中的修改已存入备份」
  • 阶段 0 两个预期失败测试转正式;新增 goneItemGraysAndReclaims / goneItemRemovalBacksUpDraft

未做内容

  • 编辑器 dirty checkpoint 判定源由 pending/草稿覆盖
  • swift test 由 CI 执行

共享核心面占用

  • WorkspaceStore.swift / NotesAgentView.swift / Tests/;合并即释放

验证命令

  • swift build ✅ / WeiBeiSelfCheck ✅ / check_file_growth ✅(豁免标签)
  • swift test → CI

回退自查表(六条)

  1. 可见性:灰态条内状态可见性提升,通过
  2. 数据安全:销毁前必有副本,通过
  3. 编辑:dirty 守卫全保留,通过
  4. 性能:低频点才触发备份,通过
  5. 功能:全部保功能,通过
  6. 可逆:独立提交可整体回滚,通过

- 采用外部内容前副本先行: applyCourseFileObservations/scheduleCourseNoteLoad 检出外部改动时先把未落盘内容入备份环
- 外部删除灰态: 首缺席置 fileMissingSince 保留条目,两个对账周期仍缺席才移除,移除前副本先行;文件重现按相对路径认领回原 itemID
- 灰态条目 displaySubtitle 显示「文件不存在」
- 冲突条选「使用磁盘版本」前用户版本先入备份环,按钮注明已存备份
- 阶段0 两个预期失败测试转正式;新增 goneItemGraysAndReclaims/goneItemRemovalBacksUpDraft
@taekchef
taekchef marked this pull request as ready for review August 21, 2026 23:32
@taekchef taekchef added the growth-exempt 维护者批准冻结核心文件超过 50 行的净增长 label Aug 21, 2026
@taekchef taekchef closed this Aug 21, 2026
@taekchef taekchef reopened this Aug 21, 2026
@taekchef
taekchef merged commit 3ad6368 into main Aug 22, 2026
3 of 4 checks passed
taekchef added a commit that referenced this pull request Aug 22, 2026
…gence

revert: 回退文件模型收敛与库迁移方案全部已合并 PR(#277 #280 #281 #286)
@taekchef
taekchef deleted the codex/filemodel-phase2-backup-first branch August 22, 2026 01:19
wang-kaopu pushed a commit to wang-kaopu/weibei that referenced this pull request Aug 22, 2026
…model-phase2-backup-first"

This reverts commit 3ad6368, reversing
changes made to 468a6f5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

growth-exempt 维护者批准冻结核心文件超过 50 行的净增长

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant