Repository navigation
feat(memos): the consent screen, the enrollment settings and the admin switch - #1560
Merged
Merged
Conversation
…n switch Settings → Profile gains the person's voice card: the versioned consent text (en and ru, `VOICE_CONSENT_VERSION = 'v1'`), one 30–60 s recording or upload, the enrolled date and sample count, withdraw and delete. Re-enrolling shows the text again and asks for a fresh checkbox; a refused sample renders its reason inline; recording stops every track in its cleanup path and keeps no copy. Settings → Features gains the workspace admin's switch and the enrolled count, saved on change rather than with the page's Save. With the deployment's ceiling off the box is disabled and the notice names `VOICE_PROFILES_ENABLED`; the stored value stays visible so the admin's choice survives. The pair behind them is a dedicated, admin-only `GET | PUT /v1/workspaces/:id/voice-settings` (the `analytics/settings` house shape): the read answers with the ceiling off so the screen can say why the switch is unavailable — the person's routes keep their 404 — and the write refuses 409 `ceiling-off`, auditing `workspace.voice_profiles_updated` only when the value moved. The count is this workspace's active consents (`revokedAt` null), a number and never a person or a vector. Refs #1555 Refs #1403 Refs #1400
The permission prompt outlives a navigation: getUserMedia can resolve on an unmounted card, and the take would then run to its 60 s stop with nobody watching. Unmounting during the prompt now stops what arrived and records nothing. Refs #1555
…suite
The russian rule picks form 0/1/2/3 for 0/1/2-4/5+, so the brief's three-form plural put a count of two on the 5+ copy («2 участников»). Both ru plural keys carry the four forms now, pinned by a case. The API spec's duplicate 'follows the ceiling' GET assertion inside describe('PUT') is dropped: the GET suite already proves the same three fields.
Refs #1555
… pinned per reason Withdrawing or deleting under a recording left the take to POST an enrollment for a row that no longer existed; the three actions are disabled while a take runs. The elapsed seconds get their own live region instead of wrapping the Stop button, so the announcement is the time and not the control. The model spec now proves one distinct key per reason and that the fallback resolves in en and ru. Refs #1555
Between the click and a running recorder the permission prompt leaves the button live, so a second click started a second getUserMedia; the first stream, recorder and ticker were then overwritten and leaked. A starting flag closes that window and every control that depends on the take (consent box, record, upload, withdraw, delete, re-enroll) is disabled through it. Refs #1555
This was referenced Dec 3, 2026
Closed
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 #1555
Refs #1403
Refs #1400
What this ships
The voice feature's surface: the person's consent card on Settings → Profile, the workspace admin's switch and
enrolled count on Settings → Features, and the small admin API that carries them. No person's route changes, no
schema, no migration, no matching, no memo-page UI.
The admin API — a dedicated, admin-only pair
GET | PUT /v1/workspaces/:id/voice-settings, declared byVoiceSettingsControllerunder@Controller('v1/workspaces')besideHomeController(the house shape for a second controller on the same base),both
@Access('admin', 'workspace'). The answer isVoiceSettingsResponse: the storedvoiceProfilespolicy(
nulloff /'allow'on),ceilingEnabled(VOICE_PROFILES_ENABLED),enabled(both on) andenrolledCount.switch could not say why it is unavailable, which the doc's § Fallback asks it to. The write refuses 409
ceiling-offwitherror.voice.ceilingOffand writes nothing — an admin cannot turn on what the env left off.prisma.voiceProfile.count({ where: { workspaceId, revokedAt: null } }). A rowwhose embedding failed still counts (it is a consent); a withdrawn row does not. No query selects a user id, a
vector or a sample key.
workspace.voice_profiles_updatedwithparams { from, to }andtarget: workspaceId; a no-op write records nothing (the audit spec's "no action that nothing records" gatecovers the new action).
The person's screen
VoiceProfileSectionmounts below the Profile page's two groups, full width — a biometric consent is a thirdconsequence, not a row in "Profile" or "Signing in". It renders nothing when the GET answers 404 (either gate off
is "not offered", not an error) and a retry line for any other failure. States: not enrolled (consent text, an
unchecked checkbox, controls disabled until checked), enrolled (the date, the sample count, re-enroll, withdraw,
delete), withdrawn (the date, the enroll flow again), busy, and a refused sample rendered inline through the
reason map — never a toast, because the person must read why.
The consent text is the doc's § Consent block verbatim, one version (
v1), in en and ru; the POST echoes theconsentVersionthe screen showed. Re-enroll is the same flow and requires a fresh checkbox — consent is notinherited. Withdraw keeps the revoked row and deletes the signature; delete removes both; delete is the destructive
confirm.
The admin screen
VoiceRecognitionPanelfollows the purpose/features form, inside the admin branch, and saves on change — it neverrides the page's Save. It shows the stored choice (not the effective one), disables the box with the ceiling off and
names
VOICE_PROFILES_ENABLED; the count uses plural copy and is the only per-workspace answer.Recording and the sample
getUserMediaruns on click only;MediaRecorderusesaudio/webm;codecs=opuswhen supported, else the browser'sdefault. The timer is wall-clock from the start and ends the take at 60 s; Stop is disabled under 30 s. Every
track is stopped in the release path and on
beforeUnmount, and the take becomes aFilethat one multipart POSTcarries and then drops — no object URL, no storage entry, no reference after the answer. Uploads have no client-side
duration bound: the browser cannot read an arbitrary file's duration, so the server's 422 is the refusal, rendered
inline through the same map.
The POST goes through
http(axios), notapi.post: that route's typed body is the JSON DTO, so the typed clientwould serialise a
Fileas JSON. NoContent-Typeis set by hand — axios writes the boundary — and the existingcookie/CSRF/locale/trace interceptors apply unchanged.
Divergences, named
policy "rides the existing settings PATCH, no new route". No such PATCH exists (
PATCH /v1/workspaces/:idonlyrenames), so the settled decision is the dedicated
analytics/settings-shaped pair above. The doc's row is thesentence this supersedes; it is not edited here because the task's deliverable list does not carry the doc.
SettingsPage.vueline is answered "no new page". There is no nav row, router change ormeta.feature: the person's card lives on the existing Profile page and the admin panel on the existing Featurespage.
SettingsPage.vue, the router andnav.tsare untouched.apps/web/src/shared/api/line is answered by the existing client. The calls live in the module'smodel/voice-api.tsonapi/http;shared/api/gains no file. The reads useapiQueryOptions, the app's oneread path, so
voice-api.tscarries the calls that builder cannot express (multipart, the mode-bearing DELETE, thePUT).
profileSettings.voice.uploadHint, notupload.hint. The copy list givesuploadas a label andupload.hintas a hint; one JSON node cannot be both a string and a namespace, so the hint is a flat sibling andt('profileSettings.voice.upload')stays a label.multiple-voicesrefusal deletes the row and the next read is not-enrolled. That is the doc's async shape, and thescreen deliberately has no "failed" state for it.
workspace.voice_profiles_updated) beyond the threevoice.*the doc names, becausethe admin's policy write is a new write; the three person actions stay 2.2a/b's.
(
russianPluralRule) picks form 0/1/2/3 for 0/1/2–4/5+, so a three-form string puts a count of two on the 5+ copy(«2 участников зарегистрированы»).
features.voice.countandprofileSettings.voice.samplestherefore carry the«2 участника / 5 участников» pair, and a model case pins it. English keeps its two/three forms: its default rule
maps 0 onto the plural copy, which is correct.
Per-criterion table
#1403's acceptance rows this task touches:
VoiceSettingsControlleris admin-only; the response is five fields, the count a number; no route here takes a user id.voice-settings.spec.tspins the ACL metadata and the field setVoiceProfileSectionstates + smoke: enroll → date and count; delete → not enrolled, row and sample object gone; withdraw → withdrawn with its date. The vector purge itself is 2.2b's (voice.service.ts), untouchedenrolledCountonly; the person's routes keep taking the principal (2.2a, untouched). No new surface names a personPUT409ceiling-off, stored value unchangedVOICE_CONSENT_VERSIONshown and echoed; checkbox starts unchecked; re-enroll re-asksvoice-settings.spec.ts: count predicate, ceiling refusal, audit-on-move, ACL metadata, DTO; the 2.2a/b specs cover consent version, deletion and cross-workspace isolationmake verify#1406 (phase 5) re-proves the durable browser gate: consent, deletion, guest and cross-workspace flows at three
widths, keyboard and both languages. This task's browser run is the bounded manual smoke below, not a committed spec.
Verification
make verify— exit 0: lint 9/9, typecheck 9/9, dependency rules 4/4, tests 4/4; web 787 tests (message-keys,catalogue parity, security labels included), API 5528 + 1 skipped, UI 4.
pnpm exec vitest run test/voice-settings.spec.ts test/voice.spec.ts— 44 tests, 2 files.make api-client— the diff is the one new path,VoiceSettingsResponseandVoiceProfilesPolicy, the client,contract-responses.generated.tsand the docs reference; no other feature's route or type moved.Manual smoke (throwaway database, API :3110, web :5180)
One run against a fresh
knowledge_voice_1555database, the model dir andVOICE_PROFILES_ENABLED=true:/settings/features: the switch off → count "No one is enrolled yet."; turned on through the UI → toast"Voice recognition updated.", count 0, no error.
/settings/profile: the card appears below the two groups; the consent text renders with the bold lead-in and themodel name as a code span; the checkbox starts unchecked.
.wavunderworkspaces/<ws>/voice/<user>/<profile>.wav, andvoice.consent {consentVersion: 'v1'}in the audit. A 10 s file→ the inline
role=alert"That recording is shorter than 30 seconds." and nothing written.voice.revoked {mode: 'delete'}, count 0. Re-enrolled (the textshown again, fresh checkbox) and withdrawn → "Consent withdrawn on 3 Dec 2026, 23:33", row kept with
revokedAt,object gone,
voice.revoked {mode: 'withdraw'}, count 0.VOICE_PROFILES_ENABLED=false: the panel shows the checked-but-disabled switch and"Unavailable on this server: VOICE_PROFILES_ENABLED is off…"; the profile page renders no card and no error; a
direct
PUT 'allow'answers 409ceiling-offand the stored value staysallow.disabled, "32 s" with Stop enabled; stopping sent the take and the server refused it —
sample-clipped("That recording is distorted — the level is too high.") inline. Chrome's fake device emits a full-scale tone, so
the take cannot pass the level check; the recording path is therefore proven from
getUserMediathrough themultipart POST to the server's 422 and its inline reason, and a successful synthetic enrollment is feat(memos): call participants phase 5 — evaluation, false-identification guardrails and release #1406's.
Every resource was torn down: the database dropped, the three ports free, the object-store bridge and the throwaway
harness removed.
Review
Independent review before opening this PR (spec + work, fresh contexts). The range was sliced by area — API service
and DTO, controller/contracts, the two API spec halves, the web model, the calls/panel/mounts, the card's script and
template, the model spec, and both catalogues — and every fix went through a delta round. An interrupted slice was
re-cut smaller and re-dispatched; none was read as a pass.
features.voice.countandprofileSettings.voice.sampleshad three forms, so a count of two read«2 участников»; both carry the 2–4 form now and a model case pins it — 1bf4e51.
describe('PUT'); the GET suite alreadyproves the same fields, so it is dropped — 1bf4e51.
busy, so a delete under a take left the recorderPOSTing an enrollment for a row that no longer existed; all three are disabled while recording — 02d790e.
announcement carried the control; the seconds own the live region now — 02d790e.
getUserMediapromise resolving after unmount could keep a stream running to its 60 s stop; the mountstops what arrived and records nothing — 0a2d2fb.
that the fallback resolves in en and ru — 02d790e.
getUserMedia's permission prompt opened a second stream, overwriting and leakingthe first recorder and ticker; a
startingflag closes that window and every control that depends on the take isdisabled through it — e379211.
profileSettings.voice.sampleslacks a zero form." English has two plural categories, and theapp's default rule (
choice === 1 ? 0 : 1) renders a count of 0 as "0 samples", which is correct; the line is onlydrawn when enrolled anyway, and the agreed copy is two forms.