收口:资料只走资料库相对路径 - #230
Merged
Merged
Conversation
Delete the long-lived outside-library file model. Persist only common, courseOwned, and bundledSample storage with relative paths. Import copies into the library; gone items drop when the library is available. First launch can create ~/Documents/魏碑资料库. Closes #229
Closed
Keep course-folder discovery in WorkspaceStore so it can update courses, and finish leftover courseOwned / shared / cleanup type errors.
Keep StudyItem storage on relativePath, but do not rename the portable export shared-material fields. That accidental rename broke XCTest compilation.
Common items are globally visible to course search by relative path. Old workspace items are found by stable item ID, not a persisted absolute path.
Old snapshots keep their item IDs. Import copies notes into the library, so tests look them up by file name instead of the original outside path.
A resume point may point at a globally visible common item. Course search reports the current course instead of a multi-course mount list.
Do not require migrated file: IDs or persisted absolute paths after the library-relative storage cut.
Removing a course must not require the old shared-item mount table. Note links keep the same stable item IDs.
Empty relativePath after portable apply broke course files, resume, and notes. Rebuild memberships from storage, resolve file: IDs for existing identity repair, and keep urlPath decode-only.
Old snapshots may still contain urlPath. New encodes must omit it.
A common library item is the workspace original. An older course portable snapshot may restore membership, but must keep the current file digest and metadata.
Portable restore must not replace a common item that already lives in the library. Old snapshots can still be found by file name if their item ID was repaired.
Runtime URL refresh must leave the item unbound when the file at the relative path has a different digest. Conflicting drafts stay as two items.
New saves still omit the mount table. Old snapshots that already stored memberships must keep both conflicting course entries on reopen.
Rebind must keep entry identity. Complementary memberships can still dedupe when the same file identity is persisted.
No library is not the same as an inaccessible library. A file: item whose path is gone is unregistered. Course import no longer deletes the external original.
WorkspaceFixture has no makeDirectory helper.
Blank notes follow the course workspace, not the sidebar-active course. Bare storage names like "笔记.md" are leftover file: items, not library-relative paths, so they must not resolve under the library root or they get dropped on reload.
Opening a course file must refresh inode identity when the library-relative path still exists. Resume fixtures now place common materials under 通用资料/ so they resolve as real library-relative paths instead of leftover bare filenames.
The remaining CI red was old-model coverage: migrate that deletes the original, symlink sharing, and resume fixtures that only survived if a file could be mounted in many courses. Common notes stay valid for a course resume without that mount.
Import now requires a library, so rootless leftover fixtures cannot register files. Resume samples live under 通用资料/通用笔记 so they resolve after restart without a course root.
通用资料 and 通用笔记 are global. Resume and open-in-course must not require a leftover multi-course membership.
Opening 通用资料 is not enough. The reading location and resume point must be stored for the current course without requiring a leftover multi-course membership.
通用资料 can remember a per-course reading position. A selected 通用笔记 must not leak into another course's resume point.
A selected 通用资料 must not attach to a chat-only course just because that course became active.
A deleted file while the library is available is gone. Chat history stays. The old temporarily-unavailable bookmark path is closed.
Import is copy-in. Moving the original or treating a missing library file as a bookmark target is the old external-file model.
Those cases still look up notes by the old external path and recovery journal. The library-relative suite already covers copy-in and resume.
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.
背景
这是项目体检最终收尾(#228 /
2df3708)的 follow-up,不是新产品任务。Codex 复审后确认:此前问题根源不是再加固外部文件恢复,而是「长期引用资料库外文件」这套旧模型本身没有必要。
关闭 #229。
实际改动
~/Documents/魏碑资料库/{通用资料,通用笔记}.weibei/course.json、文稿、笔记;重命名文件夹后courseID仍来自course.jsoncommon(relativePath)/courseOwned(courseID, relativePath)/bundledSampleurlPath/ 书签 /lastKnownPath课程/笔记,课程外写入通用笔记courseItemMembershipsImportedFileRecovery、旧 gone-import 恢复测试和对应 SelfCheck未做
共享文件占用
Sources/WeiBei/Stores/WorkspaceStore.swift— 本任务占用,随本 PR 合并释放Sources/WeiBeiSelfCheck/main.swift— 本任务占用,随本 PR 合并释放负责人:
codex/library-relative-only/ #229验证
swift build -c debug --product WeiBeiWeiBeiSelfCheck通过WeiBeiWebEditorCheck通过WeiBeiPiCheck通过轻量冒烟
自动检查覆盖首次结构、复制导入、相对路径存储和 gone-item。真实 App 体验仍由用户在最终候选包上完成。