Skip to content

feat(memos): the voice profile row, its vertex and the teardown filings - #1556

Merged
hrustalq merged 2 commits into
devfrom
feat/1553-voice-profiles
Dec 3, 2026
Merged

hrustalq merged 2 commits into
devfrom
feat/1553-voice-profiles

Conversation

@hrustalq

@hrustalq hrustalq commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Closes #1553
Refs #1403
Refs #1400

What lands

voice_profiles and the VoiceProfile vertex, dark: no route, no reader, no write. Phase 2.2 (#1554) adds
enrollment, the embedding and the purge; 2.3 (#1555) adds the consent screen and the admin switch.

The row, and why the vector is not in it. voice_profiles holds one row per (workspace, user): the pinned
model/dimension pair, sample_count, consent_version, consented_at, and the revoked_at a withdrawal
sets. It deliberately has no embedding column — the vector is the VoiceProfile vertex in ArcadeDB
(profileId, workspaceId, userId, embedding), one per row. A copy in PG would have no reader (every match
goes through the index) and would be a second home for one value; docs/features/89 § Voice profiles supersedes
#1403's row list on exactly this point. No FK on either id (house policy) and no extra index: the unique
(workspaceId, userId) pair is the upsert key enrollment will use.

The pinned pair and the 192-d index beside EMBEDDINGS_DIM. VOICE_EMBEDDING_MODEL, VOICE_EMBEDDING_DIM
(192) and VOICE_CONSENT_VERSION live in apps/api/src/voice/voice.constants.ts — the home 2.2's service and
processor import; nothing is on the wire. ensureSchema emits the type's DDL (VOICE_PROFILE_DDL, no
LSM_VECTOR line) and then calls ensureVectorIndex('VoiceProfile', VOICE_EMBEDDING_DIM) outside the four
text types' loop, so a change of EMBEDDINGS_DIM never rebuilds the voice index and vice versa. The helper's two
messages now name the type's own configured dimension instead of EMBEDDINGS_DIM, which would have lied for the
voice index on a rebuild.

Swept, not operator-queryable. 'VoiceProfile' joins WORKSPACE_VERTEX_TYPES, so deleteWorkspaceGraph
deletes its rows with the workspace (DELETE FROM … WHERE workspaceId = :workspaceId). OPERATOR_QUERY_TYPES
filters it back out beside the constant: an embedding is biometric, and the operator SQL read would hand it to a
person. The type is deleted with its tenant and never readable by anyone.

The two teardown filings. WORKSPACE_TEARDOWN files VoiceProfile: 'workspace' above WorkspaceMember (the
row that RESTRICTs the workspace stays last); USER_TEARDOWN files it 'delete' — the future account route owns
DELETE FROM VoiceProfile WHERE userId = :userId, and no route exists yet, so the inventory is the deliverable.
Both inventories' completeness specs already fail on an unfiled model; each gained a disposition case.

The migration is hand-made and database-free: prisma migrate diff between origin/dev's datamodel and this
tree, because prisma migrate dev cannot run against this machine's shared database (the app role does not own
_prisma_migrations). It is one additive statement plus its unique index, stamped 20270223100000 so it sorts
after 20270222110000_speaker_matches:

CREATE TABLE "voice_profiles" (
    "id" UUID NOT NULL,
    "workspace_id" UUID NOT NULL,
    "user_id" UUID NOT NULL,
    "model" TEXT NOT NULL,
    "dimension" INTEGER NOT NULL,
    "sample_count" INTEGER NOT NULL,
    "consent_version" TEXT NOT NULL,
    "consented_at" TIMESTAMPTZ NOT NULL,
    "revoked_at" TIMESTAMPTZ,
    "created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT "voice_profiles_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "voice_profiles_workspace_id_user_id_key" ON "voice_profiles"("workspace_id", "user_id");

It applied to a throwaway scratch_1553 with ON_ERROR_STOP=1, \d voice_profiles listed the eleven columns and
the unique constraint, and DROP TABLE / dropdb removed the database. Rollback is DROP TABLE "voice_profiles"
— nothing reads it and no vector can exist yet, so dropping leaves no state behind.

Blast radius beyond the issue's file list: apps/api/src/config/env-report.ts and its spec. The admin config
page files every env key by prefix and env-report.spec.ts fails on any key grouped as other; VOICE_ joins the
memos group, which is the call-participant feature's home. That is one map line and one assertion, not a new
knob.

Divergences from the issue/doc

Verification

  • make verify (db-generate + lint + typecheck + deps + test) exited 0 on 2fee3acb, all four @knowledge/api
    tasks with cache miss: 350 test files, 5,429 tests passed; dependency-cruiser clean (1,246 modules).
  • The scratch-database proof above; scratch_1553 is dropped.
  • Specs added: ensureSchema builds exactly Chunk@1024 and VoiceProfile@192, a second call issues no
    LSM_VECTOR, a changed text dimension rebuilds Chunk only; SELECT FROM VoiceProfile (and a projection
    naming embedding) is refused as unscopedTarget; both inventories pin their disposition.

Operations: VOICE_PROFILES_ENABLED (default false) is the platform ceiling for voice profiles. Nothing
reads it until phase 2.2 mounts the enrollment route; leave it off. The migration is additive and reverses by
dropping voice_profiles; the ArcadeDB type is created on the worker's next boot and holds no data.

Review

Independent review before opening this PR, five fresh-context slices over the committed range (the
model/migration, graph.service.ts, the env/changelog files, the vector spec, and the inventories with their
specs). Four passed; one blocked and is fixed.

  • Fixed: the vector spec had no case for the upgrade path — Chunk's index already current, VoiceProfile's
    absent, which is every deployed store's state on this release → 2216edc5 adds it and pins that only the
    192-d voice index is built.
  • Rejected: none.
  • Deferred: none.

`voice_profiles` holds one row per (workspace, user) — the pinned
model/dimension pair, the sample count, the consent version and the
revocation stamp — and no embedding: the vector is the `VoiceProfile`
vertex in ArcadeDB, one per row, indexed at VOICE_EMBEDDING_DIM beside
the text types' EMBEDDINGS_DIM.

Dark on purpose: no route, no reader, no writer. `ensureVectorIndex`
now names the type's own dimension in both messages, and the type joins
WORKSPACE_VERTEX_TYPES for the teardown sweep but is filtered out of
OPERATOR_QUERY_TYPES — an embedding is biometric.

Refs #1553
… is current

The upgrade path every deployed store takes: Chunk already at EMBEDDINGS_DIM
and no VoiceProfile index. Only the 192-d voice index is built.

Refs #1553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant