Skip to content

Commit 836ba53

Browse files
committed
fix(fathom): cache sourceUrl in header so getDocument preserves it; return concrete contentHash (drop omit/cast)
1 parent 2ab37dc commit 836ba53

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

apps/sim/connectors/fathom/fathom.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createLogger } from '@sim/logger'
22
import { getErrorMessage, toError } from '@sim/utils/errors'
3-
import { omit } from '@sim/utils/object'
43
import { FathomIcon } from '@/components/icons'
54
import { fetchWithRetry, VALIDATE_RETRY_OPTIONS } from '@/lib/knowledge/documents/utils'
65
import type { ConnectorConfig, ExternalDocument, ExternalDocumentList } from '@/connectors/types'
@@ -104,6 +103,7 @@ interface FathomMeetingHeader {
104103
recordedByEmail?: string
105104
recordedByName?: string
106105
team?: string
106+
sourceUrl?: string
107107
contentHash: string
108108
}
109109

@@ -191,15 +191,16 @@ function buildHeader(meeting: FathomMeeting): FathomMeetingHeader {
191191
recordedByEmail: meeting.recorded_by?.email,
192192
recordedByName: meeting.recorded_by?.name,
193193
team: meeting.recorded_by?.team ?? undefined,
194+
sourceUrl: buildSourceUrl(meeting),
194195
contentHash: buildContentHash(meeting),
195196
}
196197
}
197198

198199
/**
199200
* Builds a metadata-based content hash. Fathom recordings are immutable once
200-
* processed, so the recording id plus its end/creation timestamps fully
201-
* identify a version. The stub hash is authoritative for change detection;
202-
* `getDocument` omits the hash so the engine reuses this value verbatim.
201+
* processed, so the recording id plus its end/creation timestamps fully identify
202+
* a version. The same value is cached in the header and returned by `getDocument`,
203+
* so the stub and hydrated document hash identically.
203204
*/
204205
function buildContentHash(meeting: FathomMeeting): string {
205206
return `fathom:${meeting.recording_id ?? ''}:${meeting.recording_end_time ?? ''}:${meeting.created_at ?? ''}`
@@ -491,21 +492,15 @@ export const fathomConnector: ConnectorConfig = {
491492
const content = formatMeetingContent(header, transcript, summary).trim()
492493
if (!content) return null
493494

494-
const hydrated: ExternalDocument = {
495+
return {
495496
externalId,
496497
title: header?.title ?? 'Untitled Fathom Meeting',
497498
content,
498499
contentDeferred: false,
499500
mimeType: 'text/plain',
500-
sourceUrl: undefined,
501-
contentHash: header?.contentHash ?? '',
502-
}
503-
504-
if (header?.contentHash) {
505-
return hydrated
501+
sourceUrl: header?.sourceUrl,
502+
contentHash: header?.contentHash ?? `fathom:${externalId}`,
506503
}
507-
508-
return omit(hydrated, ['contentHash']) as ExternalDocument
509504
} catch (error) {
510505
logger.warn('Failed to get Fathom meeting', {
511506
externalId,

0 commit comments

Comments
 (0)