14 Commits
Author SHA1 Message Date
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 ed752092d5 copy(de): the German interface says du (#346)
Owner decision: the form of address is "du" everywhere. The German
dictionary, the account and reminder mails, the organisations and
contribute pages, the roadmap lines and the German essay now address the
reader as "du"; the chat prompt asks for the familiar form and keeps the
register of what it writes for the learner to send.

Course content that teaches the polite form is unchanged. The whitepaper,
the changelog and the other interface languages are not part of this
change.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 11:10:30 +01:00
Cato c6581b52e4 fix(mail): the sender is asked for before every mail, and replies go to an address that receives (#297)
The first mail of each server process went out from the fleet's shared
sender: the From line was read from a cache nothing had filled yet, while
/api/health, which fills it, reported Heidi's own domain. Every mail now
awaits that answer first, and one sender is shared by all route bundles.

Reply-To was hello@ on Heidi's host, which has no MX record. It is now the
contact address from config, or MAIL_ADDRESS when set.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD
2026-11-11 17:31:20 +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
Cato 00cdb3bb99 fix(mail): send as Heidi's own domain once it is verified, and say which sender is in use (#290)
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
2026-11-10 13:02:09 +01:00
CatoandClaude 8db4a144d4 chore(deps): chatkit 0.22, accountkit 0.17, ai-kit 1.22 — the address is checked after sign-in (#260)
The fleet bump #259 was red on one test: accountkit 0.17 made confirming
the email address something asked for AFTER sign-in by default
(emailConfirmation "after-sign-in"); "before-sign-in" is now an opt-in.
Heidi does not opt in: the fleet rule is that a gate records and never
blocks, so a new account is usable at once and the address is confirmed
afterwards. Nothing else in Heidi read verifyEmail; no copy promised the
old gate.

The test now pins both: the default asks after sign-in, and a product that
opts in still gets the gate.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 11:00:12 +01:00
CatoandClaude 1517340bfd feat(auth): prove email recovery in both mail states (#252)
Heidi already had AccountKit's shared mailer wired, but nothing held what
it should do, and the env that turns it on was undocumented, so it never
got set and live sign-in offers no way back from a forgotten password.

- lib/auth/mail.ts: Heidi's account mailer (createAuthMailer over
  @bitbaum/mail-kit) as one factory, so tests exercise the real adapter.
- lib/auth/recovery.test.ts: with no mail env (or a placeholder key, or a
  sandbox sender) no reset, link or address check is offered and a reset
  request sends nothing; with it, a reset email goes to Heidi's origin and
  its link sets a new password once.
- scripts/audit/account-recovery.mjs, run by the shared account journey:
  in a real browser, "Forgot your password?" and the sign-in link are shown
  in de, fr and ru at 320 and 390px and the forgot form ends in its notice;
  the same build started without mail env shows neither.
- .env.example: BETTER_AUTH_SECRET, RESEND_API_KEY, RESEND_FROM.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 18:12:25 +01:00
Cato d353aa3b9f fix(auth): wire shared mail and password recovery (#213)
* fix(auth): wire shared mail and password recovery

* fix(auth): use released all-method second-factor protection
2026-10-26 05:34:51 +01:00
CatoandClaude Opus 5.5 2093dd401a feat(accounts): Heidi has its own accounts; OrangeCat is one way in, not the only one (#191)
* wip(accounts): Heidi on @bitbaum/accountkit/auth (accountkit pin pending)

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

* feat(accounts): Heidi has its own accounts; OrangeCat is one way in, not the only one

Email and password, passkeys and two-step codes from @bitbaum/accountkit/auth,
with the shared screens in Heidi's seven languages. People whose first way in
was OrangeCat keep their actor id, so no row moves. next-auth removed; the
session secret falls back to the existing AUTH_SECRET.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-15 10:08:54 -07:00
CatoandClaude Opus 5.5 45eb13c251 refactor(auth): sign in with OrangeCat through @bitbaum/accountkit; Try again restarts sign-in (#169)
lib/auth/oc-session.ts and provider.ts were the reference copies; they now
live once in @bitbaum/accountkit/orangecat (v0.2.0) with their contract
tests, and every app signs in through the same file. Behaviour is the same:
client_secret_post, PKCE, identity scopes, refresh in jwt(), invalid_grant
ends the session. The profile no longer carries email (Heidi never read it).

The error page is accountkit's SignInError. Its "Try again" starts the
sign-in again; it used to go to the home page.

ADVERTISED_TEST_FILES 129 -> 127: the two auth test files moved with the code.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:12:29 -07:00
CatoandClaude 3eb4f9cace fix(auth): a Heidi session ends when OrangeCat takes the access back (#145)
Heidi's session is a JWT in a cookie; nothing on the server remembers it,
so it outlived anything OrangeCat did: a learner who clicked Disconnect on
OrangeCat's Connected apps page, or Sign out everywhere, stayed signed in
to Heidi until the cookie expired weeks later. Solon showed exactly this on
production 2026-09-29 (bitbaum/solon#203 is the same fix there).

The JWT now carries the OAuth refresh token and the access token's expiry.
While the access token is valid the session is trusted as is (OrangeCat's
documented bound: one hour). Once it expires Heidi refreshes against
OrangeCat's token endpoint; invalid_grant — the one answer that means the
access was taken back — ends the session by dropping the actor id every
page keys on. Any other failure keeps the session and retries a minute
later, so an OrangeCat outage does not sign everyone out of Heidi.

lib/auth/oc-session.ts is pure and tested with node --test; index.ts only
wires it in. The issuer now has one producer, orangecatIssuer().


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 01:58:31 -07:00
CatoandClaude Fable 5.1 845ae0e87b chore: rename FleetCrown to Loki (#35)
The product was renamed on 2026-09-14: bitbaum/loki, loki.orangecat.ch,
LOKI_* env keys, loki-* units. This repo referenced the old name in
9 files changed, 12 insertions(+), 12 deletions(-).
Email addresses at the old sending domain stay until the new domain is
verified in Resend.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:27:20 -07:00
CatoandClaude Opus 5 6d61a7f78b feat(design): the cow — monochrome, grouped nav, settings, Züritüütsch (#18)
Four things, after actually looking at the site rather than at the code.

THE COW

A Swiss dairy cow is black and white and nothing else, and that is now
the whole palette. It suits the subject — a dialect atlas is printed
matter, not a dashboard — and it suits Swiss design, which has been
grotesque type on white since Müller-Brockmann.

It also solves dark mode properly instead of approximately. Most
palettes need a second set of hand-picked colours that drift until one
is wrong; here dark mode is the SAME two values swapping roles. A cow
is still a cow at night.

One colour survives: Swiss red, and only for the isogloss — the line an
atlas draws where one form stops and another begins. It marks the thing
being taught and the thing needing attention, and nothing else.

NOT A SINGLE PICTURE, WHICH WAS TRUE

The obvious fix — a stock photo of the Limmat, someone smiling at a
phone — is decoration bolted onto a page that still says nothing. These
are figures OF the subject, and both are GENERATED FROM THE PACK:

- DialectFigure draws the family as cow patches: the variety we teach
  filled, the ones we name but do not cover outlined and dashed, the
  isogloss cutting across. Deliberately not a map of Switzerland — a
  recognisable silhouette would be a cartographic claim these shapes
  cannot honour.
- CorrespondenceFigure marks the letters that MOVE. The old grid said
  Kind → Chind in small mono and left the learner to find the
  difference, which is the one thing they needed shown.

A Lesya deployment gets its own figures without anyone opening either
file. The illustration obeys the same SSOT rule as the strings.

NAVIGATION HAS SHAPE

It was five peers in a row and a reader had to already know the product
to tell a tool from an essay. Now: what you DO, why it works this way,
who is doing it. Clusters with a rule between them on a wide screen,
headed sections on a phone — enough structure for six links and less
machinery than a dropdown.

SETTINGS, WHICH DID NOT EXIST

Language lived only in the header switcher, the model only behind the
paperclip, the account only on the portal, and what is stored on the
device nowhere at all. Anyone who wanted better answers rather than
picture-reading had no path to a key at all. One page now, reachable
without an account — because language and the model key are device
settings, not account settings.

ZÜRITÜÜTSCH

A seventh locale, and the one that closes the loop: everywhere else the
UI language and the taught variety are separate axes on purpose, and
here they touch. A learner far enough along can switch the product into
the thing they came for.

It also puts us under our own rule. Every Swiss German string faces the
same deterministic gate that judges the model — no nid, no güet, no
gäu, no öu, no ß. A test runs the whole dictionary through check(), so
our own copy is held to the standard we sell. It passed first run.

VERSIONS

typescript 5 → 6 and @types/node 22 → 26, matching the fleet's blessed
majors. eslint 10 is blessed but NOT adoptable: eslint-config-next
16.2.4 pulls eslint-plugin-react 7.37.5, which throws
"contextOrFilename.getFilename is not a function" under eslint 10.
Reverted to 9 and reported rather than pinned silently.

155 tests.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 10:05:22 -07:00
CatoandClaude Opus 5 304dcde052 feat(auth): sign in with OrangeCat — Heidi keeps no users table (#11)
Heidi's portal needs learners, tutors who can be paid, and study
groups. That is identity, economy and public presence — every one of
which OrangeCat already owns and already serves to two other
consumers (FleetCrown since 2026-07, Solon since).

So Heidi federates instead of building its own. No users table, no
password, no reset flow, no session table: the JWT carries the
OrangeCat actor id and nothing else is stored here. A users table you
do not have is a users table that cannot leak.

This is the identity-bridge instruction applied to a second app —
"Do NOT build profiles, walls, or messaging inside FleetCrown" —
because rebuilding a user table, a payments rail and a profile
directory inside Heidi would be that same mistake in a different repo.

WHAT LANDED

- lib/auth/provider.ts — the OIDC provider, deliberately free of any
  next-auth import so its two load-bearing quirks are asserted by
  node:test rather than remembered. Both were paid for once already by
  FleetCrown: OrangeCat's token endpoint accepts ONLY
  client_secret_post (Auth.js defaults to basic, which OC rejects with
  a 400 reading "client_id is required" — pointing at the wrong
  problem), and PKCE is required even for a confidential client.
- lib/auth/index.ts — NextAuth wiring, JWT strategy, no adapter.
- Account control in the header, portal page, auth error page, all six
  languages. Server actions, so signing in and out need no client JS —
  which matters for the one control that has to work on a tram.
- The portal is noindex, and ROUTES gained `indexed` so the sitemap
  cannot advertise a page whose own robots meta forbids it.

next-auth is pinned EXACTLY, not with a caret. A caret on a prerelease
is why kivvi sits on beta.16 while the rest of the fleet is on
beta.32 — the range silently spans betas.

The provider is env-gated: with no client pair configured the control
renders nothing rather than a button that dead-ends at the code
exchange. A half-configured provider that looks present is worse than
an absent one.

OPERATIONAL

Client registered in OrangeCat (bitbaum/orangecat#977) with identity
scopes only. AUTH_URL is pinned in the box env — without it next-auth
builds callbacks against the internal origin behind Caddy and ships
localhost URLs to users, which is the exact class the fleet's
nextauth-origin-audit.mjs exists to catch after one app shipped it
twice.


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

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