Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix([issue-3252]): address review (claude): gate memory recs on the topic, not on one drill type
[._.]/ Adam Eivyc69a8414b46b
diff --git a/client/src/components/meatspace/post/PostSessionLauncher.jsx b/client/src/components/meatspace/post/PostSessionLauncher.jsxindex 3979c77038..866610e28e 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.jsx@@ -152,8 +152,17 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta// and is never gated.const topicAllowed = (type) => isTopicEnabled(config, resolveTopicForDrillType(type)?.id);- const enabledMathDrills = Object.entries(config.mentalMath?.drillTypes || {})- .filter(([type, cfg]) => cfg.enabled && topicAllowed(type));+ // Maintenance review reps are drills too, so they get the same topic gate —+ // otherwise switching Cognitive off still mixed an n-back rep into a Quick+ // session (and the launcher still advertised it below).+ const allowedReviewReps = reviewReps.filter(rep => topicAllowed(rep.type));++ // Math honors its module-level `enabled` flag like the llmDrills/cognitive+ // branches below — it used to ignore it, so a `mentalMath.enabled: false`+ // config still composed every math drill.+ const enabledMathDrills = config.mentalMath?.enabled !== false+ ? Object.entries(config.mentalMath?.drillTypes || {}).filter(([type, cfg]) => cfg.enabled && topicAllowed(type))+ : [];const enabledLlmDrills = config.llmDrills?.enabled !== false? Object.entries(config.llmDrills?.drillTypes || {}).filter(([type, cfg]) => cfg.enabled !== false && topicAllowed(type))@@ -329,7 +338,7 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta// Mix in up to 2 maintenance reps for mastered-but-inactive skills that are// due for re-verification (issue #2096). Each carries the review markers so// the server re-verifies the specific rung and records the pass/fail.- for (const rep of reviewReps.slice(0, 2)) {+ for (const rep of allowedReviewReps.slice(0, 2)) {drillConfigs.push({type: rep.type,domain: DRILL_TO_DOMAIN[rep.type],@@ -406,10 +415,10 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta// runnable rep, so do nothing rather than start an unrelated session.async function startReviewRep(rec) {const skillId = rec.id.replace(/^skill-review:/, '');- let rep = reviewReps.find(r => r.skillId === skillId);+ let rep = allowedReviewReps.find(r => r.skillId === skillId);if (!rep) {const fresh = await getPostReviewReps(5).then(r => r?.reps || []).catch(() => []);- rep = fresh.find(r => r.skillId === skillId);+ rep = fresh.filter(r => topicAllowed(r.type)).find(r => r.skillId === skillId);}if (!rep) return;const drillConfig = {@@ -844,12 +853,12 @@ export default function PostSessionLauncher({ config, recentSessions, stats, sta{/* Maintenance-review nudge (issue #2096) — mastered skills due for arefresh, mixed into the next Quick session as labeled review reps. */}- {reviewReps.length > 0 && (+ {allowedReviewReps.length > 0 && (<div className="flex items-start gap-2 px-3 py-2 rounded-lg bg-port-warning/10 border border-port-warning/30 text-sm text-port-warning"><Target size={16} className="mt-0.5 shrink-0" /><span>- {reviewReps.length} skill{reviewReps.length > 1 ? 's' : ''} due for a maintenance rep- {' '}— a Quick session will mix {reviewReps.length > 1 ? 'them' : 'it'} in: {reviewReps.slice(0, 2).map(r => r.label).join(', ')}+ {allowedReviewReps.length} skill{allowedReviewReps.length > 1 ? 's' : ''} due for a maintenance rep+ {' '}— a Quick session will mix {allowedReviewReps.length > 1 ? 'them' : 'it'} in: {allowedReviewReps.slice(0, 2).map(r => r.label).join(', ')}</span></div>)}diff --git a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx b/client/src/components/meatspace/post/PostSessionLauncher.test.jsxindex 1b09057343..1b84f56e09 100644--- a/client/src/components/meatspace/post/PostSessionLauncher.test.jsx+++ b/client/src/components/meatspace/post/PostSessionLauncher.test.jsx@@ -494,3 +494,103 @@ describe('PostSessionLauncher topic gating (issue #3252)', () => {expect(onStart.mock.calls[0][0].map(d => d.domain).sort()).toEqual(['math', 'wordplay']);});});++// Maintenance review reps are drills too. The topic gate has to reach them, or+// switching Cognitive off still mixed an n-back rep into a Quick session (and+// the launcher still advertised it) — contradicting the gate's own promise.+describe('PostSessionLauncher review-rep topic gating (issue #3252)', () => {+ const twoDomainConfig = (topics) => ({+ mentalMath: { enabled: true, drillTypes: { multiplication: { enabled: true, count: 10 } } },+ llmDrills: { enabled: true, drillTypes: { 'pun-wordplay': { enabled: true, count: 5 } } },+ cognitive: { enabled: true, drillTypes: { 'n-back': { enabled: true } } },+ sessionModules: ['mental-math', 'llm-drills', 'cognitive'],+ ...(topics ? { topics } : {}),+ });++ const renderWith = (config, onStart) => render(+ <MemoryRouter>+ <PostSessionLauncher+ config={config}+ recentSessions={[]}+ stats={{ sessionCount: 1, overall: 70, currentStreak: 1, longestStreak: 1, byDrill: {} }}+ statsWeek={{ sessionCount: 1 }}+ onStart={onStart}+ onViewHistory={vi.fn()}+ onViewConfig={vi.fn()}+ onViewMemory={vi.fn()}+ onViewMorse={vi.fn()}+ />+ </MemoryRouter>,+ );++ beforeEach(() => {+ vi.clearAllMocks();+ getPostRecommendations.mockResolvedValue({ recommendations: [] });+ getPostReviewReps.mockResolvedValue({ reps: [+ { skillId: 'n-back:L2', type: 'n-back', label: 'N-Back level 2', config: { n: 2 } },+ ] });+ getMorseProgress.mockResolvedValue({ settings: { wpm: 18, farnsworthWpm: 12 } });+ getPostProgress.mockResolvedValue({ series: { byDay: [] } });+ });++ it('mixes a review rep into a Quick session while its topic is on', async () => {+ const onStart = vi.fn();+ renderWith(twoDomainConfig(null), onStart);+ await waitFor(() => expect(screen.getByText(/due for a maintenance rep/)).toBeTruthy());+ fireEvent.click(await screen.findByRole('button', { name: /Quick 5 Min/ }));++ expect(onStart.mock.calls[0][0].some(d => d.isReview && d.type === 'n-back')).toBe(true);+ });++ it('drops the review rep — and its launcher nudge — when its topic is switched off', async () => {+ const onStart = vi.fn();+ renderWith(twoDomainConfig({ cognitive: { enabled: false } }), onStart);+ await waitFor(() => expect(screen.getByText('Full POST')).toBeTruthy());+ expect(screen.queryByText(/due for a maintenance rep/)).toBeNull();++ fireEvent.click(await screen.findByRole('button', { name: /Quick 5 Min/ }));+ expect(onStart.mock.calls[0][0].some(d => d.isReview)).toBe(false);+ expect(onStart.mock.calls[0][0].some(d => d.type === 'n-back')).toBe(false);+ });+});++// The mirror the Practice Plan preview uses (composedSessionDrillTypes) gates on+// the module-level `enabled` flag; the launcher used to ignore it for math only,+// so a `mentalMath.enabled: false` config previewed as "no Mental Math" while a+// Full POST still ran all five math drills.+describe('PostSessionLauncher honors the mentalMath module flag (issue #3252)', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ getPostRecommendations.mockResolvedValue({ recommendations: [] });+ getPostReviewReps.mockResolvedValue({ reps: [] });+ getMorseProgress.mockResolvedValue({ settings: { wpm: 18, farnsworthWpm: 12 } });+ getPostProgress.mockResolvedValue({ series: { byDay: [] } });+ });++ it('composes no math drills when mentalMath.enabled is false', async () => {+ const onStart = vi.fn();+ render(+ <MemoryRouter>+ <PostSessionLauncher+ config={{+ mentalMath: { enabled: false, drillTypes: { multiplication: { enabled: true, count: 10 } } },+ cognitive: { enabled: true, drillTypes: { 'n-back': { enabled: true } } },+ llmDrills: { enabled: false, drillTypes: {} },+ }}+ recentSessions={[]}+ stats={{ sessionCount: 1, overall: 70, currentStreak: 1, longestStreak: 1, byDrill: {} }}+ statsWeek={{ sessionCount: 1 }}+ onStart={onStart}+ onViewHistory={vi.fn()}+ onViewConfig={vi.fn()}+ onViewMemory={vi.fn()}+ onViewMorse={vi.fn()}+ />+ </MemoryRouter>,+ );+ await waitFor(() => expect(screen.getByText('Full POST')).toBeTruthy());+ fireEvent.click(screen.getByText('Full POST'));++ expect(onStart.mock.calls[0][0].map(d => d.type)).toEqual(['n-back']);+ });+});diff --git a/client/src/components/meatspace/post/PracticePlan.jsx b/client/src/components/meatspace/post/PracticePlan.jsxindex c84c7f8125..20f2ea8f09 100644--- a/client/src/components/meatspace/post/PracticePlan.jsx+++ b/client/src/components/meatspace/post/PracticePlan.jsx@@ -59,7 +59,19 @@ function ToggleRow({ id, label, hint, checked, disabled, onChange, indent = falsexport default function PracticePlan({ config, onSaved, onBack }) {// Draft state seeded once from the loaded config — mirrors PostDrillConfig,// which is why PostTab only mounts this after the config resolves.- const [topics, setTopics] = useState(() => ({ ...(config?.topics || {}) }));+ const [topics, setTopics] = useState(() => {+ const seeded = { ...(config?.topics || {}) };+ // Memory and Morse each have a module-level `enabled` flag AND a topic entry+ // on the server, and this surface exposes ONE control that writes both. Seed+ // the topic entry from the module flag when THAT is the one switched off, or+ // a config carrying `morse: { enabled: false }` with no `topics.morse` would+ // render as ON and the next Save — even one that only touched Wordplay —+ // would silently switch Morse back on.+ for (const id of ['memory', 'morse']) {+ if (config?.[id]?.enabled === false) seeded[id] = { ...seeded[id], enabled: false };+ }+ return seeded;+ });// Seeded with an entry for EVERY drill type the module owns, because the// config schema's enum-keyed drill-type records are exhaustive (zod 4) — a// partial map would 400 on save. A type absent from the saved config isdiff --git a/client/src/components/meatspace/post/PracticePlan.test.jsx b/client/src/components/meatspace/post/PracticePlan.test.jsxindex f80c3d558f..8c1fe4bd57 100644--- a/client/src/components/meatspace/post/PracticePlan.test.jsx+++ b/client/src/components/meatspace/post/PracticePlan.test.jsx@@ -198,3 +198,42 @@ describe('PracticePlan save', () => {expect(toast.success).not.toHaveBeenCalled();});});++// Memory and Morse each have a module-level `enabled` flag on the server as well+// as a topic entry, and this surface exposes ONE control that writes both. If the+// control only read the topic entry, a config carrying the module flag off with no+// topic entry would render ON and the next Save would switch it back on.+describe('PracticePlan two-flags-one-control seeding (issue #3252)', () => {+ it('renders Morse OFF when only the module flag is off', async () => {+ await renderPlan(baseConfig({ morse: { enabled: false } }));+ expect(screen.getByLabelText('Morse', { selector: 'input' })).not.toBeChecked();+ });++ it('renders Memory OFF when only the module flag is off', async () => {+ await renderPlan(baseConfig({ memory: { enabled: false, drillTypes: {} } }));+ expect(screen.getByLabelText('Memory', { selector: 'input' })).not.toBeChecked();+ });++ it('does not silently re-enable a module-flag-off topic on an unrelated save', async () => {+ await renderPlan(baseConfig({ morse: { enabled: false } }));+ // Touch a completely different topic, then save.+ fireEvent.click(screen.getByLabelText('Wordplay', { selector: 'input' }));+ fireEvent.click(screen.getByRole('button', { name: /Save/ }));++ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());+ const [patch] = updatePostConfig.mock.calls[0];+ expect(patch.morse).toEqual({ enabled: false });+ expect(patch.topics.morse).toEqual({ enabled: false });+ });++ it('writes BOTH the topic entry and the module flag so the server gates agree', async () => {+ await renderPlan();+ fireEvent.click(screen.getByLabelText('Memory', { selector: 'input' }));+ fireEvent.click(screen.getByRole('button', { name: /Save/ }));++ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());+ const [patch] = updatePostConfig.mock.calls[0];+ expect(patch.topics.memory).toEqual({ enabled: false });+ expect(patch.memory.enabled).toBe(false);+ });+});diff --git a/client/src/components/meatspace/post/constants.js b/client/src/components/meatspace/post/constants.jsindex 2d748a19fe..3cd16d24fa 100644--- a/client/src/components/meatspace/post/constants.js+++ b/client/src/components/meatspace/post/constants.js@@ -126,14 +126,22 @@ export function isTopicEnabled(config, topicId) {return config?.topics?.[topicId]?.enabled !== false;}+/**+ * MIRRORS the server's `isMemoryPracticeEnabled` — the topic entry plus the+ * module block, with no drill type consulted.+ */+export function isMemoryPracticeEnabled(config) {+ return isTopicEnabled(config, 'memory') && config?.memory?.enabled !== false;+}+/*** MIRRORS the server's `isMemoryItemEnabled` — a per-item opt-out that keeps the* item's mastery/schedule history and its own practice page, and only removes it* from the automatic rotation.*/export function isMemoryItemEnabled(config, itemId) {+ if (!isMemoryPracticeEnabled(config)) return false;if (!itemId) return true;- if (!isTopicEnabled(config, 'memory')) return false;return config?.memory?.items?.[itemId]?.enabled !== false;}diff --git a/server/lib/postTopics.js b/server/lib/postTopics.jsindex f7e291e8f1..49429f3c7a 100644--- a/server/lib/postTopics.js+++ b/server/lib/postTopics.js@@ -129,15 +129,31 @@ export function enabledTopicIds(config) {return TOPIC_IDS.filter(id => isTopicEnabled(config, id));}+/**+ * Whether memory practice participates AT ALL — the topic entry and the module+ * block, WITHOUT consulting any drill type.+ *+ * The drill-type exclusion is load-bearing: a due-memory recommendation links+ * into a practice MODE (`/post/memory/<id>/spaced`, `/post/memory/elements/+ * element-flash`), not into a specific POST drill type. Gating those recs on one+ * arbitrary type would mean switching off e.g. Memory Sequence silently killed+ * the whole spaced-repetition reminder feed, including items whose recs never+ * run that type.+ */+export function isMemoryPracticeEnabled(config) {+ return isTopicEnabled(config, 'memory') && config?.memory?.enabled !== false;+}+/*** Whether an individual memory item participates in recommendations and in* `generateMemoryDrill`'s lowest-mastery candidate pool. Same absent = enabled* convention. A disabled item keeps its full mastery/schedule history and stays* practiceable on demand from its own page — this only scopes the *automatic*- * paths (issue #3252). A null/absent id is never filtered.+ * paths (issue #3252). A null/absent id means "no specific item", which is never+ * filtered on its own — but memory practice still has to be on.*/export function isMemoryItemEnabled(config, itemId) {+ if (!isMemoryPracticeEnabled(config)) return false;if (!itemId) return true;- if (!isTopicEnabled(config, 'memory')) return false;return config?.memory?.items?.[itemId]?.enabled !== false;}diff --git a/server/lib/postTopics.mirror.test.js b/server/lib/postTopics.mirror.test.jsindex 368c8b0c74..ae3c2f6887 100644--- a/server/lib/postTopics.mirror.test.js+++ b/server/lib/postTopics.mirror.test.js@@ -29,7 +29,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));const SERVER_PATH = resolve(__dirname, 'postTopics.js');const CLIENT_PATH = resolve(__dirname, '../../client/src/components/meatspace/post/constants.js');-const MIRRORED_NAMES = ['POST_TOPICS', 'isTopicEnabled', 'isMemoryItemEnabled'];+const MIRRORED_NAMES = ['POST_TOPICS', 'isTopicEnabled', 'isMemoryPracticeEnabled', 'isMemoryItemEnabled'];describe('postTopics server↔client mirror parity', () => {const serverSrc = readFileSync(SERVER_PATH, 'utf8');diff --git a/server/lib/postValidation.test.js b/server/lib/postValidation.test.jsindex 0c34cc923e..4454fac7bc 100644--- a/server/lib/postValidation.test.js+++ b/server/lib/postValidation.test.js@@ -12,7 +12,7 @@ import {POST_MODULES,POST_SUPPORTED_MEMORY_TYPES,} from './postValidation.js';-import { getTopic } from './postTopics.js';+import { getTopic, POST_TOPICS } from './postTopics.js';describe('postConfigUpdateSchema llmDrills', () => {// Regression: the config UI (PostDrillConfig.jsx) exposed only 5 of the 14@@ -556,3 +556,50 @@ describe('postConfigUpdateSchema topics/memory/morse (issue #3252)', () => {expect(parsed.morse).toBeUndefined();});});++// Regression guard for the class of bug where a client suite mocks its API+// wrapper and a `.strict()`/exhaustive-record rejection is therefore invisible:+// PracticePlan.test.jsx asserts its save patch against a MOCKED updatePostConfig,+// so nothing there would catch a body the real schema rejects. This test rebuilds+// that exact wire body from the topic registry and parses it for real — so a+// future topic or drill type that desyncs POST_TOPICS from the schema's enums+// fails here instead of 400-ing every save in production behind two green suites.+describe('Practice Plan save body ↔ postConfigUpdateSchema (issue #3252)', () => {+ // Mirrors PracticePlan.jsx's `modules` seeding + handleSave payload exactly.+ const practicePlanSaveBody = () => {+ const drillTypesFor = (module) => Object.fromEntries(+ POST_TOPICS.filter(t => t.module === module)+ .flatMap(t => t.drillTypes)+ .map(type => [type, { enabled: true }])+ );+ return {+ topics: Object.fromEntries(POST_TOPICS.map(t => [t.id, { enabled: true }])),+ mentalMath: { drillTypes: drillTypesFor('mental-math') },+ llmDrills: { drillTypes: drillTypesFor('llm-drills') },+ cognitive: { drillTypes: drillTypesFor('cognitive') },+ memory: { enabled: true, drillTypes: drillTypesFor('memory'), items: { 'elements-song': { enabled: false } } },+ morse: { enabled: true },+ };+ };++ it('the exact body the Practice Plan sends validates and survives round-trip', () => {+ const body = practicePlanSaveBody();+ const parsed = postConfigUpdateSchema.parse(body);+ expect(parsed).toEqual(body);+ });++ it('every enum-keyed drill-type record the body sends is complete', () => {+ // The sibling module blocks use an EXHAUSTIVE z.record — a missing key is a+ // 400, not a silent strip — so assert the registry supplies every enum member.+ const body = practicePlanSaveBody();+ expect(Object.keys(body.mentalMath.drillTypes).sort()).toEqual([...MATH_DRILL_TYPE_IDS].sort());+ expect(Object.keys(body.llmDrills.drillTypes).sort()).toEqual([...LLM_DRILL_TYPE_IDS].sort());+ expect(Object.keys(body.cognitive.drillTypes).sort()).toEqual([...COGNITIVE_DRILL_TYPE_IDS].sort());+ });++ it('rejects the same body with one drill type dropped, proving the guard bites', () => {+ const body = practicePlanSaveBody();+ delete body.llmDrills.drillTypes['bridge-word'];+ expect(() => postConfigUpdateSchema.parse(body)).toThrow();+ });+});diff --git a/server/services/meatspacePost.js b/server/services/meatspacePost.jsindex ad4eb3a7e5..3c4ee63d5a 100644--- a/server/services/meatspacePost.js+++ b/server/services/meatspacePost.js@@ -1198,13 +1198,24 @@ export async function getPostRecommendations({ limit = RECOMMENDATION_LIMIT } =// still practiceable on demand from its own page; it just stops being// recommended. getDueMemoryItems() itself stays unfiltered — it also backs the// Memory tab's own list.+ //+ // Gated on the topic + module + per-ITEM flags only, never on a drill type:+ // these recs deep-link into a practice MODE (`spaced` / `element-flash`), so+ // probing them with one arbitrary drill type would let switching off a single+ // mode blank the entire spaced-repetition feed.const enabledDueMemoryItems = dueMemoryItems- .filter(item => isRecDrillRunnable(config, 'memory', 'memory-sequence', item.id));-- // Memory chunk re-verifications point at a specific item too, so a disabled- // item shouldn't surface one. Non-memory reviews pass through untouched.- const enabledDueReviews = dueReviews.filter(review => review.kind !== 'memory'- || isRecDrillRunnable(config, 'memory', review.drillType || 'memory-sequence', memoryItemIdFromReview(review)));+ .filter(item => isMemoryItemEnabled(config, item.id));++ // Due re-verifications are config-dependent recommendations like weakest-skill+ // and stalled-progression, so they get the same gate. A memory chunk+ // re-verification points at a specific item (same mode-not-drill-type reasoning+ // as above); a ladder re-verification names its drill, so it routes through+ // isRecDrillRunnable exactly as the stalled rec for that same ladder does.+ const enabledDueReviews = dueReviews.filter((review) => {+ if (review.kind === 'memory') return isMemoryItemEnabled(config, memoryItemIdFromReview(review));+ const module = review.kind === 'multiplication' || review.drillType === 'multiplication' ? 'mental-math' : 'cognitive';+ return isRecDrillRunnable(config, module, review.drillType);+ });// Stalled progressions — Morse runs from its own tab (so it's gated by its own// topic/config block rather than session composition), and any ladder whosediff --git a/server/services/meatspacePostRecommendations.test.js b/server/services/meatspacePostRecommendations.test.jsindex 0ae1721cdb..e1f07fb384 100644--- a/server/services/meatspacePostRecommendations.test.js+++ b/server/services/meatspacePostRecommendations.test.js@@ -253,6 +253,49 @@ describe('getPostRecommendations topic/item filtering (issue #3252)', () => {expect(dueIds).toEqual(expect.arrayContaining(['memory-due:elements-song', 'memory-due:raven']));});+ // Regression: the due-item filter used to probe isRecDrillRunnable with a+ // hardcoded 'memory-sequence', so switching off that ONE practice mode blanked+ // the entire spaced-repetition feed — including items whose recs deep-link to+ // `spaced` / `element-flash` and never run memory-sequence at all.+ it('keeps due items when a single memory DRILL TYPE is switched off', async () => {+ state.memoryItems = [dueItem('elements-song', 'The Elements'), dueItem('raven', 'The Raven')];+ state.config = { memory: { drillTypes: { 'memory-sequence': { enabled: false } } } };++ const { recommendations } = await getPostRecommendations();+ const dueIds = recommendations.filter(r => r.kind === 'memory-due').map(r => r.id);+ expect(dueIds).toEqual(expect.arrayContaining(['memory-due:elements-song', 'memory-due:raven']));+ });++ it('drops every due item when the memory MODULE is switched off', async () => {+ state.memoryItems = [dueItem('elements-song', 'The Elements'), dueItem('raven', 'The Raven')];+ state.config = { memory: { enabled: false } };++ const { recommendations } = await getPostRecommendations();+ expect(recommendations.some(r => r.kind === 'memory-due')).toBe(false);+ });++ // Due re-verifications are config-dependent recs like weakest-skill and+ // stalled-progression, so they get the same gate — they used to pass through+ // ungated, surfacing "Re-verify N-Back" for a topic the user had switched off+ // while the stalled rec for that same ladder was correctly dropped.+ it('drops a ladder re-verification whose topic is switched off', async () => {+ state.reviewSchedule = {+ skills: {+ 'n-back:L2': {+ skillId: 'n-back:L2', kind: 'cognitive', drillType: 'n-back', label: 'N-Back level 2',+ nextReview: new Date(Date.now() - 86400000).toISOString(), status: 'due',+ },+ },+ };+ state.config = {};+ const before = await getPostRecommendations();+ expect(before.recommendations.some(r => r.kind === 'skill-review')).toBe(true);++ state.config = { topics: { cognitive: { enabled: false } } };+ const after = await getPostRecommendations();+ expect(after.recommendations.some(r => r.kind === 'skill-review')).toBe(false);+ });+it('suppresses the morse-copy stalled rec when Morse is switched off', async () => {// Mid-Koch progression: the stalled-progression rec fires for a user who has// engaged with Morse and isn't at the final level.