Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix(meeting): preserve summaries when renaming meetings (#1233)

Rohith Gandhi G840fff765c67
diff --git a/Sources/Fluid/Services/FluidServe/FluidServeMeetings.swift b/Sources/Fluid/Services/FluidServe/FluidServeMeetings.swift
index f8b8a28d..a821e9e0 100644
--- a/Sources/Fluid/Services/FluidServe/FluidServeMeetings.swift
+++ b/Sources/Fluid/Services/FluidServe/FluidServeMeetings.swift
@@ -185,6 +185,7 @@ nonisolated enum FluidServeMeetings {
static func savedSummaries(for entry: Entry, customPrompt: String = "", fileManager: FileManager = .default) -> [SavedSummary] {
struct Stored: Decodable {
var transcriptHash: String
+ var transcriptHashVersion: Int?
var text: String
var promptHash: String?
var providerID: String?
@@ -197,16 +198,26 @@ nonisolated enum FluidServeMeetings {
.filter { $0.hasPrefix(prefix) && $0.hasSuffix(".json") }
.sorted()
guard !names.isEmpty else { return [] }
- let currentHash = self.fingerprint(self.summaryInput(for: entry.meeting))
+ let legacyHash = self.fingerprint(self.summaryInput(for: entry.meeting))
+ var contentSource = entry.meeting
+ contentSource.title = ""
+ let contentHash = self.fingerprint(self.summaryInput(for: contentSource))
let customPromptHash = self.fingerprint(customPrompt.trimmingCharacters(in: .whitespacesAndNewlines))
return names.compactMap { name in
let style = String(name.dropFirst(prefix.count).dropLast(".json".count))
guard let data = try? Data(contentsOf: entry.directory.appendingPathComponent(name, isDirectory: false)),
let stored = try? JSONDecoder().decode(Stored.self, from: data),
- stored.providerID != nil, stored.transcriptHash == currentHash,
+ stored.providerID != nil,
stored.promptHash == (style == "custom" ? customPromptHash : nil),
!stored.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
else { return nil }
+ let currentHash: String
+ switch stored.transcriptHashVersion {
+ case nil: currentHash = legacyHash
+ case 2: currentHash = contentHash
+ default: return nil
+ }
+ guard stored.transcriptHash == currentHash else { return nil }
return SavedSummary(
style: style,
text: stored.text,
diff --git a/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift b/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
index 1c8da95a..f08bc92c 100644
--- a/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
+++ b/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
@@ -1075,6 +1075,13 @@ final class MeetingSessionCoordinator: ObservableObject {
guard !trimmed.isEmpty else { throw MeetingDomainError.emptyMeetingTitle }
guard target.title != trimmed else { return target }
+ if let directory = try await self.store.existingSessionDirectory(for: sessionID) {
+ let snapshot = target
+ try await Task.detached(priority: .utility) {
+ try MeetingSummaryController.SavedSummary.migrateLegacySummaries(in: directory, for: snapshot)
+ }.value
+ }
+
target.title = trimmed
target.defaultTitleBase = nil
target.updatedAt = Date()
diff --git a/Sources/Fluid/Services/Meeting/MeetingSummaryController.swift b/Sources/Fluid/Services/Meeting/MeetingSummaryController.swift
index 138249ea..68cf16be 100644
--- a/Sources/Fluid/Services/Meeting/MeetingSummaryController.swift
+++ b/Sources/Fluid/Services/Meeting/MeetingSummaryController.swift
@@ -53,6 +53,13 @@ nonisolated enum MeetingSummaryInput {
static func fingerprint(_ text: String) -> String {
SHA256.hash(data: Data(text.utf8)).map { String(format: "%02x", $0) }.joined()
}
+
+ static func contentFingerprint(for session: MeetingSession) -> String {
+ // Keep the title in the model's input, but exclude it from summary validity.
+ var source = session
+ source.title = ""
+ return self.fingerprint(self.transcript(for: source))
+ }
}
/// Keeps summary admission separate from ordinary processing, including cloud calls that
@@ -148,6 +155,12 @@ final class MeetingSummaryController: ObservableObject {
@Published private(set) var error: String?
private var operation: Task<Void, Never>?
private var generation = UUID()
+ private let store: any MeetingSessionStoring
+
+ init(store: any MeetingSessionStoring = MeetingSessionStore.shared) {
+ self.store = store
+ }
+
var busy: Bool {
self.downloading || self.generating || self.deleting
}
@@ -157,7 +170,9 @@ final class MeetingSummaryController: ObservableObject {
}
nonisolated struct SavedSummary: Codable {
- let transcriptHash: String
+ static let currentTranscriptHashVersion = 2
+
+ var transcriptHash: String
let modelID: String
let text: String
var providerID: String?
@@ -169,6 +184,8 @@ final class MeetingSummaryController: ObservableObject {
var promptHash: String?
/// Display name of an on-device model, whose ID is not meant to be read.
var modelName: String?
+ /// Version 2 excludes the meeting title. A missing version uses the original full input.
+ var transcriptHashVersion: Int?
var provenance: String {
"\(self.providerName ?? "Fluid Intelligence") · \(self.modelName ?? self.modelID)"
@@ -185,6 +202,37 @@ final class MeetingSummaryController: ObservableObject {
func isCurrent(transcriptHash: String, promptHash: String?) -> Bool {
self.providerID != nil && self.transcriptHash == transcriptHash && self.promptHash == promptHash
}
+
+ func isCurrent(session: MeetingSession, promptHash: String?) -> Bool {
+ let hash: String
+ switch self.transcriptHashVersion {
+ case nil:
+ hash = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ case Self.currentTranscriptHashVersion:
+ hash = MeetingSummaryInput.contentFingerprint(for: session)
+ default:
+ return false
+ }
+ return self.isCurrent(transcriptHash: hash, promptHash: promptHash)
+ }
+
+ /// Upgrade before saving a rename, while the original title can still verify old files.
+ /// Each upgrade remains valid even if a later write (including the rename) fails.
+ static func migrateLegacySummaries(in directory: URL, for session: MeetingSession) throws {
+ let legacyHash = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ let contentHash = MeetingSummaryInput.contentFingerprint(for: session)
+ for kind in MeetingSummaryKind.allCases {
+ let url = directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")
+ guard var saved = try? JSONDecoder().decode(Self.self, from: Data(contentsOf: url)),
+ saved.transcriptHashVersion == nil,
+ saved.providerID != nil,
+ saved.transcriptHash == legacyHash
+ else { continue }
+ saved.transcriptHash = contentHash
+ saved.transcriptHashVersion = Self.currentTranscriptHashVersion
+ try JSONEncoder().encode(saved).write(to: url, options: .atomic)
+ }
+ }
}
func refresh(session: MeetingSession?, kind: MeetingSummaryKind, customPrompt: String = "") async {
@@ -197,15 +245,16 @@ final class MeetingSummaryController: ObservableObject {
self.error = nil
self.checking = true
let model = self.model
+ let store = self.store
let promptHash = kind == .custom ? MeetingSummaryInput.fingerprint(customPrompt.trimmingCharacters(in: .whitespacesAndNewlines)) : nil
let snapshot = await Task.detached(priority: .utility) { () -> (Bool, SavedSummary?) in
let installed = model.map { PrivateAIIntegrationService.isModelInstalled($0) } ?? false
guard let session,
- let directory = try? await MeetingSessionStore.shared.existingSessionDirectory(for: session.id),
+ let directory = try? await store.existingSessionDirectory(for: session.id),
let data = try? Data(contentsOf: directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")),
let saved = try? JSONDecoder().decode(SavedSummary.self, from: data),
saved.isCurrent(
- transcriptHash: MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session)),
+ session: session,
promptHash: promptHash
)
else { return (installed, nil) }
@@ -281,7 +330,9 @@ final class MeetingSummaryController: ObservableObject {
}
do {
try await MeetingSummaryActivityCoordinator.shared.withRemoteSummary {
- let transcript = await Task.detached(priority: .utility) { MeetingSummaryInput.transcript(for: session) }.value
+ let (transcript, contentHash) = await Task.detached(priority: .utility) {
+ (MeetingSummaryInput.transcript(for: session), MeetingSummaryInput.contentFingerprint(for: session))
+ }.value
guard session.transcriptSegments.contains(where: { !$0.isEcho && !$0.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }) else {
throw MeetingPostProcessingError.invalidOutput
}
@@ -294,11 +345,11 @@ final class MeetingSummaryController: ObservableObject {
customInstructions: instructions
)
try Task.checkCancellation()
- guard let directory = try await MeetingSessionStore.shared.existingSessionDirectory(for: session.id) else {
+ guard let directory = try await self.store.existingSessionDirectory(for: session.id) else {
throw MeetingPostProcessingError.checkpointFailed
}
let saved = SavedSummary(
- transcriptHash: MeetingSummaryInput.fingerprint(transcript),
+ transcriptHash: contentHash,
modelID: route.modelID,
text: text,
providerID: route.providerID,
@@ -306,7 +357,8 @@ final class MeetingSummaryController: ObservableObject {
configurationHash: route.configurationHash,
promptVersion: 1,
generatedAt: Date(),
- promptHash: kind == .custom ? MeetingSummaryInput.fingerprint(instructions) : nil
+ promptHash: kind == .custom ? MeetingSummaryInput.fingerprint(instructions) : nil,
+ transcriptHashVersion: SavedSummary.currentTranscriptHashVersion
)
try await Task.detached(priority: .utility) {
try JSONEncoder().encode(saved).write(to: directory.appendingPathComponent("manual-summary-\(kind.rawValue).json"), options: .atomic)
@@ -344,7 +396,9 @@ final class MeetingSummaryController: ObservableObject {
}
do {
try await MeetingSummaryActivityCoordinator.shared.withSummary(activity: asr) {
- let transcript = await Task.detached(priority: .utility) { MeetingSummaryInput.transcript(for: session) }.value
+ let (transcript, contentHash) = await Task.detached(priority: .utility) {
+ (MeetingSummaryInput.transcript(for: session), MeetingSummaryInput.contentFingerprint(for: session))
+ }.value
guard transcript.utf8.count <= MeetingSummaryOnDevice.maximumTranscriptBytes else {
throw MeetingPostProcessingError.inputTooLarge
}
@@ -367,11 +421,11 @@ final class MeetingSummaryController: ObservableObject {
}
try Task.checkCancellation()
guard !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { throw MeetingPostProcessingError.invalidOutput }
- guard let directory = try await MeetingSessionStore.shared.existingSessionDirectory(for: session.id) else {
+ guard let directory = try await self.store.existingSessionDirectory(for: session.id) else {
throw MeetingPostProcessingError.checkpointFailed
}
let saved = SavedSummary(
- transcriptHash: MeetingSummaryInput.fingerprint(transcript),
+ transcriptHash: contentHash,
modelID: model.id,
text: text,
providerID: MeetingSummaryOnDevice.providerID,
@@ -380,7 +434,8 @@ final class MeetingSummaryController: ObservableObject {
promptVersion: 1,
generatedAt: Date(),
promptHash: kind == .custom ? MeetingSummaryInput.fingerprint(instructions) : nil,
- modelName: model.displayName
+ modelName: model.displayName,
+ transcriptHashVersion: SavedSummary.currentTranscriptHashVersion
)
try await Task.detached(priority: .utility) {
try JSONEncoder().encode(saved).write(to: directory.appendingPathComponent("manual-summary-\(kind.rawValue).json"), options: .atomic)
diff --git a/Sources/Fluid/UI/MeetingSessionCanvases.swift b/Sources/Fluid/UI/MeetingSessionCanvases.swift
index 8c40026b..7f7900a0 100644
--- a/Sources/Fluid/UI/MeetingSessionCanvases.swift
+++ b/Sources/Fluid/UI/MeetingSessionCanvases.swift
@@ -444,7 +444,7 @@ struct MeetingResultCanvas: View {
if self.documentSection == .summary {
MeetingSummaryView(session: self.session, isQuiescent: self.isQuiescent)
- .id("\(self.session.id)-\(self.session.updatedAt)")
+ .id(self.session.id)
} else {
if let warning = self.session.microphoneEchoWarning {
MeetingAudioTranscriptNotice(
diff --git a/Tests/FluidDictationIntegrationTests/FluidServeTests.swift b/Tests/FluidDictationIntegrationTests/FluidServeTests.swift
index a11a35a8..6bc00076 100644
--- a/Tests/FluidDictationIntegrationTests/FluidServeTests.swift
+++ b/Tests/FluidDictationIntegrationTests/FluidServeTests.swift
@@ -214,6 +214,30 @@ final class FluidServeTests: XCTestCase {
XCTAssertEqual(try XCTUnwrap(FluidServeMeetings.entries(root: self.root).first).meeting.durationSeconds, 35)
}
+ func testVersionedSummariesSurviveTitleChangesButNotTranscriptChanges() throws {
+ var session = self.session(title: "Weekly sync")
+ try self.save(session)
+ let hash = MeetingSummaryInput.contentFingerprint(for: session)
+ try self.saveSummary("Detailed recap.", style: "detailed", for: session, transcriptHash: hash, transcriptHashVersion: 2)
+ try self.saveSummary("Custom recap.", style: "custom", for: session, transcriptHash: hash, promptHash: MeetingSummaryInput.fingerprint("Focus on risks"), transcriptHashVersion: 2)
+ try self.saveSummary("Unknown format.", style: "topics", for: session, transcriptHash: hash, transcriptHashVersion: 99)
+ try self.saveSummary("Legacy recap.", style: "executive", for: session)
+ let original = try XCTUnwrap(FluidServeMeetings.entries(root: self.root).first)
+ XCTAssertEqual(FluidServeMeetings.savedSummaries(for: original, customPrompt: "Focus on risks").map(\.style), ["custom", "detailed", "executive"])
+
+ session.title = "Renamed weekly sync"
+ try self.save(session)
+ let renamed = try XCTUnwrap(FluidServeMeetings.entries(root: self.root).first)
+ XCTAssertEqual(FluidServeMeetings.savedSummaries(for: renamed, customPrompt: "Focus on risks").map(\.style), ["custom", "detailed"])
+ XCTAssertEqual(FluidServeMeetings.savedSummaries(for: renamed, customPrompt: "New prompt").map(\.style), ["detailed"])
+ XCTAssertTrue(self.run("meet", "summary", "latest", "--style", "detailed").output.hasSuffix("Detailed recap."))
+
+ session.transcriptSegments[0].text = "Corrected transcript"
+ try self.save(session)
+ let corrected = try XCTUnwrap(FluidServeMeetings.entries(root: self.root).first)
+ XCTAssertTrue(FluidServeMeetings.savedSummaries(for: corrected, customPrompt: "Focus on risks").isEmpty)
+ }
+
func testCommandNeverChangesTheMeetingsFolder() throws {
let session = self.session(title: "Weekly sync")
try self.save(session)
@@ -713,7 +737,8 @@ final class FluidServeTests: XCTestCase {
for session: MeetingSession,
providerID: String? = "on-device",
transcriptHash: String? = nil,
- promptHash: String? = nil
+ promptHash: String? = nil,
+ transcriptHashVersion: Int? = nil
) throws {
let saved = MeetingSummaryController.SavedSummary(
transcriptHash: transcriptHash ?? MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session)),
@@ -722,7 +747,8 @@ final class FluidServeTests: XCTestCase {
providerID: providerID,
generatedAt: Date(timeIntervalSince1970: 1_700_000_500),
promptHash: promptHash,
- modelName: "Qwen3.5 9B"
+ modelName: "Qwen3.5 9B",
+ transcriptHashVersion: transcriptHashVersion
)
try JSONEncoder().encode(saved).write(to: self.directory(for: session).appendingPathComponent("manual-summary-\(style).json"))
}
diff --git a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
index f0c7c882..62cc96d8 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
@@ -5142,6 +5142,148 @@ final class MeetingRecoveryTests: XCTestCase {
let reloaded = try await store.load(id: session.id)
XCTAssertEqual(reloaded, before)
}
+
+ func testRenameSessionPreservesLegacySummaryKindsAcrossReloads() async throws {
+ let root = self.makeTempDirectory()
+ defer { try? FileManager.default.removeItem(at: root) }
+ let prompt = "List risks by owner."
+ let generatedAt = Date(timeIntervalSince1970: 1_700_000_000)
+
+ for provider in ["fixture", MeetingSummaryOnDevice.providerID] {
+ let dir = root.appendingPathComponent(provider, isDirectory: true)
+ let store = MeetingSessionStore(rootDirectory: dir)
+ let (session, _, _, _) = self.makeCorrectionSession(state: .completed)
+ try await store.create(session)
+ let directory = try await store.sessionDirectory(for: session.id)
+ let legacyHash = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ for kind in MeetingSummaryKind.allCases {
+ let saved = MeetingSummaryController.SavedSummary(
+ transcriptHash: legacyHash,
+ modelID: "fixture-model",
+ text: "Saved \(kind.rawValue) summary",
+ providerID: provider,
+ providerName: "Fixture provider",
+ generatedAt: generatedAt,
+ promptHash: kind == .custom ? MeetingSummaryInput.fingerprint(prompt) : nil
+ )
+ let file = directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")
+ try JSONEncoder().encode(saved).write(to: file, options: .atomic)
+ let controller = MeetingSummaryController(store: store)
+ await controller.refresh(session: session, kind: kind, customPrompt: prompt)
+ XCTAssertEqual(controller.output, saved.text, "Legacy \(kind) summary should load before rename")
+ }
+
+ let coordinator = MeetingSessionCoordinator(
+ store: store, capture: StubCaptureController(), processing: StubProcessingController(), audioArbiter: StubArbiter()
+ )
+ _ = try await coordinator.renameSession(sessionID: session.id, to: "Weekly Sync")
+
+ // A new store and controller must recover the summaries from disk, without live state.
+ let reloadedStore = MeetingSessionStore(rootDirectory: dir)
+ let loaded = try await reloadedStore.loadTranscript(id: session.id)
+ let renamed = try XCTUnwrap(loaded)
+ XCTAssertEqual(renamed.title, "Weekly Sync")
+ let controller = MeetingSummaryController(store: reloadedStore)
+ var upgradedFiles: [MeetingSummaryKind: Data] = [:]
+ for kind in MeetingSummaryKind.allCases {
+ await controller.refresh(session: renamed, kind: kind, customPrompt: prompt)
+ XCTAssertEqual(controller.output, "Saved \(kind.rawValue) summary", "\(provider): \(kind)")
+ XCTAssertEqual(controller.outputProvenance, "Fixture provider · fixture-model")
+ let file = directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")
+ let data = try Data(contentsOf: file)
+ upgradedFiles[kind] = data
+ let saved = try JSONDecoder().decode(MeetingSummaryController.SavedSummary.self, from: data)
+ XCTAssertEqual(saved.transcriptHashVersion, MeetingSummaryController.SavedSummary.currentTranscriptHashVersion)
+ XCTAssertEqual(saved.generatedAt, generatedAt)
+ XCTAssertEqual(saved.providerID, provider)
+ }
+
+ // Already-upgraded summaries survive another rename without rewriting their files.
+ let secondRename = try await coordinator.renameSession(sessionID: session.id, to: "New Weekly Sync")
+ for kind in MeetingSummaryKind.allCases {
+ await controller.refresh(session: secondRename, kind: kind, customPrompt: prompt)
+ XCTAssertEqual(controller.output, "Saved \(kind.rawValue) summary")
+ let file = directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")
+ XCTAssertEqual(try Data(contentsOf: file), upgradedFiles[kind])
+ }
+ await controller.refresh(session: secondRename, kind: .custom, customPrompt: "Edited prompt")
+ XCTAssertTrue(controller.output.isEmpty, "Migrating a custom summary must retain its prompt check")
+ var corrected = secondRename
+ corrected.transcriptSegments[0].text += " A transcript correction."
+ await controller.refresh(session: corrected, kind: .detailed)
+ XCTAssertTrue(controller.output.isEmpty, "Renaming must not disable transcript invalidation")
+ corrected = secondRename
+ corrected.speakers[0].displayName = "Corrected speaker"
+ await controller.refresh(session: corrected, kind: .participants)
+ XCTAssertTrue(controller.output.isEmpty, "Renaming must not disable speaker invalidation")
+ }
+ }
+
+ func testRenameSessionDoesNotReviveInvalidSavedSummaries() async throws {
+ let dir = self.makeTempDirectory()
+ defer { try? FileManager.default.removeItem(at: dir) }
+ let store = MeetingSessionStore(rootDirectory: dir)
+ let (session, _, _, _) = self.makeCorrectionSession(state: .completed)
+ try await store.create(session)
+ let directory = try await store.sessionDirectory(for: session.id)
+ let hash = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ let stale = MeetingSummaryController.SavedSummary(transcriptHash: "old transcript", modelID: "fixture", text: "Stale", providerID: "fixture")
+ let retired = MeetingSummaryController.SavedSummary(transcriptHash: hash, modelID: "old-model", text: "Retired")
+ let unknownVersion = MeetingSummaryController.SavedSummary(transcriptHash: hash, modelID: "fixture", text: "Future", providerID: "fixture", transcriptHashVersion: 99)
+ let files: [MeetingSummaryKind: Data] = try [
+ .executive: JSONEncoder().encode(stale),
+ .detailed: JSONEncoder().encode(retired),
+ .actions: Data("corrupt summary".utf8),
+ .decisions: JSONEncoder().encode(unknownVersion),
+ ]
+ for (kind, data) in files {
+ try data.write(to: directory.appendingPathComponent("manual-summary-\(kind.rawValue).json"), options: .atomic)
+ }
+ let coordinator = MeetingSessionCoordinator(
+ store: store, capture: StubCaptureController(), processing: StubProcessingController(), audioArbiter: StubArbiter()
+ )
+ let renamed = try await coordinator.renameSession(sessionID: session.id, to: "Weekly Sync")
+ let controller = MeetingSummaryController(store: store)
+ for (kind, data) in files {
+ await controller.refresh(session: renamed, kind: kind)
+ XCTAssertTrue(controller.output.isEmpty, "\(kind) must stay hidden")
+ let file = directory.appendingPathComponent("manual-summary-\(kind.rawValue).json")
+ XCTAssertEqual(try Data(contentsOf: file), data, "An invalid file must not be upgraded")
+ }
+ }
+
+ func testFailedRenameKeepsMigratedSummaryVisibleAndAllowsRetry() async throws {
+ let dir = self.makeTempDirectory()
+ defer { try? FileManager.default.removeItem(at: dir) }
+ let store = MeetingSessionStore(rootDirectory: dir)
+ let (session, _, _, _) = self.makeCorrectionSession(state: .completed)
+ try await store.create(session)
+ let directory = try await store.sessionDirectory(for: session.id)
+ let file = directory.appendingPathComponent("manual-summary-detailed.json")
+ let saved = MeetingSummaryController.SavedSummary(
+ transcriptHash: MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session)),
+ modelID: "fixture",
+ text: "Detailed summary",
+ providerID: "fixture"
+ )
+ try JSONEncoder().encode(saved).write(to: file, options: .atomic)
+ let failingStore = GatedThrowingSaveStore(inner: store, recorder: EventRecorder())
+ await failingStore.throwOnNextSave()
+ let coordinator = MeetingSessionCoordinator(
+ store: failingStore, capture: StubCaptureController(), processing: StubProcessingController(), audioArbiter: StubArbiter()
+ )
+ await XCTAssertThrowsErrorAsync(try await coordinator.renameSession(sessionID: session.id, to: "Weekly Sync"))
+ let loaded = try await store.loadTranscript(id: session.id)
+ let unchanged = try XCTUnwrap(loaded)
+ XCTAssertEqual(unchanged.title, session.title)
+ let controller = MeetingSummaryController(store: store)
+ await controller.refresh(session: unchanged, kind: .detailed)
+ XCTAssertEqual(controller.output, saved.text)
+
+ let renamed = try await coordinator.renameSession(sessionID: session.id, to: "Weekly Sync")
+ await controller.refresh(session: renamed, kind: .detailed)
+ XCTAssertEqual(controller.output, saved.text)
+ }
}
/// XCTAssertThrowsError has no async overload; this bridges an async throwing expression.
diff --git a/Tests/FluidDictationIntegrationTests/MeetingSummaryInputTests.swift b/Tests/FluidDictationIntegrationTests/MeetingSummaryInputTests.swift
index 1a2f7140..0c2179da 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingSummaryInputTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingSummaryInputTests.swift
@@ -32,6 +32,7 @@ final class MeetingSummaryInputTests: XCTestCase {
MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: live)),
MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: reloaded))
)
+ XCTAssertEqual(MeetingSummaryInput.contentFingerprint(for: live), MeetingSummaryInput.contentFingerprint(for: reloaded))
}
func testDurationLineIsUnchangedForMeetingsAlreadyOnWholeSeconds() {
@@ -49,12 +50,23 @@ final class MeetingSummaryInputTests: XCTestCase {
func testChangedTextOrSpeakerInvalidatesSavedSummary() {
var session = self.session(origin: 0, segmentStart: 0, segmentEnd: 1, gapStart: 2, gapEnd: 3)
- let original = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ let original = MeetingSummaryInput.contentFingerprint(for: session)
session.transcriptSegments[0].text = "Corrected transcript"
- let corrected = MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session))
+ let corrected = MeetingSummaryInput.contentFingerprint(for: session)
XCTAssertNotEqual(original, corrected)
session.speakers[0].displayName = "Maya"
- XCTAssertNotEqual(corrected, MeetingSummaryInput.fingerprint(MeetingSummaryInput.transcript(for: session)))
+ XCTAssertNotEqual(corrected, MeetingSummaryInput.contentFingerprint(for: session))
+ }
+
+ func testRenamingKeepsContentFingerprintButUpdatesModelInput() {
+ var session = self.session(origin: 0, segmentStart: 0, segmentEnd: 1, gapStart: 2, gapEnd: 3)
+ let original = MeetingSummaryInput.contentFingerprint(for: session)
+ for title in ["Weekly Sync", "A title\nwith a second line", ""] {
+ session.title = title
+ session.updatedAt = session.updatedAt.addingTimeInterval(1)
+ XCTAssertEqual(MeetingSummaryInput.contentFingerprint(for: session), original)
+ XCTAssertTrue(MeetingSummaryInput.transcript(for: session).hasPrefix("Title: \(title)\n"))
+ }
}
@MainActor