mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 08:57:34 +01:00
* Owner check: why the owner pages do not open, for the person asking The owner was named on the server and still got 404 on the numbers, with nothing to tell a missing sign-in from an unconfirmed address from a different address. /api/owner/check answers that about the caller only, and never says who the owner is. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * Exercises: a review comes back in another form Simulated over twelve daily sittings, a learner who got everything right met 52 different questions in 96: half of every sitting was the identical question on its review day. What is due is the subject, so where the scope has a never-answered question about the same subject in a different form, that one takes the review's seat (Plan.reviewOf) and its answer moves the card that was due (recordAnswer, siblings), so a subject keeps one schedule. New questions also prefer subjects not met yet. After: 83 different questions in 96; with half the answers wrong, 48 subjects instead of 30. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * Situations: ask the word that matters, near-miss options, claims last Reported from a phone on 2026-11-28 as useless: a heard line asked as a whole is read off its German cognates, with wrong options that are unrelated lines, or as a claim that is the German read back. Now the line is asked through its least German-looking pack word, in its sentence, with the pack's own four meanings (WordAsk; once per run; no cognates), else as three meanings whose wrong ones are near misses (negation out, day moved, number changed; German word tables with the packs), and as a claim only when neither is possible. Recorded against the line's own item, as pickOf is. Also: pagesFor for chat wayfinding, and no second printing of the German after a true claim. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r * Situations: a right answer moves on by itself, as in a sitting Reported from a phone: the situation run waited for «Wiiter» after a right answer while a sitting moved on by itself. The pulse and the beat lived inside Verdict; they are now useAnswered, used by both. Touching the answer holds it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r --------- Co-authored-by: Claude <noreply@anthropic.com>
58 lines
3.0 KiB
TypeScript
58 lines
3.0 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { PACK_ITEMS } from "./published.ts";
|
|
import { orderSession, planSession } from "./session.ts";
|
|
import { NO_MEMORY, scheduleAnswer } from "./memory.ts";
|
|
import { permutation, seeded, shuffled } from "./random.ts";
|
|
|
|
const now = new Date("2026-11-09T10:00:00Z");
|
|
const sitting = (seed?: number, memory = NO_MEMORY) =>
|
|
orderSession({ items: PACK_ITEMS, saved: [], now, memory, ...(seed === undefined ? {} : { random: seeded(seed) }) }).map((i) => i.id);
|
|
|
|
test("a seed is a fixed sitting; no seed is the old fixed sitting", () => {
|
|
assert.deepEqual(sitting(42), sitting(42));
|
|
assert.deepEqual(sitting(), sitting());
|
|
});
|
|
|
|
test("different seeds give a new learner different sittings — questions and kinds", () => {
|
|
const sittings = [1, 2, 3, 4, 5, 6].map((seed) => sitting(seed));
|
|
const distinct = new Set(sittings.map((ids) => ids.join("|")));
|
|
assert.ok(distinct.size >= 5, `only ${distinct.size} distinct sittings of 6`);
|
|
const kinds = new Set(sittings.flatMap((ids) => ids.map((id) => id.split(":")[0])));
|
|
assert.ok(kinds.size >= 10, `only ${kinds.size} kinds across six sittings`);
|
|
});
|
|
|
|
test("chance never overrules the schedule: a question that is due comes first whatever the seed", () => {
|
|
const item = PACK_ITEMS.find((i) => i.kind === "form")!;
|
|
let memory = scheduleAnswer(NO_MEMORY, item, "right", new Date("2026-11-01T10:00:00Z"));
|
|
memory = scheduleAnswer(memory, item, "wrong", new Date("2026-11-07T10:00:00Z"));
|
|
for (const seed of [1, 2, 3, 99]) {
|
|
// Seated as itself or in another form of the same subject (`reviewOf`).
|
|
const plan = planSession({ items: PACK_ITEMS, saved: [], now, memory, random: seeded(seed) });
|
|
assert.ok(plan.due.some((id) => (plan.reviewOf[id] ?? id) === item.id), `seed ${seed}`);
|
|
}
|
|
});
|
|
|
|
test("shuffles are permutations, and do move things", () => {
|
|
const random = seeded(7);
|
|
const order = permutation(4, random);
|
|
assert.deepEqual([...order].sort(), [0, 1, 2, 3]);
|
|
const many = new Set(Array.from({ length: 30 }, () => shuffled([1, 2, 3, 4], random).join("")));
|
|
assert.ok(many.size > 6);
|
|
});
|
|
|
|
test("levels: a new learner starts near German; once level 1 holds, the sitting moves up", async () => {
|
|
const { EMPTY_MODEL, frontierOf } = await import("./model.ts");
|
|
const avg = (model: typeof EMPTY_MODEL) => {
|
|
const ids = new Set(orderSession({ items: PACK_ITEMS, saved: [], now, model, random: seeded(9), size: 8 }).map((i) => i.id));
|
|
const levels = PACK_ITEMS.filter((i) => ids.has(i.id)).map((i) => i.source.level ?? 2);
|
|
return levels.reduce((a, b) => a + b, 0) / levels.length;
|
|
};
|
|
assert.equal(frontierOf(EMPTY_MODEL), 1);
|
|
const held = { ...EMPTY_MODEL, levels: { "1": { asked: 20, missed: 1 }, "2": { asked: 20, missed: 2 } } };
|
|
assert.equal(frontierOf(held), 3);
|
|
assert.ok(avg(held) > avg(EMPTY_MODEL), `level 3 learner ${avg(held)} vs new ${avg(EMPTY_MODEL)}`);
|
|
const shaky = { ...EMPTY_MODEL, levels: { "1": { asked: 20, missed: 9 } } };
|
|
assert.equal(frontierOf(shaky), 1, "missing almost half is not holding");
|
|
});
|