Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(meetings): Address speaker identity review findings
Chadpiha098a256cced2
diff --git a/src/helpers/liveSpeakerIdentifier.js b/src/helpers/liveSpeakerIdentifier.jsindex 849e78d87..095498645 100644--- a/src/helpers/liveSpeakerIdentifier.js+++ b/src/helpers/liveSpeakerIdentifier.js@@ -244,6 +244,15 @@ class LiveSpeakerIdentifier {const similarity = speakerEmbeddings.cosineSimilarity(speakers[i][1], speakers[j][1]);if (similarity < MATCH_THRESHOLD) continue;+ // Confirmed-distinct identities (different profiles, or different+ // user-set names) must never merge on embedding similarity alone.+ const profileI = this.transientProfileIds.get(speakers[i][0]);+ const profileJ = this.transientProfileIds.get(speakers[j][0]);+ if (profileI != null && profileJ != null && profileI !== profileJ) continue;+ const nameI = this.transientDisplayNames.get(speakers[i][0]);+ const nameJ = this.transientDisplayNames.get(speakers[j][0]);+ if (nameI && nameJ && nameI !== nameJ) continue;+const countI = this.transientCounts.get(speakers[i][0]) || 1;const countJ = this.transientCounts.get(speakers[j][0]) || 1;const hasNameI = !!this.transientDisplayNames.get(speakers[i][0]);@@ -730,7 +739,10 @@ class LiveSpeakerIdentifier {if (this.transientEmbeddings.size >= this.maxSpeakers) {const nearest = this._findNearestTransient(embedding);if (nearest) {- this._updateCentroid(nearest, embedding);+ // Label only — never fold the embedding into the centroid. At-cap+ // overflow is usually a different voice, and a polluted centroid would+ // keep capturing it even after the cap rises (participants added+ // mid-meeting).return nearest;}}diff --git a/src/stores/meetingRecordingStore.ts b/src/stores/meetingRecordingStore.tsindex 80c21cf3b..9b3fba021 100644--- a/src/stores/meetingRecordingStore.ts+++ b/src/stores/meetingRecordingStore.ts@@ -701,6 +701,12 @@ async function cleanup(): Promise<void> {ipcCleanups.forEach((fn) => fn());ipcCleanups = [];+ // A debounced config push firing after stop would repopulate the session+ // config main just cleared, leaking this session's count into the next one.+ if (pushConfigTimeout) {+ clearTimeout(pushConfigTimeout);+ pushConfigTimeout = null;+ }isPrepared = false;isRecordingFlag = false;isStartingFlag = false;diff --git a/test/helpers/liveSpeakerIdentifier.test.js b/test/helpers/liveSpeakerIdentifier.test.jsindex 5761b70af..4a0b49c6b 100644--- a/test/helpers/liveSpeakerIdentifier.test.js+++ b/test/helpers/liveSpeakerIdentifier.test.js@@ -139,6 +139,71 @@ test("mapSpeaker on an unknown id fails loudly", () => {);});+// Plants exactly two clusters ~0.70 similar (above the 0.65 recluster+// threshold) — creating them via resolution would just match them together.+function seedSimilarIdentifiedPair(identifier) {+ identifier.setMaxSpeakers(3);+ identifier._assignSpeakerId(voiceA);+ identifier._assignSpeakerId(ambiguousVoice);+}++test("clusters mapped to different profiles never merge on similarity alone", () => {+ const { LiveSpeakerIdentifier } = loadIdentifier();+ const identifier = new LiveSpeakerIdentifier();++ seedSimilarIdentifiedPair(identifier);+ assert.equal(identifier.mapSpeaker("speaker_0", 1, "Alice", null), true);+ assert.equal(identifier.mapSpeaker("speaker_1", 2, "Bob", null), true);++ const merges = identifier._performRecluster();+ assert.deepEqual(merges, [], "two confirmed-distinct people must not be merged");+ assert.ok(identifier.getSpeakerEmbedding("speaker_1"), "Bob's cluster must survive");+});++test("clusters with different manual names never merge on similarity alone", () => {+ const { LiveSpeakerIdentifier } = loadIdentifier();+ const identifier = new LiveSpeakerIdentifier();++ seedSimilarIdentifiedPair(identifier);+ assert.equal(identifier.mapSpeaker("speaker_0", null, "Alice", null), true);+ assert.equal(identifier.mapSpeaker("speaker_1", null, "Bob", null), true);++ const merges = identifier._performRecluster();+ assert.deepEqual(merges, [], "differing user-set names assert distinct identities");+});++test("an unidentified cluster still merges into an identified one", () => {+ const { LiveSpeakerIdentifier } = loadIdentifier();+ const identifier = new LiveSpeakerIdentifier();++ seedSimilarIdentifiedPair(identifier);+ assert.equal(identifier.mapSpeaker("speaker_0", 1, "Alice", null), true);++ const merges = identifier._performRecluster();+ assert.equal(merges.length, 1, "the guard must not block ordinary convergence");+ assert.equal(merges[0].displayName, "Alice");+});++test("a voice force-merged at the cap becomes its own speaker once the cap rises", () => {+ const { LiveSpeakerIdentifier } = loadIdentifier();+ const identifier = new LiveSpeakerIdentifier();+ identifier.setMaxSpeakers(1);++ const first = identifier._resolveSpeakerForEmbedding(voiceA, { updateCentroid: true });+ const folded = identifier._resolveSpeakerForEmbedding(voiceB, { updateCentroid: true });+ assert.equal(folded.speakerId, first.speakerId, "at the cap the voice is folded");++ // Participants added mid-meeting raise the cap; the folded voice must not+ // stay captured by a centroid polluted during the at-cap period.+ identifier.setMaxSpeakers(3);+ const recovered = identifier._resolveSpeakerForEmbedding(voiceB, { updateCentroid: true });+ assert.notEqual(+ recovered.speakerId,+ first.speakerId,+ "after the cap rises the folded voice must get its own cluster"+ );+});+test("distinct voices are folded into one cluster when the session cap is 1", () => {const { LiveSpeakerIdentifier } = loadIdentifier();const identifier = new LiveSpeakerIdentifier();