收口:课程与资料只走当前资料库 - #232
Merged
Merged
Conversation
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.
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.
Follow-up after #230. Closes leftover outside-library course adoption and absolute-path fallbacks. Keeps in-library shared references and course relations.
占用:
释放:本 PR 合并或关闭后。
改动:
验证:
swift run WeiBeiSelfCheck通过swift test --filter WeiBeiSafetyTests