7 Commits
Author SHA1 Message Date
CatoandClaude 48bb056e94 Every practice answer recorded per word and line (#422)
Per subject: how often asked, right, typed, time spent, last answered, and
the last wrong answer. Written in the one recorder (record.ts rule 5),
stored in the browser, synced as a summed progress key, shown on a word's
page in all seven languages, declared on the privacy page.


Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 00:56:33 +01:00
CatoandClaude 59419a1063 release: places on every page, situations as guided runs, profile and Mein Bereich, modular code (#361)
* feat(profile): a learner profile, and a personal page that answers three questions

One profile model as a view over the stores that already hold each answer;
the setup «Dein Profil einrichten», one question per screen; the profile
card on the personal page; «Wo stehe ich?» and «Nutze ich Heidi gut?»;
progress kept with the account by default; reminders only when behind the
learner's own weekly goal.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* docs(profile): record the new sync default and the profile; audit the setup screen

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(profile): interests lead the listening

One more profile question, «Was interessiert dich?»: nine choices that name
the topics every row of the listening register already carries. The
listening page opens with the rows that fit, each saying which choice it is
there for and how much can be asked about it; «Nutze ich Heidi gut?» names
one of them when the thing to do is listen. Chosen in the browser, so the
page stays cached; stored as a field of the profile record.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix: an eight-character password floor, a localised investors door, page titles and four layout leftovers

- A new password needs eight characters (sign-up, change, reset), through a
  plugin the account package accepts; signing in with an older, shorter
  password still works. The message is in all seven languages.
- The investors door says «Passwort / Öffnen» in the reader's language.
- A failed sign-in, the unsubscribe page and the signed-in personal page
  have their own titles; a test holds every page to one.
- The kept sentence under a saved word is no longer hyphenated
  («Schlüs- / sel» at 320px).
- «Warum die Übungen so gebaut sind» is a closed row with a chevron.
- The account forms' primary button is black, like every other.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(sync): the merge policy is a tested function; the profile says when sync failed

What one pull changes in this browser moved out of a useEffect into
lib/domain/progress/merge.ts (planMerge, decodeDevices, statusAfter), with
tests for every rule. The runner only fetches and writes.

A failed request and a 401 used to be swallowed; the personal page went on
saying progress was stored with the account. They are now reported through an
in-memory status, and the sync line shows when it last got through, that it
did not (with a retry), or that this browser is signed out (with the way in).

One deliberate difference: a device that holds no bridge/difficulty choice
no longer hides an older device's choice from a third one.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(practice): one recordAnswer, a tested and resumable test run, exercise words by context

Items 2, 3, 7, 13, 16 and the practice and test screens of 12, which share files.

recordAnswer (lib/domain/practice/record.ts) is the one place an answer is
written into history, model, memory and the day. The sitting and the warm-up
wrote it out twice with different rules and the test a third time. Decided:
the first answer teaches (the sitting's rule); the day counts from the first
answer, so a warm-up left half way now counts (the sitting's rule won); a
test answer counts for the day only, kept on purpose and said why.

The test's draw and its stored shape are lib/domain/practice/test-run.ts,
tested. A run survives a reload (heidi.practice.test.v2, per course, on the
privacy page), keyed by sitting, with the clock held as a deadline.

practice-session.tsx 620 -> 217 and test-session.tsx 427 -> 146: state and
rules to use-sitting.ts, use-test-run.ts and lib/domain/practice/sitting-run.ts
(tested); LevelRow, UsedUp, the test's start and result screens, and the
warm-up's result are their own files.

The six dictionary slices every exercise read as props come from one
provider (exercises/words.tsx); the pages build them with exerciseWords().

heidi.voice.v1 is on the privacy page, so 'delete everything on this device'
removes it; privacy.test.ts now checks both directions.

The warm-up and the home page's speech bubble take the variety from the pack
instead of writing 'gsw', and the leak ratchet covers app/.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* revert(auth): accounts stay the package's; no password rule of Heidi's own

Sign-up and sign-in behave exactly as @bitbaum/accountkit defines them. The
eight-character floor added here as a local plugin is removed, with its
message and note; a rule about passwords belongs in the package, for every
app at once, or nowhere.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(model): one chain, a tested judgeTake, and the speaking check says why it has nothing

Items 4 and 8.

lib/domain/model/chain.ts: modelChain() and ownChain() replace four copies of
usableChain(freeChain("HEIDI")), and hold the health tracker three routes
imported from the chat's route file. A test fails on a fifth copy.

lib/domain/speaking/judge.ts: the take's judgement (request reading, the
bridge/target gate, the model call, the gate on the suggestion) with tests
and an injectable model. api/speaking/take/route.ts 222 -> 45 lines.

The route's answer now says which kind of nothing it is (opinion), and the
screen reads the status too: a rate limit, a model that could not be reached
and a model with nothing to add each have their own sentence, in seven
languages. Before, all three printed 'Heidi has nothing to add right now'.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(shell): an error screen inside the site, and loading states where they cannot change a status code

Item 5.

app/[locale]/error.tsx: a page that throws keeps the header, footer and chat,
says so in the reader's language, and offers retry and the way home. Its five
words come from the layout through a small context, so the dictionaries are
not shipped to the browser.

loading.tsx is NOT at app/[locale]/, on purpose. It was added and measured: a
loading file starts the response before the page runs, so 9 of 22 probed
addresses changed status (every unknown page 404 -> 200, /account and /portal
307 -> 200). The same screen is instead the loading state of the six routes
that can only answer 200 (vocabulary, speaking, listen, profile, settings,
warmup), and a test fails if a loading file is put above a page that calls
notFound() or redirect().

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(a11y): the two modal sheets are real modals, and an accessibility pass over existing screens

Item 6.

The sitting's settings and the model connection claimed aria-modal on a plain
div with no focus trap. Both are now chatkit's Sheet (a native dialog opened
with showModal): focus stays inside, the page behind is inert, Escape closes,
and the opener gets focus back. A test fails on aria-modal anywhere else.

The pass, in code:
- the model sheet's close button was labelled with a multiplication sign; it
  is the package's labelled 44px button now (model.close, 7 languages)
- tap targets under 44px raised: the settings chip, saved words' export and
  clear, a take's delete, a failed chat bubble's retry, the word popover's
  button, the invite link's rotate
- a listening question marked the right option by outline colour alone; it
  carries the drill's tick and cross
- seven error lines appeared without role=alert (topics, rounds, recorder)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(chat): one way to follow a conversation, and the dock in three files

Items 10 and 12 (dock).

chat.tsx, the dock and the group chat each scrolled a marker into view on
every change of the messages. That is now chatkit's useStickToBottom behind
one small hook (chat/use-follow.ts): the thread is followed until the reader
scrolls up, so a token or a message from someone else no longer pulls them
away from an older answer.

chat/dock.tsx 577 -> 235: the panel is chat/dock-panel.tsx (242), and the two
facts only a browser knows about the launcher (is it lying on a control, how
tall is it) are chat/use-dock-launcher.ts.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor: answer view, round list and chat workspace under 300 lines, with their logic in lib

Item 12, the remaining three.

chat/answer-view.tsx 421 -> 185: the glosses, the suggestions and the row of
buttons are their own files; what the row holds (ownRowItems) moved to
lib/domain/chat/row.ts with tests.

round-list.tsx 415 -> 216: the form to open a round is round-open.tsx; what a
viewer may do with a round (roundChoices) and the request a host's form
becomes (newRoundBody) are lib/domain/speaking/round-view.ts with tests.

chat/workspace.tsx 415 -> 263: the transport is a hook, the words handed to
chatkit's ChatApp are workspace-words.ts (tested in all seven languages), and
the offer to keep a browser conversation is adopt-prompt.tsx.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(http): one id pattern, one organiser check, one audio-upload guard

Item 11.

The UUID pattern was defined in eleven files; it is lib/http/ids.ts.
organiserGroup was written out in the invite and the team route; it is in
lib/domain/groups/store.ts beside groupById. The bounded read of an uploaded
recording, copied between the two transcription routes, is
lib/http/audio-upload.ts with tests. A test fails on a second definition of
any of the three.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* chore: remove dead code and dictionary keys nothing reads

Item 15.

scripts/responsive-audit.mjs is superseded by scripts/audit/responsive.mjs,
which package.json's audit:responsive runs; nothing referenced the old one.

Exports with no reader anywhere (code, tests or scripts), found with knip and
confirmed by search: draftTransport, CowLockup, useHistoryView, recordFor,
Prose, countNewSince, isChannelId, isVideoId, lastChanged, moveId,
forgetInterest (account deletion removes those rows in erase.ts),
isObjective, stretchOf, essaysAbout. useTheme is used only in its own file
and is no longer exported.

36 dictionary keys whose name appears nowhere outside the dictionaries, in
all seven languages: home.{trustTitle,trustBody,trustLink,pillarsTitle,
methodLink,researchLink,contributeTitle,contributeCta}, pillars,
check.{failShort,noteTitle}, technology.directionLabel, privacy.updatedLabel,
contribute.{needTitle,needList}, auth.{portalLead,notSignedIn},
streak.goalLabel, practice.{correctIs,buildPrompt,verifyPrompt,typeLabel,
testAnswer,testDone}, essays.notTranslated, review.noneHint,
organisations.momentLabel, shell.{wordsTitle,wordsDue,wordsNone,wordsOpen,
courseSteady,resumeTitle,resumeProgress,resumeNone,resumeStart}.
Keys read by id (privacy.flows.*, chat.learn.*Label, feedback reasons) were
checked and kept.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(a11y): the modal sheet gives focus back to what opened it

Found in the browser: closing the model sheet with its close button left
focus on <body>. The opener was read in an effect, which runs after the
sheet's own effect has already moved focus into the dialog. It is read while
rendering now.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(shell): no focus ring round the error screen's heading

It is focused by the page so a screen reader starts there; the ring drawn
round it read as a text field.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(components): one folder per feature under _components

The flat folder of 131 files is sorted the way chat/, exercises/, profile/,
session/ and speaking/ already were: shell, shared, home, languages, dialect,
dashboard, vocabulary, listening, channels, groups, rounds, sync, practice,
situations, warmup, voice, byok, auth, essays. Files moved with git mv; no
barrel files, as before.

The stores that are storage and nothing else (practice, focus, streak, warm-up,
video), the one write path for an answer and the API error wording moved to
lib/browser and lib/http. Tests that scanned or named the old paths follow, and
the two that read 'this folder' still read every component.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(listen): «Für dich» is the first thing under the title

The rows that fit a learner's interests, or the one card that asks for them,
sat below the diglossia warning. They now come straight after the title and its
lead; the warning, the day's picks and the whole register stay below.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* chore(i18n): drop footer.varietyName, which nothing reads

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* chore: remove four exports and three types nothing references

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(listen, profile): the interest tiles stay under the finger; the sync choice is one column on a phone

Found walking the release at 390px.

/listen: the first tile tapped in the invite card already makes a pick, and the
card turned into the list at that moment, with the tiles pushed below three
rows. The card now stays a card until «Fertig», and then the list is brought to
the top of the screen.

Mein Bereich, signed in: the two answers to the sync notice sat side by side
inside the profile card, some 130px each, and «Nur auf diesem Gerät behalten»
stood four lines tall. One column below sm.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(situations): the logic of a guided run through one situation

A situation was a reference list, and practising it was a random draw of
eight questions. This adds what a guided five-minute run needs, as pure
functions with typed results and no screens.

lib/domain/situations:
- planRun: every heard line in pack order with one question about its
  meaning, then up to two lines built from their words and said aloud,
  then the whole exchange again. Deterministic for a seed; a stored run is
  rebuilt from its step ids (heidi.situation.run.v2, per course, declared
  on the privacy page).
- situationProgress: followed x of y and new / started / followed / due,
  read from the learner model's line traces and the memory's due dates.
  A run's answers are recorded by recordAnswer; nothing else is stored.
- nextSituation, orderSituations: one recommendation with its reason, and
  the list with the learner's own situations first.

lib/situations: optional speaker, addressee, register, answers, reviewed
on a line and beats on a scene, with a validator test. Read from what the
packs and the reply questions already state (lines.ts); beats are written
for the fourteen scenes that were deepened by ten appended lines.

Fixes at the cause:
- a sitting on a scene no longer takes a quarter of its questions from
  the neighbouring scenes, and no longer asks a word inside a line of
  another scene;
- a wrong meaning in «Stimmt das?» is the same sentence type as the right
  one wherever the scene has such a line;
- the speaking task list can be held to one scene.

Strings for the future screens are under situationRun in all seven
dictionaries.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(design): every main page opens with a place, lists are rows, and a sitting ends as a moment

Shared primitives in _components/shared: Scene (a full-height photograph
with the page's one headline, one line and one action on it, white on a
shade in both themes), RowList/RowLink (lists as rows with hairlines, no
cards), SectionHeading, and Ending (one full-screen ending for practice,
the warm-up, the test and a used-up scope). The type scale is three roles
in globals.css: headline, subhead, kicker.

Home, practice, listening, speaking, the situations list, languages, about
and Mein Bereich each open with their own Swiss place, by day and by
night: 16 photographs from Wikimedia Commons, author and licence read on
each file's page and listed in lib/config/photos.ts (credits on the
Impressum). During an exercise the question stands alone, without a box.
Motion is CSS only and off under prefers-reduced-motion.

Removes hero-photo.tsx and the card boxes around lists on these pages.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(situations): a situation is a guided run, and every ending hands on to one

A situation page was a reference list with «Üben» at the bottom. It is now
the opener of a five-minute run, one thing per screen:

- /situations/<id>: a photograph of the place, one sentence, lines and
  minutes, one button (start, or pick up at the step it was left on); the
  review state said once; the old list one quiet link away (./lines).
- /situations/<id>/run: each heard line alone with its one question, then the
  German; two lines to build and to say aloud with the speaking recorder held
  to this scene (played back, never marked); the whole exchange again without
  German, by speaker and paced; the shared ending with ONE next situation and
  its reason. Every answer goes through the one ledger; the place is kept.
- /situations: a run left half way pinned on top, the learner's own
  situations, then each domain, as rows with their state. The twenty-chip
  picker on /practice and the board of figures are this list now.
- The endings of practice, the test and the warm-up offer a situation when
  one is the learner's next step; the home page leads a new visitor to the
  warm-up; «Weiter: <situation>» on the home card and the personal page.
- The warm-up's pointer now holds: its own answers made the scene it points
  at read "started", so it was never recommended.

Design: during an exercise only close, progress and the question remain (the
sitting's name and choices are behind one button in the bar); kickers and
actions on one line at 390px; rows instead of boxes on listening, speaking,
grammar and vocabulary; on a wide screen the shade is only where the words
are. Openers with a crane, a scaffold or a flat sky are replaced, and the
situations open with their own places (Wikimedia Commons, credited in
lib/config/photos.ts).

The responsive audit walks a run through every kind of step to its ending.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(photos): the care briefs open on the lake, and the night opener has no cranes

The two pictures of the hospital were a dark office front behind a parked
car, and they opened every care situation. No better licensed picture of the
place was found, so the care scenes open on the lake by day and at dawn,
both already in the register. The blue-hour picture on the home page, the
practice page and the tram brief is replaced by one without building cranes
(Dark Blue Zurich, kuhnmi, CC BY 2.0, read on the file's page at Wikimedia
Commons). The tram brief keeps the tram's front on a phone and leaves the
car beside it out. The three unused files and their entries are removed.

The alt texts of the removed pictures go with the next commit, which
touches the same dictionaries.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(situations): a run is one part of a situation, about five minutes

A run through a whole situation was twenty-two steps, seventeen of them the
same «Stimmt das?». A run now takes one part: a beat where the scene has
one, about eight heard lines otherwise, with up to two lines to build, one
to say aloud and the replay of that part. The next run goes on with the next
part, read from the ledger (no second record); once every part has been gone
through, a run revisits the part with the most lines missed or due.

The brief says what the next run is (heard lines, minutes, part n of m), the
ending counts the part and, while a part is ahead, its one next step is that
part. Progress on the list still reads across the whole situation.

Questions vary: a «Stimmt das?» can be asked the other way round as three
meanings of the same scene, recorded against the same item, so one shape
does not come three times running where the line can be asked another way,
and the claims put to the learner are wrong about as often as right. The
claim is drawn as a claim, in its own labelled frame, not as the line's
translation.

Stored runs keep their shape; the replay's step id now names its part, so a
run stored before this is planned afresh.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(model): the free chain is built in one place, pass model included

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-26 03:58:15 +01:00
CatoandClaude edf2cd32c5 release: informal address everywhere, engine clean-up, account limits, owner numbers (#358)
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 18:07:34 +01:00
CatoandClaude 083dd52f0d feat(engine): courses in data, pack-declared forms, level sources, and meanings in the learner's language (#355)
* feat(course): every stored record names its course, and today's progress is the Zurich course's

A course registry (lib/course/registry.ts) lists the one course there is;
lib/variety/active.ts resolves its pack. Browser stores that hold course
progress move to an envelope keyed by course under .v2 keys, and a value
under the old .v1 key is read as the default course without being rewritten.
progress_devices, certificates and entitlements gain a course column that
defaults to the Zurich course. Item ids are unique across courses, and the
default course's ids are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack declares its articles, persons, respellings, voices and prompt lines

Article, FormLabel and VocabularyGroup were closed unions of the Zurich
values, the answer comparison folded Zurich respellings for every language,
word distance lower-cased as German, the voice ranking named two German tags
and the prompt builder carried Swiss spelling advice. Each is now a field of
the pack, read by the engine; a contract test over every pack refuses a value
the pack did not declare, and the leak test also looks for the taught
language's own words in engine code. The Ukrainian pack gains one verb with
its own pronouns and no articles. The 2,956 published items and the system
prompt are byte-identical.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(practice): an item's level comes from a source the course chooses

A course entered from a sibling language measures each item's distance from
that language, exactly as before; a course entered from zero reads a declared
CEFR band on the word, the line or the topic. levels.ts exposes both as
LevelSource and picks by Course.entry. Every published item keeps its level.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(meaning): a meaning can be shown in the learner's language

A meaning is the bridge form plus an optional gloss in the interface
language. One pure rule (lib/domain/meaning/meaning.ts) decides what is
printed from the learner's answer to «Wie gut ist dein Deutsch?»: good shows
German only, as before and by default; some shows German and the gloss; none
shows the gloss; without a gloss German is always shown. Every exercise, the
word list and the scene pages print meanings through one component. The
answer is a course store, set in the settings and asked once after the start
card, only in an interface language that has glosses. Gloss sets are one
file per course and language, loaded on demand.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): English and Russian meanings for every word and scene line; French and Italian for every word

Machine drafts from the Zurich form and its German meaning together, marked
unreviewed in the data. One file per language beside the pack, keyed by the
German the course gives. Tests refuse a key no entry carries, an empty gloss
and two glosses for one German form; pnpm run glosses:coverage prints what
is covered.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): French and Italian meanings for every scene line

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* docs: courses, pack-declared forms, level sources and glosses, as they now are

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack says which grammatical person each of its labels is

The gloss check and the prompt's auxiliary table, both new on main, matched
the Zurich labels «ich» and «er» by name. The forms pass of the leak test
caught it on rebase. The pack now declares personOf, and both read it; the
system prompt and the published items are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 14:17:35 +01:00
CatoandClaude a3f1255010 Commercial readiness: accounts and sync, practice rebuilt with levels, walkthrough fixes (#282)
* fix(privacy): never show an email address as a person's public name

Sign-up asks for no name, so requireActor's `name || email` made the email
the display name of nearly every account. It was stored on speaking topics,
rounds, attendance and group members, and the topics board is readable signed
out: GET /api/speaking/topics returned the proposer's address.

- publicName(): the chosen name, else a stable '#XXXX' handle from the actor id
- migration 0011 writes the same handle over stored addresses (UPDATE only)
- public topic/round lists return an account id only to its owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(auth): account mail in the reader's language

The shared template is English only. Through accountkit's render slot, the
verify / sign-in link / reset mails are written in the language of the page
the link lands on (its callbackURL); locales without copy use German.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(header): render the account control at request time in every build

authEnabled is read at module load, so a build without BETTER_AUTH_SECRET
prerendered every page with no sign-in control, and CI's layout audit
measured a header narrower than production's. connection() + authStatus()
make the header the same in every build; CI now starts with a throwaway
secret so the audits see the real header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(ui): one primary action on the home fold; dock off phone auth forms

- 'Jetzt testen' jumps to the chat, which on desktop is the column beside it:
  shown on phones only, leaving one primary button in the desktop fold
- the floating dock launcher covered the sign-in form's buttons at 390px;
  hidden on phone-sized account forms only (guarded list updated)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(security): outbound fetches, feed parsing and upload limits

- channels: every feed/redirect/audio/transcript fetch goes through
  publicFetch (ai-kit validateFetchTarget per hop, 8 MB body ceiling); a
  signed-in user could previously make the box fetch internal addresses
- push: subscribe only accepts real browser push service endpoints
- sweep: one channel that throws is recorded as failed instead of failing
  the whole hourly sweep forever; entity decoder no longer throws or emits NUL
- a pasted transcript never replaces the publisher's/platform's
- feeds write at most 200 newest items (Postgres parameter limit)
- synced progress kept for at most 10 devices per learner
- transcribe routes refuse a declared oversize body before parsing it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* chore(packages): chatkit 0.23, plan bindings, experience ceiling, proxy.ts

- @bitbaum/chatkit ^0.23.0 (the registered release)
- package-plan: bindings matched to the code (createAuthMailer in mail.ts,
  ChatApp in workspace.tsx); experience ceiling set at zero
- the five dialect/transcript text boxes carry experience-exempt reasons:
  dictation would turn dialect into Standard German (HEIDI.md §6) or compete
  with the page's own recorder
- middleware.ts -> proxy.ts (Next 16 deprecation)
- drop the dead limitkit git allowBuilds entry (limitkit is on npm)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): 2026-11-09

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(design): adopt @bitbaum/design-tokens faces and composition grammar

The type stack asked for Helvetica Neue, which only Apple ships: Windows drew
Arial and Android Roboto. Inter and IBM Plex Mono are now self-hosted from
the package (app/fonts.ts, generated by design-tokens-next-fonts, latin,
latin-ext and cyrillic), and composition.css is loaded. Heidi keeps its own
palette, as the package README asks of a product with its own brand. Also
the keyframes for the sitting celebration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): ask what the learner needs Swiss German for

'Meine Situationen': a learner picks the situations they actually face, and
every practise button (Today, the dock, the welcome-back card) draws from
them through a new multi-scene scope (?scenes=a,b). One choice is the
ordinary scene scope; none is everything. Device-only, declared on the
privacy page. The signed-in home leads with it; the warm-up invite is a
quieter line under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): shorter first screen, welcome back, a finish worth reaching

- home at 390px: 10,415px -> 7,270px; the personal moments stay without
  their paragraphs, society's moments move to /organisations
- a returning signed-out learner gets their next step above the intro
- the end of a sitting shows the day earned and the week filling (no score)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(voice): server voice when the device has no German voice

Read-aloud only used the browser synthesiser, so most Windows/Linux machines
said 'no voice'. /api/speak reads the line with a German Gemini voice
(GEMINI_API_KEY, already on the box): generateContent on
gemini-2.5-flash-preview-tts, then the interactions route on
gemini-3.8-flash-lite-tts; PCM wrapped as WAV; rate-limited, 600 chars,
small cache. The device's own voice is still tried first, the label stays
'german', and a failed server call reads exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(chat): 'sign in to keep it' keeps it without asking twice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): situations, voice, home

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): choose your situations on /practice too

A signed-out learner has no signed-in home, so /practice is where they say
what they need Swiss German for. The tiles drop their decorative checkbox:
at 390px it left 94px for «Treppenhaus» and «Вечернее беспокойство»; the
fill and aria-pressed carry the state. responsive audit: 1386 renders, 0
overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): instant, unmistakable feedback on every answer

The right answer used to turn black whether or not it was picked, and
'wrong' had no colour, so a learner had to read the bar to know. Now:
the tapped option turns green with a tick or red with a cross (pop/shake,
off with reduced motion), the right one is outlined green, and the verdict
is a tinted strip with a varied word of encouragement. A right answer moves
on by itself after 1.3s (countdown on 'Weiter'; 'Warum?' holds it); a wrong
one keeps its explanation. A short vibration on phones. '3 in Folge' when
true. New correct/incorrect colour roles in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): no two sittings alike

orderSession takes a seeded random and uses it only where the order was
arbitrary (the alphabetical tie-break between equally due, equally weak,
equally fresh questions and kinds); every new sitting gets a fresh seed.
Options, word banks and matching columns are laid out afresh each time a
question is shown (present.ts), answers remapped. Same seed = same sitting,
no seed = the old order; due and weak items still come first (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): build the sentence, 'Stimmt das?', and a recognise-then-produce ladder

- build: the Zurich words of a line the learner says (3-9 words), shuffled
  with one stranger from the same scene, tapped into order, marked by the
  app (134 items). Production that is objectively checkable.
- verify: a heard line with a meaning beside it, true or not, one tap; false
  meanings come from the same scene (275 items).
- ladderOf: until a line is recognised reliably, recognition forms come
  first; afterwards production forms. A tie-break after schedule and
  pressure, never before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): practice rebuilt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* style(practice): answer feedback in Heidi's own colours

No green: it belonged to no other screen. The feedback roles now alias the
palette: right is ink (the action colour, black / white in dark) with a
tick; wrong is the flag red the theme reserves for errors, as an outline on
the existing pale red tint rather than a red slab; the revealed answer is
outlined in ink. The verdict strip is neutral grey or pale red; the end-of-
sitting check and week cells are ink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): one measure of distance from German, and a level on every exercise

lib/domain/vocabulary/distance.ts classifies a Zurich word against its German
as same/close (incl. a dropped -ch/-n: au, no), rule (free once one of the
pack's sound correspondences is applied: Chind, chaufe), far (nöd, öppis) or
trap (the pack's mistakenFor: Estrich). The vocabulary page's 'guessable'
now delegates to it. levels.ts gives every generated item a level (1 like
German, 2 by a rule, 3 different) on source.level, server-side: 400 / 593 /
1964 of 2957.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): skills and levels tracked; sittings move up a level as it holds

- kinds/meta.ts: what each kind tests (understand, words, sounds, forms,
  articles, produce) and its rung, in one Record typed against the kinds;
  the ladder's private list of kind names is gone.
- the learner model gains skills and levels axes (old records load); its
  axes are one MODEL_AXES list that observing, decoding and device sums read.
- frontierOf: level 1 until it holds (>=12 answers, <=20% missed), then 2,
  then 3; stretch ranks after schedule, pressure and ladder. Skills and
  levels report; they do not add pressure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): 'Was sitzt' — answers by skill and by distance from German

Right/missed counts per skill and per level, 'holds' on the same bar as the
level frontier, and the level the learner is working at. Counts, not a
score. Seven languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(listening): dialect podcasts get a labelled German rendering and questions

Measured 2026-11-09: no product or public model writes spoken Zurich German
in dialect spelling reliably (best ~46% words right); Whisper renders it into
Standard German at ~23% WER, mostly rewordings. So a dialect episode with no
publisher transcript is no longer refused: the opening minutes are rendered
by the existing recogniser and stored as transcript.source 'rendering',
labelled on every screen as German 'sinngemäss — nicht der Dialekt, wie er
klingt' (lang=de); questions are asked about content only. Nothing reads a
dialect form from it (HEIDI.md updated).

- channels followed by feed/app are matched to the register by name on the
  publisher's domain (lib/channels/spoken.ts), also at request time for
  channels followed before
- migration 0012 re-offers episodes stored as 'none' (UPDATE only)
- question prompt stays variety-neutral (leak test)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(practice): what a walkthrough of every exercise found

Played a sitting end to end in a browser at 390px and fixed what read wrong:

- Self-check cloze said "which word is missing?" with nowhere to answer;
  it now says to answer aloud or in your head, then reveal.
- A word's "Why?" was the same advice for every word. It now follows the
  distance classification: close to German, a named sound rule with the
  pack's example (ruleBehind), or a word to learn.
- Match grids could be solved by shape (four "add an n" verbs) and could
  offer one meaning twice (Hoi/Salü = Hallo). Grids now mix closeness and
  hold at least two words German does not give away; tests pin both.
- A checked sentence build kept tile padding, scattering the words; it is
  now one line with misplaced words marked.
- Writing "nid" now notes the pack's house form "nöd" (preferredForms on
  the display projection; no component imports the full pack).
- The finish recap printed the German answer as the missed dialect word;
  recapOf gives both sides. "1 kommen nochmals" is pluralised in 7 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(account): ask once about progress sync; finish the walkthrough fixes

Signed up and used a new account on two browsers:

- A new account synced nothing and said nothing; the switch lived only in
  settings. The signed-in home asks once (SyncOffer), either answer is
  kept; sync stays off until chosen. turnSyncOn/keepSyncOff are shared with
  the settings switch.
- «Meine Situationen» joins synced progress as the `focus` key, decoded on
  the server like every other key, and adopted on a device only where
  nothing is chosen. Privacy register and sync copy say so in 7 languages.
  Two-device check: device two shows the situations, is not asked again.
- Verification mail no longer says it "finishes" sign-up for an account
  that already works. The OrangeCat one-click sentence shows only where
  the button is (methods.signin).
- Chat footer shows the model's name (modelLabel), not the route id; a
  German reader's gloss is not repeated; chat asks ai-kit for light
  reasoning so the first words come sooner.
- compareWords no longer offers a typed word that matches one pack word
  as another's near miss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): account mail as laid-out HTML through mail-kit 0.3.0

The verify, sign-in-link and reset mails were plain text. They now carry the
fleet's one layout (@bitbaum/mail-kit renderMail): Heidi's red and cow mark,
a heading, one button, the sign-in code to type on another device, a note,
and a footer that says why the mail arrived. Dark mode follows the reader's
client. The plain-text version is unchanged and still sent alongside.
Security mail carries no unsubscribe (footer.unsubscribe: null), by design.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): an opt-in evening reminder that is quiet by construction

One email when questions are due, off until the learner switches it on in
the settings (offered with progress sync on, since the server reads what is
due only from a syncing device).

- lib/mail/reminder-policy.ts decides, and errs toward silence: opted in,
  verified address, not on day one, 18:00 in their own zone, at most every
  other day, five or more due, not if they practised today, and none after
  three in a row went unanswered. Pure, with tests.
- The mail uses the fleet layout (@bitbaum/mail-kit renderMail): count, the
  streak only from two days, one real due line from the pack, one button,
  the reason it came, preferences and unsubscribe. Six languages; worded as
  a good moment, never as loss (HEIDI.md §3), with a test on loss words.
- One-click unsubscribe: List-Unsubscribe + -Post headers (RFC 8058) and a
  footer link to a page with one button (a GET changes nothing, so a link
  scanner cannot unsubscribe anyone). Signed, non-expiring token.
- mail_preferences (migration 0013), /api/mail/preferences,
  /api/mail/unsubscribe, /api/cron/reminders (hourly, CRON_SECRET).
- Privacy register: the preference row and the mail vendor.
- Checked end to end against local Postgres: sends once at 18:00, refuses a
  duplicate hour, refuses the next day, counts an unanswered one, unsubscribes
  from the page and from the one-click POST, rejects forged tokens.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(account): deleting an account deletes the person; 404s lead home

Found by using Heidi as its users do (64-scenario run, then deleting a test
account and counting rows):

- Deleting an account removed the login but left the person's synced
  progress, reminder setting, language, conversations, group memberships,
  follows, push subscriptions and certificates in the database, attached to
  nobody. lib/domain/account/erase.ts now removes them in one transaction
  after the deletion succeeded (a wrong password erases nothing). A group
  they made passes to its longest-standing member; their group messages stay
  for the others, unattributed. erase.test.ts walks the schema and fails when
  a table with a person column is not handled. Verified against Postgres:
  wrong password 400 and nothing erased; right password, every row gone.
- Most unknown URLs (a typo, a removed page, /xx/…) showed Next's bare English
  "404" with no header and no way home, because the root layout lives under
  [locale]. app/global-not-found.tsx answers in the URL's or the browser's
  language and links home (experimental.globalNotFound).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(settings): no reminder switch for accounts that share no address

A person who signs in with Google or GitHub through the shared sign-in shares
no email address with Heidi by design, so a reminder could never reach them,
yet Settings offered the switch and it did nothing. It is not offered now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(dock): the bar never lies on a control, and the page ends clear of it

The Practise / Ask Heidi pill covered Start on /practice at 390px, the
password field on sign-in and the warm-up's Try it at 768px. It now checks
what is under its resting place and slides away while that is a control, at
every width. The footer ends one pill, its offset and the safe-area inset
higher, so the last row of links is never under it.

The lists the feedback widget's button sat on are marked data-fc-avoid,
which the widget honours.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): send as Heidi's own domain once it is verified, and say which sender is in use

Account mail carried the retired FleetCrown name in its From line. A sender
cannot be renamed on faith: mail from a domain the key has not verified is
refused. Heidi now asks the mail service which domains this deployment's key
may send from and uses heidi.orangecat.ch, then orangecat.ch, as soon as one
is verified; until then the shared sender stays. /api/health reports the
From line in use and the domains the key knows.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(legal): the Impressum names the Heidi project, privacy gives each vendor's company and country, and the offer to care homes says where it stops

- Impressum: operated by the Heidi project (bitbaum), with the contact
  address; no person, no postal address, and no promise of one.
- Privacy: each company that answers messages is listed with its legal
  entity and country, linked to the page that states it; no row names a
  company twice.
- Organisations: a paragraph beside the offer says Heidi is for practising,
  not for the bedside, and that no personal or health details belong in it.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs(changelog): keep main's 10 November entries beside this branch's

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs: the recipe for cloning Heidi into a sibling language app, and one source for the product name

docs/clone-a-language-app.md: what is config, what is content and what stays
in packages, in the order the steps happen.

The product name was written in five places; the share card, the title
template, the landing config, the manifest and the account mail now read
ASSISTANT_NAME, so a clone changes it once.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): the reminder carries the same verified sender as account mail

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 13:15:50 +01:00
CatoandCursor 1bf6bd3c31 feat(practice): questions come back before they are forgotten (#153)
* fix(practice): no two-question tests, no giveaway wrong answers

- A scope offers a test only with TEST_MIN (10) markable questions;
  a test link below that opens practice of the same scope.
- Possession and wo-relative transform questions: wrong answers keep
  the same people and things, so only the dialect form decides.
- Split the whose lesson: possession only; new relative lesson for wo.
- Template docs: the no-giveaway rule.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(practice): questions come back before they are forgotten

- memory.ts: per-question schedule (REVIEW_STEPS 1/3/7/16/35 days),
  miss back to start, first answer per sitting only.
- orderSession seats due questions first (all of them, across kinds),
  then new, then resting.
- Practice and warm-up record; the test does not.
- Due today on /practice, due tomorrow at the end of a sitting.
- Stored as heidi.practice.memory.v1, declared on /privacy, synced
  (newest answer per question wins).

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 12:44:34 -07:00
CatoandClaude Opus 5.5 110f6e5ab3 feat(progress): progress on every device (opt-in), and a certificate per situation (#131)
Sync: signed in, off by default. Each device stores only what it observed; the
server keeps each device's records apart (progress_devices) and pages show the
sum, so nothing is counted twice however often devices sync. Model: sum;
history: union; streak: newest record, best of all; saved words: the newest
list is adopted, so deletions stay deleted. Server-side, every value goes
through the browser's own decoder and is stored normalised. Off removes this
device's copy; 'delete everything synced' removes all.

Certificates: issued by the server from synced progress with the same
strengthOf the situation page uses, only at 'sure'. A public, noindex page per
certificate shows the situation, date and what was measured; no name (one can
be typed for printing and is not stored). The scope line says it is listening
comprehension in one situation, not a language diploma.

Migration 0004 (progress_devices, certificates); both in APP_TABLES. Privacy
flows declared; the practice note now says 'unless you switch sync on'.
Roadmap items move to the changelog.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:53:58 -07:00