fix(routines): test the copy, name what Yes agrees to, and true up the docs

Make it mine's copying was inline in App and untested; it is now a pure
function with a test, so a change to either store can't make the copy
silently arrive empty. The question's buttons now say what they answer
when heard out of context. The prefs block and the spec now match what
shipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-13 14:19:16 +02:00
1 parent f7ba86e6e5
commit 1c7df637a4
7 files changed
+65 -10

No files matched your search

+10 -5
View File
@@ -35,7 +35,13 @@ import { clockFor, formatRemaining } from "../shared/time.ts";
import { dailySummary, isDaily, resolveDaily } from "../shared/daily.ts";
import { goalStatus, readGoal, type GoalStatus } from "../shared/goal.ts";
import { taskStatus, type TaskShape } from "../shared/task.ts";
import { activeRoutines, mineFrom, routineToAsk, type Routine } from "../shared/routines.ts";
import {
activeRoutines,
copyRoutineState,
mineFrom,
routineToAsk,
type Routine,
} from "../shared/routines.ts";
import { strandedOccurrences } from "../shared/recurrence.ts";
import { orderGames } from "./state/gameOrder.ts";
import { GameMetaProvider, type MetaResolver } from "./state/gameMeta.tsx";
@@ -212,10 +218,9 @@ export function App() {
const makeItMine = (routine: Routine) => {
if (tasks.tasks.some((t) => t.from === routine.id)) return;
const id = tasks.addTask(mineFrom(routine));
const log = daily.logs[routine.id];
if (log !== undefined) daily.merge({ [id]: log });
const numbers = amounts.amounts[routine.id];
if (numbers !== undefined) amounts.merge({ [id]: numbers });
const copy = copyRoutineState(daily.logs, amounts.amounts, routine.id, id);
daily.merge(copy.daily);
amounts.merge(copy.amounts);
};
const taskStatusOf = (task: TaskShape): GoalStatus =>