Repository navigation
feat(memos): named-transcript matches and the speaker-matches columns - #1550
Merged
Merged
Conversation
Write the two exact rungs of the evidence ladder (#1416) as `SpeakerMatch` rows: a label a track manifest produced is `evidence: 'track'`, any other named label is `'metadata'`. A row needs an exact folded full name matching exactly one participant/member; an ambiguous name, a name nobody has, a numbered voice and a guest produce nothing. Both columns land (`memos`, `notes`); the notes column has no writer until phase 3's voice rung. Writers: `importPlaud` in the create, `saveParticipants` re-running the rung (keeping `voice` rows), and the tracks worker in the transcript update. `memos.speakers`, `resolveSpeakers` and the wire are untouched. Refs #1416
The roster test's label and member name were identical, so a writer that read labels from the PUT instead of the stored transcript would have passed it. A member named only in the transcript (never in the PUT) now has to produce a row, and the second-PUT case asserts the first write too. Refs #1416
This was referenced Dec 3, 2026
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.
Closes #1416
Refs #1402
Refs #1400
What this does
Phase 1's fourth session lands the two exact rungs of the evidence ladder (docs/features/89 § Evidence ladder) as
SpeakerMatchrows, and the columns they live in.memos.speaker_matchesandnotes.speaker_matches— JSONB,NOT NULL DEFAULT '[]', besideparticipants.[]is "no machine answer", never null, so there is one empty state and not two.
SpeakerMatchin@knowledge/contracts:{ label, userId, confidence, margin, model, evidence, decidedAt },evidence: 'track' | 'metadata' | 'voice'.confidence/margin/modelare null for both exact rungs becausethose rungs are exact;
voiceis phase 3's.track; any other named label ismetadata; a manifest label wins over a metadata reading of the same label. A row needs an exact folded fullname matching exactly one candidate — a stored participant whose
userIdis still a member, or a member'sdisplayName. Two members sharing a name, a name nobody has, a first-name-only label, a numbered voice and aguest's name all produce no row: a suggestion at most, never a match, no user created.
memberNamesinspeakers.tsis the one workspace-member map (userId -> displayName, the same two reads andthe same 2000-row cap
loadSpeakersalready used); the memo read, a Plaud import, a roster write and the tracksworker now share it instead of copying the query.
Why not
resolveSpeakersyetmemos.speakersis the uploader's own statement and stays untouched. The rows are stored evidence for phase 3,which will add
matchesas one more input to the pureresolveSpeakersand implement the precedence(
confirmed > remembered > metadata > auto > suggested, § Matches). Nothing on the wire changes in this task: noMemoDetailResponsefield, no DTO, no route. A future Zoom VTT adapter calls the same pure function from its ownimport path.
The three write points
These are the three moments the exact evidence exists; there is no read-time write and no background job.
importPlaudcreateas the transcriptexistingearly return stays: an already imported memo is not recomputed.saveParticipantsparticipantsandspeakerMatchesin oneupdate, re-running the rungtrack,metadata) and keepsvoicerows — phase 3's, which this write did not decide. A second PUT replaces, never duplicates, and a malformed stored array reads[]instead of a stale partial answer.memos.processor'stracksbranchspeakerMatchesin the sameupdatethat stores the transcripttrackLabel; one track is one speaker, so those labels aretrackrows by construction. The single-file branch writes nothing — its labels are numbered voices.No other writer:
matchSpeaker,retry,confirm, triage and the sweeper are untouched.Decisions and divergences
evidence, notsource. feat(memos): call participants 1.4 — named transcript mapping #1416's body sayssource: 'metadata'; the doc'sSpeakerMatch(§Matches) has
evidence: 'track' | 'metadata' | 'voice', and phase 3 reads that array. The doc wins; this is theissue's wording, named here as a divergence.
memos.speaker_matchesand
notes.speaker_matchesto 1.4. Phase 1 has no note writer (notes' participants carry nouserId, and itsnamed-transcript source is a later adapter), so the notes column has no writer until phase 3's voice rung. One
additive migration now beats a second later one; no note writer was added to justify it, and
apps/api/src/notesis untouched.
type,
speakers.ts'smemberNamesextraction, the processor's writer (the doc's Operations row assigns thetrackrows here too),CHANGELOG.md, andapps/api/test/plaud-import.spec.ts— whose fake needed the memberreads
importPlaudnow performs, plus one assertion that the import writes the rows.dto/memos.dto.tsneeds no change. Nothing on the wire changes: no route accepts a transcripttoday beyond Plaud's own, and matches are internal until phase 3. A future Zoom VTT adapter calls the same pure
function from its own import path; no field is invented now.
[]is the empty state, never null — likememos.participants; a null would be a second spelling of "nomachine answer".
userIdcomes from a stored participant 1.2 already resolved, orfrom the member map itself; the read filters again when phase 3 lands. A guest is never a match and never a user.
nothing asks a model to decide a match.
make api-client); nothing changed — thecontract type is not on any route, so
openapi.json,contract-schemas.json,schema.d.tsand the docsreference are byte-identical. No generated file is in this diff.
Per-criterion
#1416
speakerMatches: candidates are exact folded full names, deduped byuserId; a row only when exactly one; two members sharing a display name yield none, and a first-name-only label yields none (that staysbyName's suggestion).speakerMatches (#1416) › maps an exact single member name…,› stays silent when two members share the display name,› never matches a first nameuserIdcontributes no candidate; a member is a candidate only through the member map; no user is created anywhere.speakerMatches (#1416) › never turns a guest into a user,› matches a participant the roster resolved, and only while that person is a membermemos.speakersis untouched; the metadata match is a separate row/field.speaker_matches; no writer touchesspeakers, andresolveSpeakers/MemoSpeakerare unchanged.MemosService speaker matches (#1416) › re-runs the exact rung…and› importPlaud writes…assert the write payload has nospeakers;› replaces its own rows…make verifypasses.make verifyexited 0: 350 test files / 5411 tests, lint, typecheck and dependency-cruiser green.#1402's named-transcript row
trackrows exist for the manifest path, so a named track is never re-read as a metadata guess.#1416describes andMemosProcessor tracks › writes the manifest's exact rows…Verification
Proven on a throwaway database created and owned by this task (
speaker_matches_probe, dropped afterwards), withprisma migrate deployreplaying every migration:make verify→ 350 test files passed, 5411 tests passed.make db-generateregenerated the Prisma client;make api-clientregenerated the client from the final tree and changed nothing (no wire surface).Review
Independent review before opening this PR (spec + work, fresh context), sliced by area: the mapper/parser, the three
writers, the schema + migration + contract, the pure-rung cases, the service-write cases, the Plaud spec +
changelog, and the fixture/processor cases.
used one label that was both. A member named only in the transcript now has to produce a row, and the second-PUT
case asserts the first write too (
b8a711a8); the delta review confirmed both blocks close.memberIds, so the membership read is unused" —production filters membership inside the same
user.findManyquery (memberships: { some: { workspaceId } },storedParticipants), and the harness models that predicate with the samememberIdsarray that buildsworkspaceMember.findMany, so the two cannot disagree. The member map itself is load-bearing: the amended case'sBob row comes from
displayNamealone.memo.updateappliesObject.assign(row, data)(apps/api/test/memos.spec.ts:1376), so the second call reads what the first wrote.