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: keep training saves out of scored routes (#4441)
Adam Eivy99406d6caeab
diff --git a/client/src/components/meatspace/tabs/PostTab.jsx b/client/src/components/meatspace/tabs/PostTab.jsxindex 5716af49c4..385b69534b 100644--- a/client/src/components/meatspace/tabs/PostTab.jsx+++ b/client/src/components/meatspace/tabs/PostTab.jsx@@ -104,8 +104,7 @@ export default function PostTab({ tab = 'launcher', subtab, mode }) {navigate(`${location.pathname}?${params}`);}- // Save success either continues the daily recommendation chain or opens the- // deep-linkable saved result. The run id === session id.+ // Find and route to the next unpracticed item in the daily routine.async function continueDailyRoutine() {const result = await getPostRecommendations(1).catch(() => null);const recommendation = result?.recommendations?.[0];@@ -126,11 +125,15 @@ export default function PostTab({ tab = 'launcher', subtab, mode }) {navigate(`/post/launcher?continue=${encodeURIComponent(recommendation.id)}`);}+ // Save success either continues the daily recommendation chain or opens a+ // deep-linkable SCORED result. Training runs have durable ids too, but the+ // scored-session detail endpoint deliberately excludes them, so they return+ // to the launcher instead of navigating to a guaranteed not-found route.async function handleSaved(savedSession, { continueDaily = false } = {}) {await loadData();session.reset();if (continueDaily) await continueDailyRoutine();- else if (savedSession?.id) navigate(`/post/session/${savedSession.id}`);+ else if (savedSession?.id && !savedSession.training) navigate(`/post/session/${savedSession.id}`);else navigate('/post/launcher');}diff --git a/client/src/components/meatspace/tabs/PostTab.test.jsx b/client/src/components/meatspace/tabs/PostTab.test.jsxindex bc6aab3b88..33a7cb5761 100644--- a/client/src/components/meatspace/tabs/PostTab.test.jsx+++ b/client/src/components/meatspace/tabs/PostTab.test.jsx@@ -1,4 +1,4 @@-import { describe, it, expect, vi } from 'vitest';+import { afterEach, describe, it, expect, vi } from 'vitest';import { render, screen, fireEvent, act } from '@testing-library/react';import { MemoryRouter, Routes, Route, useLocation } from 'react-router';import PostTab from './PostTab';@@ -44,7 +44,7 @@ vi.mock('../../RapidReader', () => ({ RapidReaderModal: () => null }));// Hoisted so the api mock factory (which vitest lifts above imports) can close// over it — a plain `const` declared below would be in the TDZ at mock time.-const { MEMORY_ITEM, ELEMENTS_ITEM, getPostRecommendations } = vi.hoisted(() => ({+const { MEMORY_ITEM, ELEMENTS_ITEM, getPostRecommendations, POST_SESSION_OVERRIDE } = vi.hoisted(() => ({MEMORY_ITEM: {id: 'raven',title: 'The Raven',@@ -66,10 +66,11 @@ const { MEMORY_ITEM, ELEMENTS_ITEM, getPostRecommendations } = vi.hoisted(() =>mastery: { overallPct: 0, chunks: {}, elements: {} },},getPostRecommendations: vi.fn().mockResolvedValue({ recommendations: [] }),+ POST_SESSION_OVERRIDE: { current: null },}));vi.mock('../../../hooks/usePostSession', () => ({- usePostSession: () => ({+ usePostSession: () => POST_SESSION_OVERRIDE.current || ({state: 'idle',drills: [],currentDrillIndex: 0,@@ -80,6 +81,10 @@ vi.mock('../../../hooks/usePostSession', () => ({}),}));+afterEach(() => {+ POST_SESSION_OVERRIDE.current = null;+});+// Surfaces the live URL so the test can assert mode transitions keep the ?ref// query param — the "mode AND reference view are both deep-linkable" contract.function LocationProbe() {@@ -87,6 +92,36 @@ function LocationProbe() {return <div data-testid="loc">{loc.pathname}{loc.search}</div>;}+describe('PostTab saved-run routing (#4441)', () => {+ it('returns a saved training run to the launcher instead of a scored-session detail', async () => {+ POST_SESSION_OVERRIDE.current = {+ state: 'complete',+ drills: [],+ currentDrillIndex: 0,+ currentDrill: null,+ drillCount: 0,+ drillResults: [],+ sessionScore: 0,+ isTraining: true,+ saveSession: vi.fn().mockResolvedValue({ id: 'training-run', training: true }),+ reset: vi.fn(),+ };+ render(+ <MemoryRouter initialEntries={['/post/session/run']}>+ <Routes>+ <Route path="/post/*" element={<><PostTab tab="session" subtab="run" /><LocationProbe /></>} />+ </Routes>+ </MemoryRouter>,+ );+ await settle();++ await act(async () => { fireEvent.click(screen.getByText('Log Training')); });++ expect(screen.getByTestId('loc').textContent).toBe('/post/launcher');+ expect(POST_SESSION_OVERRIDE.current.reset).toHaveBeenCalledOnce();+ });+});+describe('PostTab morse deep-linking', () => {// A wildcard route keeps the probe mounted after navigation moves the URL to a// different /post/morse* path (PostTab's tab/subtab arrive as props here, so the