Skip to content

收口:课程与资料只走当前资料库 - #232

Merged
taekchef merged 10 commits into
mainfrom
codex/library-inside-only
Aug 16, 2026
Merged

收口:课程与资料只走当前资料库#232
taekchef merged 10 commits into
mainfrom
codex/library-inside-only

Conversation

@taekchef

@taekchef taekchef commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Follow-up after #230. Closes leftover outside-library course adoption and absolute-path fallbacks. Keeps in-library shared references and course relations.

占用:

  • Sources/WeiBei/Stores/WorkspaceStore.swift
  • Sources/WeiBeiSelfCheck/main.swift
  • .github/workflows/pr-checks.yml

释放:本 PR 合并或关闭后。

改动:

  • 删除「纳入已有文件夹」产品入口
  • 课程必须是当前资料库顶层文件夹;不再保存课程绝对路径 / 独立书签
  • 删除 legacyFileURL、file: 回退、持久化 urlPath 解码、缺 storage 猜测
  • resolvedLibraryURL 只走 CourseProjectPathPolicy.resolvedRelativePath
  • 通用资料仍可通过库内符号链接用于多门课
  • 剩余 XCTest 改为资料库内 adopt;缺 storage 的旧 file: 快照丢弃后重新导入
  • XCTest 下 course-file wait 45 秒超时;CI 行缓冲输出步骤名

验证:

  • 本地 swift run WeiBeiSelfCheck 通过
  • CI swift test --filter WeiBeiSafetyTests

Close leftover outside-library course adoption and absolute-path
fallbacks. Keep in-library shared references and course relations.
Reject outside-library course adoption and stop persisting course
absolute paths or bookmarks. Resolve library files only through
CourseProjectPathPolicy.resolvedRelativePath so ../ and outbound
symlinks cannot escape. Keep in-library shared references.
Those scenes required adopting a folder outside the current library
or guessing storage from a leftover file: snapshot.
A new workspace must choose the library before it can open a
course folder. Old file: snapshots are written as raw JSON so
they stay storage-less and are discarded on load.
CI still failed because portable-state and export-adoption tests
adopted folders after the library was cleared, and the offline
file: leftover was created via StudyItem.init (which injects
common("")) instead of a raw snapshot without storage.
The previous run compiled tests then sat in xctest until the 15-minute
job limit, with no suite output. Emit step names and keep the job
alive long enough to see which leftover adopt actually hangs.
XCTest classes that construct WorkspaceStore without setting
WEIBEI_SAFETY_TEST_MODE were creating ~/Documents/魏碑资料库 and
hanging the CI job on macOS TCC. Treat an XCTest process as test
mode and drop the diagnostic timeout/verbose noise.
SwiftPM does not set XCTestConfigurationFilePath, and
LibraryRelativeOnlyTests created a WorkspaceStore without the
WEIBEI_SAFETY_TEST_MODE env var. A constructor plus class setUp
prevents default-library bootstrap from hanging CI.
SwiftPM rejects C and Swift in the same test target. Keep the
LibraryRelativeOnlyTests setUp so every store-creating class sets
WEIBEI_SAFETY_TEST_MODE before constructing WorkspaceStore.
CI has been dying at the job limit with no suite output after the
leftover in-library adopt fixes. Time out waitForCourseFileOperation
in safety-test mode and print unbuffered step names so the next run
names the stuck path.
@taekchef
taekchef marked this pull request as ready for review August 16, 2026 18:17
@taekchef
taekchef merged commit 40ab1df into main Aug 16, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant