Files
CatoandClaude Opus 5 5e09a7ba5c Learning surfaces: navigable reference, scoped practice, two new exercise kinds, a learner model — and 3× the content (#90)
* feat(practice): scoped sessions, two new exercise kinds, a learner model, and enough material to stop repeating

The complaint was that the questions repeat, the system is not smart, and the
exercise code is one file doing four jobs. All three were true.

REPETITION WAS ARITHMETIC, not scheduling: eight questions a sitting out of
sixty-seven items means meeting the same ones within the week, and no shuffle
fixes that. So: a second situations domain (`everyday` — the shop, the tram,
the stairwell, the telephone, the lunch table), the short words no
correspondence rescues (`grad`, `äbe`, `gäng`, `aalüte`), and paradigms for
`si`, `gah` and `cho` built only from forms the packs already publish, so each
table is a reorganisation rather than a new claim. `gsi` is in it because it
carries every past tense in a variety with no preterite.

  practice items  67 → 136      scenes 6 → 11      lines 60 → 110
  vocabulary      48 → 61       and the pool is no longer 76% one kind

SCOPE is the spine. `/practice?topic=…&scene=…&group=…` filters the existing
pool, so every reference surface now opens a sitting about ITSELF. It works
because `ItemSource` already recorded where each question came from — the
field built to make a wrong answer traceable turned out to make a pool
addressable. A topic scope unions the topic's own examples with the real scene
lines that turn on the same rule.

NAVIGATION. `/grammar` was four screens with every topic expanded; it is now an
index in two bands — the topics a sentence does not survive, and the ones it
survives while you do not — with a page per topic carrying practice, previous
and next, and the scenes where the rule actually occurs. `/vocabulary` gained a
filter over both languages, jump links, a session per group, and the scenes
each word is said in.

TWO NEW KINDS, both objective, neither inventing language. `match` is four
words and four meanings; `gaptext` is a four-line passage from a scene with
three words lifted out and offered back — the word bank is what makes a passage
markable in a variety with no settled spelling. A word-order exercise was
considered and refused: this variety tolerates more than one order.

SMARTER. A learner model in the browser, beside the kept words and for the same
reason: it keeps Heidi from holding a record of what a person cannot
understand. It reorders every sitting so the weak half leads and names the two
or three areas worth going back to. No number is shown anywhere — the diagnosis
points at the material, never at the person. Declared on /privacy and deletable
from /settings, along with the seen-history, which had been undeclared since
the exercises shipped.

ENGINEERING. `lib/domain/practice/kinds/` — one module per kind plus a
registry. Adding `match` had touched five places, one of them a bug shipped in
the same commit as the feature.

Four defects found by the new tests rather than by review:

- two cloze items from one topic could share an id, so answering one marked
  the other asked and one of the two was never served again
- the model's first smoothing let one wrong answer out of one outrank a topic
  missed nine times in twenty
- the pack spelled `Chunnsch` in its showcase and `Chunsch` in a grammar
  example, against its own orthography note
- four places still linked `/grammar#<topic>` after topics became pages,
  including the chat's grammar button — the product's main loop

verify green (797 tests); responsive audit 522 renders, 0 overflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(learn): three new grammar topics, 35 more words, three more scenes — and the renderers become modules

Content, design and engineering, in one pass over the learning surfaces.

CONTENT. Practice items 136 → 195 (67 at the start of this work), scenes
11 → 14, lines 110 → 140, vocabulary 61 → 83, grammar topics 8 → 11.

  - `question-words`, `indefinite-article` and `imperative` — each names
    something the packs had been teaching by example without ever saying it.
    `wänn` heard as German `wenn` turns a question into a condition; the
    article `es` is identical to the pronoun `es`; the polite imperative ends
    `-ed`, not `-en`. Every example is a line the packs already publish.
  - Twenty-two nouns WITH their articles, which took the article drill from 3
    questions to 24. Gender is the error a German reader is least able to
    avoid, because it is carried by a word they never had to learn. Every row
    differs from German in the word too — the vocabulary test refuses a row
    whose halves match, so `Zimmer`, `Tür` and `Bahnhof` are deliberately
    absent. `s Tram` is the sharpest: Germany says `die Straßenbahn`.
  - `restaurant`, `at-work` and `school-parents`. The last aims at PARENTS,
    because kindergarten in the canton of Zurich is conducted in dialect — the
    electorate decided that in 2011 — so the people who cannot follow it are
    the adults.

ENGINEERING. The renderers followed the generators into modules:
`_components/exercises/` is one view per shape plus a registry, and
`practice-session.tsx` went 1123 → 390 lines. A view now owns its whole
question — prompt, controls, keyboard, verdict — which removes the last shared
`item.kind ===` chain. That chain is not a style complaint: its fallthrough was
the self-marked branch, where Enter means "I knew it", so adding `match`
shipped a grid a single keypress answered correctly.

Two registries now meet at the kind id, with a test in both directions, plus
one asserting the session component binds no `keydown` at all — the structural
form of "no shared handler to fall through".

DESIGN. The matching grid was collapsing to ONE column on a phone, which put
the four dialect words above the four German ones and made a matching exercise
impossible to do — fixed to two columns at every width. And the situations lead
and the grammar "where this comes up" line both described a care SHIFT, which
stopped being true the day `everyday` became the first domain.

verify green (800 tests); build 413 static pages; responsive audit 522 renders,
0 overflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 16:18:06 -07:00

44 lines
2.0 KiB
TypeScript

import { VARIETY } from "../variety/active.ts";
import type { DomainId, SituationPack } from "./pack.ts";
import { CARE } from "./packs/gsw-zh-care.ts";
import { EVERYDAY } from "./packs/gsw-zh-everyday.ts";
/**
* The domain packs this build carries — the situations seam.
*
* `variety/active.ts` says WHICH LANGUAGE this deployment teaches and there is
* exactly one. This says WHICH SITUATIONS it has lines for, and there may be
* several: one Heidi serves a care assistant, a relocating doctor and somebody
* who just moved into a shared flat, and they are not three deployments.
*
* THE FILTER IS THE POINT. A pack declares the variety it is written in, and
* only packs matching the taught variety are served. Without it, a Lesya build
* that inherited this folder would offer a Ukrainian learner ten sentences of
* Zurich German under a heading saying "at work" — fluent, plausible, and in
* the wrong language, which is §2's failure mode with the packaging changed.
*
* The filter runs at module load rather than at each call, so the cost is paid
* once and the answer cannot differ between two callers.
*/
/**
* `EVERYDAY` first, and the order is what the index page renders in.
*
* Most people who open this product are not carers. They are in a shop, on a
* tram, in a stairwell — and putting an occupational pack above the one that
* applies to everybody would make the section look like it was built for
* somebody else.
*/
const ALL: readonly SituationPack[] = [EVERYDAY, CARE];
export const SITUATIONS: readonly SituationPack[] = ALL.filter((pack) => pack.variety === VARIETY.tag);
/** A domain by id, or undefined — the shape a route needs for its 404. */
export function domain(id: DomainId): SituationPack | undefined {
return SITUATIONS.find((pack) => pack.id === id);
}
/** One situation, by domain and id. Undefined when either half is unknown. */
export function situation(domainId: DomainId, situationId: string) {
return domain(domainId)?.situations.find((s) => s.id === situationId);
}