Files
heidi/lib/db
CatoandClaude Opus 5 92b023af19 feat: speaking rounds, and a take that is measured rather than scored (#69)
* feat(speaking): rounds people propose, and a take that is measured rather than scored

Study groups were a thread with more than one human in it. This is the same
social object with the medium changed, which is the half a diglossic variety
otherwise gives away for free.

WHAT IS HERE

Webinars (one voice, an audience) and circles (everyone in turn, eight max),
on topics proposed by the people who would come. "Regularly" is a field, which
made this a time-zone problem rather than a scheduling one: a round is an
absolute instant and a repeat is a wall-clock promise, and those disagree twice
a year. Adding seven days of milliseconds to a Tuesday in March produces a
Tuesday at 20:00 and an empty room, so the recurrence is computed in the zone's
calendar and the tests cross both Swiss changeovers in both directions.
Sittings are computed, never stored.

Heidi does not carry the meeting: `meetingUrl` is an https room the host
already has, and https only, because that string is rendered as a link for
every attendee and accepting the scheme as given would accept `javascript:`.

WHAT THE EVALUATION REFUSES TO DO

The obvious build for "AI evaluates your speaking" is a pronunciation score.
The overclaim register bans it by name, and no system transcribes Zurich German
reliably — the state of the art translates the dialect into Standard German on
the way, which is the exact information a learner needs. A score on top of that
is a number with nothing underneath it, handed to the one person who cannot
check it.

So: the signal is measured in the browser (durations, counts, mic clipping —
arithmetic over samples, no model, no ASR, and no speech rate because
syllables need a transcript); the learner writes down what they said, with the
reason on screen; and their own words go through the deterministic gate, then
one model suggestion over text they confirmed. Only `foreign` findings survive
— a `ß` is not something anybody pronounced, and flagging it would be
correcting spelling in a variety that has no standard spelling.

Two tests pin the ban: no field of the measurement reads as a rating, and no
speaking copy in any of the seven languages offers a score.

PRIVACY

The audio never leaves the page that recorded it and the takes are device-local
under `heidi.takes.v1` — no audio table, no upload endpoint for takes, no
transcript of anybody's speech. A table of how somebody sounds when they are
bad at a language is worse than a table of the words they looked up, and the
cheapest way to honour that is to never hold one.

Mobile first: one big record target, a live level so a dead microphone is
visible in the first second, single-column forms that pair up from `sm`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(speaking): the page now reads in the order its own lead promises

Four things found by looking at the running page rather than at the tests.

THE ORDER. The lead says "webinars and circles on topics you propose, and IN
BETWEEN practise out loud", and the page rendered practice first. The original
reasoning was real — practice is the half that works signed out, alone, with an
empty calendar above it — but it loses to a simpler test: read the lead, then
look at the page. A reader resolves that disagreement by deciding the page is
about something other than what it says it is about.

A HYDRATION MISMATCH. `recordingSupported()` reads `window`, so calling it in
the render body made the server draw the button disabled with "this browser
cannot record" underneath and the client draw it enabled. React threw the
server HTML away and said so in the console. It goes through `useClientValue`
now, the same primitive `useStorageReady` uses, with an optimistic server
value.

A ROUND IN PROGRESS FELL OFF THE LIST. "The next sitting at now" excludes one
that started five minutes ago, which is exactly when somebody running late
opens this page looking for the link — and for a weekly round it was worse than
vanishing, because the list would advertise next week while the thing was
happening. The question is asked from one duration ago now, and the answer
carries `live` so the row can say so. Computed server-side: a client-side
comparison is a hydration mismatch whose answer depends on the visitor's device
clock. Two regression tests.

AN UNCLICKABLE CALL TO ACTION. "Make a round of it" rendered as flat grey
caption text beside the interest count, reading as a button that was not one.

Also: `/de/speaking` joins the post-deploy smoke check, whose own rule is every
page a visitor can reach by name; and the third loop is written into the
canonical doc, ending in a room with other people rather than in a mark out of
ten.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat(privacy): the voice recording is named on the page that enumerates flows

The privacy page landed in #68 while this branch was open, and it works by
listing every place data goes with the storage key beside it, so a reader can
open their own dev tools and check. Speaking rounds landed at the same time and
were not on it.

That omission is the worst one available. The page's whole value is being
exhaustive, and the flow it was missing is the voice recording — which §10
itself names among the most private things a person owns. A privacy page that
enumerates nine flows and silently skips the microphone is worse than one that
never claimed to be complete.

Two flows now:

  speakingTakes       device, `heidi.takes.v1`, leavesDevice: false.
                      The audio is decoded and measured in the page that
                      recorded it and then dropped. No audio table, no upload
                      endpoint for takes, no transcript of anybody's speech.
  speakingSuggestion  vendor, `/api/speaking/take`, the confirmed sentence only.
                      Never the audio, never stored — one request, answered and
                      forgotten, exactly like a signed-out chat.

The existing test that every named `heidi.*` key still appears in the code now
covers `heidi.takes.v1` too, so renaming it would fail the build rather than
turn the page's invitation into a dead end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 06:51:48 -07:00
..