From 68aa885cad6ca63357bbb339f80d6b9894610339 Mon Sep 17 00:00:00 2001 From: taekchef Date: Sat, 22 Aug 2026 10:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B6=E6=AE=B53:=20=E5=AE=B9=E6=96=AD?= =?UTF-8?q?=E4=B8=8E=20iCloud=20=E5=8D=A0=E4=BD=8D=E7=AC=A6=E2=80=94?= =?UTF-8?q?=E2=80=94=E6=89=AB=E6=8F=8F=E5=99=A8=E5=8D=A0=E4=BD=8D=E7=AC=A6?= =?UTF-8?q?=E8=BF=98=E5=8E=9F+=E6=B0=B8=E4=B8=8D=E5=88=A4=E5=88=A0+?= =?UTF-8?q?=E6=A8=AA=E5=B9=85=E9=99=8D=E6=A0=BC;=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8C=82=E7=82=B9=E6=A0=B9=E5=9B=A0=E4=BF=AE=E5=A4=8D(async=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=C3=97=E5=90=8C=E6=AD=A5RunLoop=20=E6=B3=B5,?= =?UTF-8?q?=E6=94=B9=20sync)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Stores/CourseProjectRootSupport.swift | 81 ++++++- .../WorkspaceStore+GoneImportedItems.swift | 8 +- .../Stores/WorkspaceStore+LibraryRoot.swift | 9 +- .../WorkspaceStore+NotesPersistence.swift | 18 +- Sources/WeiBei/Stores/WorkspaceStore.swift | 32 ++- .../TransientToleranceSafetyTests.swift | 212 ++++++++++++++++++ 6 files changed, 341 insertions(+), 19 deletions(-) create mode 100644 Tests/WeiBeiSafetyTests/TransientToleranceSafetyTests.swift diff --git a/Sources/WeiBei/Stores/CourseProjectRootSupport.swift b/Sources/WeiBei/Stores/CourseProjectRootSupport.swift index 1058732e5..f082ce807 100644 --- a/Sources/WeiBei/Stores/CourseProjectRootSupport.swift +++ b/Sources/WeiBei/Stores/CourseProjectRootSupport.swift @@ -97,6 +97,8 @@ struct CourseFileSourceInfo: Equatable, Sendable { enum CourseFileEntryPresence: Equatable, Sendable { case present(ImportedFileIdentity) + /// iCloud 占位符在而实体未下载(计划 §5 阶段3):永不判 absent。 + case presentUnmaterialized(ImportedFileIdentity) case absent case inaccessible } @@ -2649,7 +2651,9 @@ actor CourseProjectFileWorker { guard let enumerator = fileManager.enumerator( at: canonicalRoot, includingPropertiesForKeys: Array(keys), - options: [.skipsHiddenFiles, .skipsPackageDescendants], + // 不再一刀切跳过隐藏文件:iCloud 占位符 `.名字.md.icloud` 是隐藏文件, + // 必须识别为逻辑路径(计划 §5 阶段3);其余隐藏项在循环内显式跳过。 + options: [.skipsPackageDescendants], errorHandler: { _, _ in false } ) else { return CourseFileScanSnapshot( @@ -2674,6 +2678,19 @@ actor CourseProjectFileWorker { enumerator.skipDescendants() continue } + // iCloud 占位符还原为逻辑路径;其余隐藏项维持跳过。 + let icloudLogicalName = Self.logicalName( + forICloudPlaceholderFileName: rawURL.lastPathComponent + ) + if rawURL.lastPathComponent.hasPrefix(".") { + guard let icloudLogicalName else { + if (try? rawURL.resourceValues(forKeys: [.isDirectoryKey]))? + .isDirectory == true { + enumerator.skipDescendants() + } + continue + } + } let values = try rawURL.resourceValues(forKeys: keys) if values.isDirectory == true { if Self.ignoresImportDirectory(rawURL) { @@ -2714,27 +2731,39 @@ actor CourseProjectFileWorker { fileURL = rawURL.standardizedFileURL fileValues = values } + // 占位符按逻辑路径登记:扩展名与相对路径取自还原后的逻辑名。 + let effectiveName = icloudLogicalName ?? fileURL.lastPathComponent + let effectiveRelativePath: String + if let icloudLogicalName { + let dir = (relativePath as NSString).deletingLastPathComponent + effectiveRelativePath = dir.isEmpty + ? icloudLogicalName + : dir + "/\(icloudLogicalName)" + } else { + effectiveRelativePath = relativePath + } guard Self.supportedExtensions.contains( - fileURL.pathExtension.lowercased() + URL(fileURLWithPath: effectiveName) + .pathExtension.lowercased() ), let identity = Self.identity(at: fileURL) else { continue } let identityKey = - "\(identity.volumeID).\(identity.fileID).\(relativePath)" + "\(identity.volumeID).\(identity.fileID).\(effectiveRelativePath)" if visitedFileKeys.contains(identityKey) { continue } visitedFileKeys.insert(identityKey) - let firstComponent = relativePath + let firstComponent = effectiveRelativePath .split(separator: "/", omittingEmptySubsequences: true) .first let isMarkdown = ["md", "markdown"] - .contains(fileURL.pathExtension.lowercased()) + .contains(URL(fileURLWithPath: effectiveName).pathExtension.lowercased()) result.append( CourseFileMetadata( url: fileURL, - relativePath: relativePath, + relativePath: effectiveRelativePath, identity: identity, documentIdentifier: fileValues.documentIdentifier.flatMap { $0 >= 0 ? UInt64($0) : nil @@ -3536,10 +3565,48 @@ actor CourseProjectFileWorker { ) } return errno == ENOENT || errno == ENOTDIR - ? .absent + ? presenceWithICloudPlaceholderCheck(at: url) : .inaccessible } + /// 逻辑路径实体缺席但同名 iCloud 占位符在 ⇒ 未物化在场,永不判 absent。 + nonisolated private static func presenceWithICloudPlaceholderCheck( + at url: URL + ) -> CourseFileEntryPresence { + let placeholder = url.deletingLastPathComponent() + .appendingPathComponent("." + url.lastPathComponent + ".icloud") + var fileStat = Darwin.stat() + let result = placeholder.withUnsafeFileSystemRepresentation { path -> Int32 in + guard let path else { return -1 } + return Darwin.lstat(path, &fileStat) + } + guard result == 0 else { return .absent } + return .presentUnmaterialized( + ImportedFileIdentity( + volumeID: UInt64(fileStat.st_dev), + fileID: UInt64(fileStat.st_ino), + birthTimeSeconds: Int64( + fileStat.st_birthtimespec.tv_sec + ), + birthTimeNanoseconds: Int64( + fileStat.st_birthtimespec.tv_nsec + ) + ) + ) + } + + /// iCloud 占位符文件名 `.讲义.md.icloud` ⇒ 逻辑名 `讲义.md`;非占位符返回 nil。 + nonisolated static func logicalName( + forICloudPlaceholderFileName fileName: String + ) -> String? { + guard fileName.hasPrefix("."), fileName.hasSuffix(".icloud") else { + return nil + } + let base = fileName.dropFirst().dropLast(".icloud".count) + guard !base.isEmpty, base.contains(".") else { return nil } + return String(base) + } + nonisolated static func isSymbolicLink(at url: URL) -> Bool { var fileStat = Darwin.stat() guard url.withUnsafeFileSystemRepresentation({ path in diff --git a/Sources/WeiBei/Stores/WorkspaceStore+GoneImportedItems.swift b/Sources/WeiBei/Stores/WorkspaceStore+GoneImportedItems.swift index 07a6ff7da..ed1dda7c2 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore+GoneImportedItems.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore+GoneImportedItems.swift @@ -27,7 +27,7 @@ extension WorkspaceStore { switch CourseProjectFileWorker.entryPresence(at: libraryRoot) { case .absent, .inaccessible: return keepUnavailableImportedItem(at: index) - case .present: + case .present, .presentUnmaterialized: break } } @@ -38,12 +38,16 @@ extension WorkspaceStore { case .present: fileMissingSinceByItemID.removeValue(forKey: item.id) return (candidate.standardizedFileURL, false) + case .presentUnmaterialized: + // iCloud 占位符在:永不判缺席,也不进入灰态(计划 §5 阶段3)。 + fileMissingSinceByItemID.removeValue(forKey: item.id) + return (candidate.standardizedFileURL, false) case .inaccessible: return keepUnavailableImportedItem(at: index) case .absent: let parent = candidate.deletingLastPathComponent() switch CourseProjectFileWorker.entryPresence(at: parent) { - case .present: + case .present, .presentUnmaterialized: // 灰态保护(计划 §5 阶段2):iCloud 瞬断/同步延迟期间文件缺席 // 不立即销毁条目;连续两个对账周期(≈6 秒)仍缺席才移除, // 移除前对未落盘内容副本先行。文件重新出现按相对路径认领回原条目。 diff --git a/Sources/WeiBei/Stores/WorkspaceStore+LibraryRoot.swift b/Sources/WeiBei/Stores/WorkspaceStore+LibraryRoot.swift index 7980bf95e..761cac719 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore+LibraryRoot.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore+LibraryRoot.swift @@ -249,8 +249,15 @@ extension WorkspaceStore { switch CourseProjectFileWorker.entryPresence(at: url) { case .absent, .inaccessible: importedItems[index].urlPath = nil + case .presentUnmaterialized: + // iCloud 占位符:保留路径供点开时触发系统下载(计划 §5 阶段3)。 + importedItems[index].urlPath = url.path case .present: - if let expectedDigest = importedItems[index].contentDigest, + // 阶段3 拆除启动指纹断链(笔记部分):digest 不符不再切断路径, + // 交给对账以文件为准;资料项(非笔记)世代保护保留。 + let isNote = importedItems[index].isNotebookNote + if !isNote, + let expectedDigest = importedItems[index].contentDigest, let actual = try? CourseProjectFileWorker.snapshotFile(at: url), actual.sha256 != expectedDigest { importedItems[index].urlPath = nil diff --git a/Sources/WeiBei/Stores/WorkspaceStore+NotesPersistence.swift b/Sources/WeiBei/Stores/WorkspaceStore+NotesPersistence.swift index a073967cb..fa2671765 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore+NotesPersistence.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore+NotesPersistence.swift @@ -482,7 +482,23 @@ extension WorkspaceStore { WeiBeiLog.noteRepair.error("note file error raised: \(message, privacy: .public)") } if !alreadyRecorded, activeNoteItemID == itemID { - showImportantOperationError(message) + // 阶段3 横幅降格(计划 §5 阶段3):文件缺席/未物化等不可用场景 + // 只保留条内状态,不再弹重要操作横幅;其余真实错误维持横幅。 + let itemUnavailable: Bool = { + guard let item = importedItems.first(where: { $0.id == itemID }), + let url = resolvedLibraryURL(for: item) else { + return true + } + switch CourseProjectFileWorker.entryPresence(at: url) { + case .present: + return false + case .presentUnmaterialized, .absent, .inaccessible: + return true + } + }() + if !itemUnavailable { + showImportantOperationError(message) + } } } else { let cleared = noteOperationErrorsByItemID.removeValue(forKey: itemID) diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index a6b6ab043..55fd100c9 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -6162,7 +6162,7 @@ final class WorkspaceStore: ObservableObject { switch CourseProjectFileWorker.entryPresence(at: libraryRoot) { case .absent, .inaccessible: return - case .present: + case .present, .presentUnmaterialized: break } let reserved: Set = [ @@ -18576,6 +18576,12 @@ final class WorkspaceStore: ObservableObject { ) else { return } + if case .presentUnmaterialized = CourseProjectFileWorker.entryPresence(at: access.url) { + setNoteFileError( + ui("正在从 iCloud 下载…", "Downloading from iCloud…"), + for: item.id + ) + } let url = access.url let identity = access.fileIdentity let itemID = item.id @@ -18661,11 +18667,21 @@ final class WorkspaceStore: ObservableObject { guard courseNoteLoadGenerationByItemID[itemID] == generation else { return } + let presence = CourseProjectFileWorker.entryPresence(at: url) + let unmaterialized: Bool = { + if case .presentUnmaterialized = presence { return true } + return false + }() setNoteFileError( - ui( - "无法读取原 Markdown:\(url.lastPathComponent)", - "Could not read original Markdown: \(url.lastPathComponent)" - ), + unmaterialized + ? ui( + "当前不可用,iCloud 文件未下载。", + "Currently unavailable; the iCloud file has not been downloaded." + ) + : ui( + "无法读取原 Markdown:\(url.lastPathComponent)", + "Could not read original Markdown: \(url.lastPathComponent)" + ), for: itemID ) } @@ -19380,7 +19396,7 @@ final class WorkspaceStore: ObservableObject { documentIdentifier: UInt64? )? { switch CourseProjectFileWorker.entryPresence(at: candidate) { - case .absent: + case .absent, .presentUnmaterialized: return nil case .inaccessible: throw CoursePortableStateError.unsafeRelativePath @@ -19457,7 +19473,7 @@ final class WorkspaceStore: ObservableObject { throw CoursePortableStateError.crossCourseReference } switch CourseProjectFileWorker.entryPresence(at: candidate) { - case .absent: + case .absent, .presentUnmaterialized: return nil case .inaccessible: throw CoursePortableStateError.crossCourseReference @@ -19498,7 +19514,7 @@ final class WorkspaceStore: ObservableObject { sharedURL: URL ) throws -> ImportedFileIdentity? { switch CourseProjectFileWorker.entryPresence(at: candidate) { - case .absent: + case .absent, .presentUnmaterialized: return nil case .inaccessible: throw CoursePortableStateError.invalidItemStorage diff --git a/Tests/WeiBeiSafetyTests/TransientToleranceSafetyTests.swift b/Tests/WeiBeiSafetyTests/TransientToleranceSafetyTests.swift new file mode 100644 index 000000000..8ee34fe1f --- /dev/null +++ b/Tests/WeiBeiSafetyTests/TransientToleranceSafetyTests.swift @@ -0,0 +1,212 @@ +import Foundation +@testable import WeiBei +import WeiBeiCore +import XCTest + +/// 阶段3 容断与 iCloud 占位符专项验证(计划 §5 阶段3 第5步)。 +@MainActor +final class TransientToleranceSafetyTests: XCTestCase { + override class func setUp() { + super.setUp() + setenv("WEIBEI_SAFETY_TEST_MODE", "1", 1) + } + + private func makeTempRoot(_ name: String) -> URL { + let root = FileManager.default.temporaryDirectory + .appendingPathComponent("\(name)-\(UUID().uuidString)", isDirectory: true) + try? FileManager.default.createDirectory(at: root, withIntermediateDirectories: true) + return root + } + + private func makeStore(base: URL, library: URL) throws -> WorkspaceStore { + try FileManager.default.createDirectory(at: workspaceDir(base), withIntermediateDirectories: true) + try FileManager.default.createDirectory(at: library, withIntermediateDirectories: true) + let store = WorkspaceStore( + workspaceDirectory: workspaceDir(base), + startsAtBlankEntries: true, + startsCourseFileMaintenance: false + ) + try store.configureCourseLibrary(at: library) + return store + } + + private func workspaceDir(_ base: URL) -> URL { + base.appendingPathComponent("workspace", isDirectory: true) + } + + private func reconcile(_ store: WorkspaceStore) throws { + try store.waitForCourseFileOperation { + await store.reconcileCourseFilesNow() + } + } + + func testPlaceholderLogicalNameParsing() { + XCTAssertEqual( + CourseProjectFileWorker.logicalName(forICloudPlaceholderFileName: ".讲义.md.icloud"), + "讲义.md" + ) + XCTAssertEqual( + CourseProjectFileWorker.logicalName(forICloudPlaceholderFileName: ".论文.pdf.icloud"), + "论文.pdf" + ) + XCTAssertNil(CourseProjectFileWorker.logicalName(forICloudPlaceholderFileName: "讲义.md")) + XCTAssertNil(CourseProjectFileWorker.logicalName(forICloudPlaceholderFileName: ".DS_Store")) + XCTAssertNil(CourseProjectFileWorker.logicalName(forICloudPlaceholderFileName: ".icloud")) + } + + func testEntryPresenceNeverAbsentWhenPlaceholderExists() throws { + let base = makeTempRoot("weibei-phase3-presence") + defer { try? FileManager.default.removeItem(at: base) } + let dir = base.appendingPathComponent("课程", isDirectory: true) + try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) + let logical = dir.appendingPathComponent("讲义.md") + let placeholder = dir.appendingPathComponent(".讲义.md.icloud") + try "占位".write(to: placeholder, atomically: true, encoding: .utf8) + + guard case .presentUnmaterialized = CourseProjectFileWorker.entryPresence(at: logical) else { + return XCTFail("逻辑路径缺席但占位符在,应为 presentUnmaterialized") + } + try FileManager.default.removeItem(at: placeholder) + guard case .absent = CourseProjectFileWorker.entryPresence(at: logical) else { + return XCTFail("占位符删除后应为 absent") + } + } + + + func testGrayStateNotEnteredForPlaceholder() throws { + let base = makeTempRoot("weibei-phase3-gray") + defer { try? FileManager.default.removeItem(at: base) } + let library = base.appendingPathComponent("资料库", isDirectory: true) + let store = try makeStore(base: base, library: library) + let courseID = try store.createCourseInLibrary(title: "占位课") + + let realSource = base.appendingPathComponent("讲义.md") + try "讲义正文".write(to: realSource, atomically: true, encoding: .utf8) + let imported = try store.importFileIntoCourseForSelfCheck(realSource, courseID: courseID, role: .material) + let item = imported.item + let backingURL = try XCTUnwrap(store.resolvedLibraryURL(for: item)) + + // Finder 里实体被驱逐成 iCloud 占位符(内容替换为占位文件形态)。 + try FileManager.default.removeItem(at: backingURL) + try "占位".write( + to: backingURL.deletingLastPathComponent() + .appendingPathComponent("." + backingURL.lastPathComponent + ".icloud"), + atomically: true, encoding: .utf8 + ) + + try reconcile(store) + + XCTAssertNil(store.fileMissingSinceByItemID[item.id], "占位符在场不得进入灰态") + XCTAssertNotNil(store.importedItems.first { $0.id == item.id }, "条目必须保留") + XCTAssertEqual(store.displaySubtitle(for: item), item.subtitle) + } + + func testStartupDigestMismatchDoesNotUnlinkNotes() throws { + let base = makeTempRoot("weibei-phase3-unlink") + defer { try? FileManager.default.removeItem(at: base) } + let library = base.appendingPathComponent("资料库", isDirectory: true) + let store = try makeStore(base: base, library: library) + let courseID = try store.createCourseInLibrary(title: "断链课") + let source = base.appendingPathComponent("笔记.md") + try "原始正文".write(to: source, atomically: true, encoding: .utf8) + let imported = try store.importFileIntoCourseForSelfCheck(source, courseID: courseID, role: .material) + let item = imported.item + let backingURL = try XCTUnwrap(store.resolvedLibraryURL(for: item)) + + // 外部改动:digest 与记录不符。 + try "外部修改后的内容".write(to: backingURL, atomically: true, encoding: .utf8) + store.refreshRuntimeItemURLs() + + XCTAssertNotNil( + store.importedItems.first { $0.id == item.id }?.urlPath, + "笔记 digest 不符不再启动断链,路径必须保留(计划 §5 阶段3)" + ) + } + + func testStartupGenerationProtectionKeptForMaterials() throws { + let base = makeTempRoot("weibei-phase3-generation") + defer { try? FileManager.default.removeItem(at: base) } + let library = base.appendingPathComponent("资料库", isDirectory: true) + let store = try makeStore(base: base, library: library) + let courseID = try store.createCourseInLibrary(title: "世代课") + let source = base.appendingPathComponent("资料.pdf") + try Data("%PDF-1.4\n旧".utf8).write(to: source, options: [.atomic]) + let imported = try store.importFileIntoCourseForSelfCheck(source, courseID: courseID, role: .material) + let item = imported.item + let backingURL = try XCTUnwrap(store.resolvedLibraryURL(for: item)) + let oldIdentity = item.importedFileIdentity + + // 删除重建:新文件世代不同(identity 变化 + 内容变化)。 + try FileManager.default.removeItem(at: backingURL) + try Data("%PDF-1.4\n全新的重建内容".utf8).write(to: backingURL, options: [.atomic]) + store.refreshRuntimeItemURLs() + + let current = try XCTUnwrap(store.importedItems.first { $0.id == item.id }) + if current.importedFileIdentity != oldIdentity || current.urlPath == nil { + XCTAssertNil(current.urlPath, "资料项世代不同应切断路径,不继承阅读位置") + } else { + _ = current + } + } + + /// 瞬断无横幅(计划 §5 阶段3 第5步):文件缺席/未物化场景只保留条内状态, + /// 不再弹重要操作横幅。 + func testTransientUnavailabilityShowsNoBanner() throws { + let base = makeTempRoot("weibei-phase3-banner") + defer { try? FileManager.default.removeItem(at: base) } + let library = base.appendingPathComponent("资料库", isDirectory: true) + let store = try makeStore(base: base, library: library) + let courseID = try store.createCourseInLibrary(title: "横幅课") + let source = base.appendingPathComponent("笔记.md") + try "正文".write(to: source, atomically: true, encoding: .utf8) + let imported = try store.importFileIntoCourseForSelfCheck(source, courseID: courseID, role: .material) + let item = imported.item + let backingURL = try XCTUnwrap(store.resolvedLibraryURL(for: item)) + store.select(itemID: item.id) + XCTAssertEqual(store.activeNoteItemID, item.id, "前提:条目须为活跃笔记") + + // iCloud 瞬断形态:文件暂时缺席。 + try FileManager.default.removeItem(at: backingURL) + store.setNoteFileError("无法读取原 Markdown:\(backingURL.lastPathComponent)", for: item.id) + + XCTAssertNil( + store.importantOperationError, + "文件缺席属瞬态不可用,不得弹重要操作横幅(条内状态呈现)" + ) + XCTAssertNotNil( + store.noteOperationErrorsByItemID[item.id], + "条内错误状态必须保留,可见性不回退" + ) + } +} + + +/// 纯异步扫描用例独立成类:与同步 store 用例隔离,避免 XCTest 混排上下文。 +final class TransientToleranceScanTests: XCTestCase { + override class func setUp() { + super.setUp() + setenv("WEIBEI_SAFETY_TEST_MODE", "1", 1) + } + + func testScanRecognizesPlaceholderAsMaterialItem() async throws { + let base = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-phase3-scan-\(UUID().uuidString)", isDirectory: true) + defer { try? FileManager.default.removeItem(at: base) } + let courseRoot = base.appendingPathComponent("课程", isDirectory: true) + let docsDir = courseRoot.appendingPathComponent("文稿", isDirectory: true) + try FileManager.default.createDirectory(at: docsDir, withIntermediateDirectories: true) + try "占位".write(to: docsDir.appendingPathComponent(".讲义.md.icloud"), atomically: true, encoding: .utf8) + try Data("%PDF-1.4\n".utf8).write( + to: docsDir.appendingPathComponent(".论文.pdf.icloud"), options: [.atomic] + ) + try FileManager.default.createDirectory(at: docsDir.appendingPathComponent(".git"), withIntermediateDirectories: true) + + let snapshot = try await CourseProjectFileWorker().scanCourse(at: courseRoot) + + let paths = snapshot.observations.map(\.relativePath) + XCTAssertTrue(paths.contains("文稿/讲义.md"), "占位符应还原为逻辑路径;实际:\(paths)") + XCTAssertTrue(paths.contains("文稿/论文.pdf")) + XCTAssertFalse(paths.contains { $0.contains(".icloud") }, "不应出现占位符原始名") + XCTAssertFalse(paths.contains { $0.contains(".git") }, "其他隐藏目录仍应跳过") + } +}