Repository navigation
feat(memos): the participants column, its contract and the memo detail read - #1547
Merged
Merged
Conversation
3 tasks
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 #1413
Refs #1402
Refs #1400
What
memos.participants— one JSONB column besidespeakers—MemoParticipantin@knowledge/contracts, and the memo detail read returning it. No write route, no email mapping, no tracks, no voice: #1414–#1416 own those.The column
Not nullable: the default backfills every existing row, so the read never meets
nullin the column, and an empty list means "nobody was named", which is not "unknown". The migration is one additive statement:No FK, no index, no backfill and no other table (
make db-migrate-newcannot run on the shared dev database — the app user does not own_prisma_migrations— so the DDL was generated withprisma migrate diff --from-schema-datamodeland proven on a throwaway database, below). Rollback isDROP COLUMNand loses only the column.The wire type
MemoParticipantis the doc's § Participants table as a type:name, optionalemail/userId/trackKey, requiredexternalandsource: 'manual' | 'metadata'.externalis derived on read asuserId === nullafter the membership check and is never stored, so a guest who joins or a member who leaves needs no rewrite of the row.userIdis a member resolved from a verified email (write side, #1414); the read re-checks membership and drops the link when the person is gone.Detail, not list
participantsis top-level onMemoDetailResponse, afterspeakers. It is not onMemoInfo: that is the list row, and the list route omits the array by design (#1413, doc § Backward compatibility).toInfois untouched.The read and the
loadSpeakerstrapMemosService.getreadsparticipantsthrough a privatereadParticipants(row), never throughloadSpeakers'membersmap. That map isnew Map()whenever the transcript has no labels (speakers.ts:96), so a roster listed before the memo is transcribed would read everyuserIdas gone. Membership is its own read — oneworkspaceMember.findMany({ where: { workspaceId, userId: { in: ids } }, select: { userId: true } }), only when at least one participant names auserId— and the two questions ("who is this transcript label" and "who did the recording say was present") stay separate.The parse refuses instead of guessing, mirroring
notes.service.ts'sparticipantsOf: a stored value that is not an array of objects with a non-empty stringnamereads as[], never a partial list; unknown keys are dropped; every absent optional isnullon the wire, so a client never distinguishes absent from null.sourcedefaults to'manual'only when the key is absent — a hand-edited-row default, not a back-compat policy — and a present value outside the two refuses the list, because mapping it would be a claim the code cannot check. Nullability:email,userIdandtrackKeyare?: string | null;external: booleanandsourceare required; the API always sends all six.The MCP read gains it for free
knowledge_get_memoreturnsmemos.get(principal, id)whole (mcp/tools/workspace.ts:40) insidewrapUntrusted, so #1402's "MCP read includes participants" is met by this read with no change of its own and no page-text spec moving.Generated outputs
MemoDetailResponseis on the wire (@Returns('MemoDetailResponse')), somake api-clientwas run once from the final tree. It regeneratedapps/api/openapi.json,apps/api/src/config/contract-schemas.jsonandpackages/api-client/src/schema.d.ts;apps/api/src/common/contract-responses.generated.tsandapps/web/src/modules/help/docs/reference.generated.jsonwere byte-identical (no new@Returnsname, no new route/tool), so they are not in the commit.Divergences from the issue
apps/api/src/config/contract-schemas.json,apps/api/openapi.json,packages/api-client/src/schema.d.tsandCHANGELOG.md, because the response type is on the wire and a schema change is notable. The other two generated outputs in the brief's list are no-ops.apps/api/openapi.json'sinfo.versionmoves0.64.0 → 0.65.0. That is not this change: the committed document laggedPRODUCT_VERSION(apps/api/src/config/version.ts), andmake api-clientfrom this tree carries the catch-up. Named here so the hunk is not read as scope creep.Acceptance — #1402 (phase 1)
userId; a guest stays external; a deleted member loses the linkreadParticipantsdrops an id the workspace no longer holds and derivesexternal; no email is mapped anywhere yetPUT participantsis uploader-only (or the note owner), and a participant cannot be used to grant accessmake verify; specs cover the manifest, email mapping, guest and ambiguous namemake verifygreen; the roster read's specs are here, the manifest/email/ambiguity specs come with #1415/#1414/#1416knowledge_get_memoreturnsmemos.getwholeVerification
make verify— exit 0: 350 test files, 5363 tests passed (pnpm --filter @knowledge/api test:Test Files 350 passed,Tests 5363 passed).make db-migrateon the shared dev database — fails withpermission denied for table _prisma_migrations, before and after this change (the app user does not own that table). Not a fault in this diff; the migration was proven on a throwaway database the app user owns:prisma migrate deployapplied all migrations including20270221100000_memo_participants; a second run saidNo pending migrations to apply.information_schema.columns→participants | jsonb | NO | '[]'::jsonb; an INSERT that named no participants returned[];status,localeandsourcetook their defaults.ALTER TABLE "memos" DROP COLUMN "participants";removed the column and leftmemos' other 30 columns intact; re-applying the ADD restored[]on the existing row. The database was dropped afterwards.make api-client— exit 0 (both web apps' typecheck ran as part of it).scripts/load-bearing-check.py, file restored after each): replacing the membership read with an empty set → 3 cases red; droppingworkspaceIdfrom the membershipwhere→ 3 red; letting the parse skip a bad entry instead of refusing the list → 1 red.Review
Independent review before opening this PR — six fresh-context slices over the committed range (spec + work axes), then a delta round on the fix.
3598a936.participantsadded totoInfo, so the list route gains the field" — the added line is insideget's return object (memos.service.ts:287);toInfobegins at line 654 and never namesparticipants, andlistmapstoInfointoMemoInfo, which has no such field.