Skip to content

设置新增资料库位置迁移入口(重执行方案任务一) - #293

Merged
taekchef merged 1 commit into
mainfrom
codex/library-location-setting
Aug 22, 2026
Merged

taekchef merged 1 commit into
mainfrom
codex/library-location-setting

Conversation

@taekchef

@taekchef taekchef commented Aug 22, 2026 •

Copy link
Copy Markdown
Collaborator

[growth-exempt: WorkspaceStore.swift +4 行(libraryMigrationInFlight 挂起接线与 flush 补排空),方案阶段4 拆除冗余锁时随重构净减]

背景

重执行《文件模型收敛与资料库迁移入口》方案任务一。方案文档随本 PR 入库(Docs/plans/2026-08-22-file-model-convergence-and-library-relocation.md)。改动迁移自原 #277(已被整线回退,代码当时 CI 绿、回退核验无越界),基于最新 main 重新验证。

实际改动

  • migrateLibrary(to:)(WorkspaceStore+LibraryRoot.swift):前置校验(嵌套/上级/相等/非空/合法库)、同卷原子移动、跨卷暂存目录逐项搬运+失败回滚、重绑+refreshRuntimeItemURLs+逐课程清单校验、完成后补排空挂起写回并持久化
  • CourseProjectRootError 新增迁移错误分支(含用户文案)
  • 迁移期间挂起:reconcileCourseFilesNow / scheduleCourseNoteLoad / flushPendingNotePersistence(for:) / persistCurrentNote(libraryMigrationInFlight 标志)
  • 设置页新增「资料库」组:路径显示+更改…+确认框(云同步目录黄色提示不阻止)+行内进度/错误+认领已有库流程
  • LibraryMigrationSafetyTests:双目录迁移/嵌套非空拒绝/认领已有库/失败保原库/挂起恢复

未做内容

  • swift test 由 CI 执行(本机无 Xcode)
  • 用户真实冒烟在全部阶段合入后统一进行(方案 §9)

共享核心面占用

  • Sources/WeiBei/Stores/WorkspaceStore.swift:仅本 PR 修改,合并即释放
  • 迁移属文件移动类操作,专项自动验证=LibraryMigrationSafetyTests 五用例

验证

  • 本地 swift build ✅、swift run WeiBeiSelfCheck ✅
  • CI 快速编译与核心自检 + 全量安全测试

回退自查表

指标 作答
可见性不回退 新增设置组,未动既有横幅/状态
数据安全不回退 迁移失败原库纹丝不动(专项测试);未拆任何旧锁
编辑不回退 迁移前 flushPendingNotePersistence 先落盘
性能不回退 仅用户点「更改…」时执行,无常驻开销
功能不回退 不改磁盘格式;认领流程复用既有绑定校验
可逆 单 PR revert 即恢复

@taekchef taekchef added the growth-exempt 维护者批准冻结核心文件超过 50 行的净增长 label Aug 22, 2026
@taekchef taekchef closed this Aug 22, 2026
@taekchef taekchef reopened this Aug 22, 2026
@taekchef
taekchef merged commit a68ad2d into main Aug 22, 2026
3 of 8 checks passed
@taekchef
taekchef deleted the codex/library-location-setting branch August 22, 2026 07:03
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