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
feat: surface the human's active life-goals read-only on the Character sheet (#2675)
[._.]/ Adam Eivy4c94854cb3f6
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 3f38e7886e..99ce478ccd 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -4,6 +4,8 @@- [issue-2674] **Your Character sheet now has skills that reflect how you actually use PortOS.** Six skills — Wordsmith (universes, Writers Room works, and catalog records), Mentalist (POST), Vitalist (health logging), Strategist (goal discipline), Archivist (Brain/memory), and Auteur (media) — level up from the work you've already done, on a curve where each doubling of use earns a level, so they climb quickly at first and then ask for real commitment. Nothing new is tracked to make this work: each skill reads the stats its domain already keeps, so the skills are accurate from the moment you upgrade rather than starting everyone at zero. A domain you've never touched is honestly level 0, and a domain whose stats can't be read says "Unavailable" rather than pretending it's zero — currently for Wordsmith, Archivist, and Auteur, whose sources report failures; the three file-backed skills can't yet tell an unreadable file from an empty one, which is tracked separately. Skills are computed fresh on every read and never saved or synced between your machines — usage differs per machine, so syncing them would let the laptop you barely open overwrite the desktop you live in.+- [issue-2675] **Your Character sheet now shows the goals you're actually working toward.** A new Life Goals card sits under your metrics and lists your four most urgent active goals with their progress, each linking straight through to Goals. It's a read-only mirror of the goals you already keep — nothing is stored or duplicated on the Character surface, so there's still exactly one place your goals live and one place to change them. Goals are ranked by the same urgency the Goals page uses; if you haven't set a birth date there's no horizon to rank against, so your goals are listed as-is rather than given a made-up order. Completed and abandoned goals drop off, and if you have no active goals the card invites you to set some instead of rendering an empty block. A card that can't reach your goals says so plainly rather than claiming you have none.+- **Creative Director now has its own Model defaults.** The Creative Director index page gets a **Model defaults** button (deep-linkable at `?models=1`) that pins the provider + model every project uses for Treatment, Production plan, and Scene evaluation — the settings that previously existed only as three rows buried in the global AI Assignments table. Individual projects still override them from their own Models drawer, which now says which default it's inheriting; leaving a stage blank at the Creative Director level falls through to the system default provider, exactly as before. Both surfaces are the same drawer, so the two scopes can't drift.- **The Brain daily log now saves itself.** Your entry is saved automatically as you type (about a second and a half after you pause, and at least every ten seconds during a long uninterrupted writing run), when you click away from the editor, when you switch tabs or navigate away, and when you background the tab or app — so a closed laptop or a backgrounded phone no longer loses the day. The toolbar shows the current state (`Unsaved…` / `Saving…` / `Saved`) in place of a toast on every autosave; the Save button and ⌘S still work and still confirm with a toast. Autosave never reverts what you're typing mid-save, never writes one day's text into another when you change dates, keeps debouncing instead of retrying per keystroke when the server is unreachable, and deliberately stands down when a dictated voice segment arrives while you have unsaved edits (the toolbar says "Autosave paused — save to keep your edits") — a full-content save would otherwise drop the segment.diff --git a/PLAN.md b/PLAN.mdindex 90b3df87ed..ee770f16ea 100644--- a/PLAN.md+++ b/PLAN.md@@ -185,6 +185,10 @@ by `/do:replan --issues`:- [ ] **Add a cross-domain `daysActive` metric (distinct days with ANY logged activity).** #2676's issue listed `daysActive` among the example tiles; it shipped the other five plus `goalCompletionRate` and deliberately skipped this one. The blocker is that a truthful "days active" is a UNION of per-day date sets across domains, and no existing getter exposes the raw sets: `server/services/meatspaceLoggingStats.js` builds a `loggedDates` Set internally (line ~85) but only returns aggregates off it (`currentStreak`/`longestStreak`/`weekTotal`/`totalLogged`/`last7Days`), and POST's day keys live in `getPostSessions()`/`getAllTrainingEntries()` records. Summing per-domain counts would double-count any day the user logged in two domains, and a POST-only reading would be misleading enough to be worse than omitting the tile. Fix shape: expose the day-key set (or a `activeDayKeys` array) from `getLoggingStats()` additively, add it to `SIGNAL_READERS` in `server/services/characterSignals.js`, then union it with the POST record days in a new `characterMetrics.js` entry — note the two domains currently derive "today" differently (POST uses `userLocalToday()`; logging stats use the server-local `getDateString()`), so the union needs one day boundary picked deliberately before it means anything. Deferred from #2676 because it's the only tile requiring a change to a shared cross-feature getter plus a day-boundary reconciliation, and the six shipped tiles satisfy the acceptance criteria on their own.+### Character life-goals card follow-ups (#2675)++- [ ] **Give Goals a routed per-goal detail so the Character sheet's goal rows can deep-link to the goal itself.** `client/src/components/character/GoalsCard.jsx` links every row to `/goals/list` (`GOALS_PATH`) rather than to the specific goal, because no routed per-goal detail exists to link to: `App.jsx:256-257` registers only `/goals` → `/goals/tree` and `/goals/:tab`, and `client/src/components/goals/GoalsListView.jsx:193` holds the opened goal in a local `const [selectedGoal, setSelectedGoal] = useState(null)` that feeds `GoalDetailPanel` (:487-490) — so "which goal is open" is invisible to the URL. This violates the repo's ID-based-deep-linking convention on its own terms (the selection is not shareable, bookmarkable, reload-safe, or reachable from ⌘K/voice), independent of the Character sheet. Fix shape: route the selection through the URL (a `:goalId` route param, or at minimum a `?goal=<id>` search param honored by `GoalsListView` on mount, with a not-found fallback for a stale/deleted id and a `navigate()` back to the index on delete/clear), then point `GOALS_PATH`'s per-row link at the id'd route and assert the href in `GoalsCard.test.jsx`. Deferred from #2675 because that slice is scoped to a read-only mirror on the Character surface — converting the goals list's selection model is the goals feature's own change, wants its own tests, and #2677 (the Character reframe) must not be blocked behind it.+### CoS stat-card follow-ups- [ ] **Retire or wire up `StatCard`'s never-passed `activeLabel` prop, and de-dup the two hand-rolled Learning cards.** `activeLabel` (`client/src/components/cos/StatCard.jsx:1`) has **zero callers** across the client — no `activeLabel=` usage and no spread props into `<StatCard>`. It is *visually* rendered only by the default variant (:59-63); the `compact` (:4-22) and `mini` (:24-42) variants honor it only through the `ariaLabel` interpolation at :2 (consumed via `aria-label` at :8 / :28) — i.e. it reaches the accessible name but is never displayed. So it is not fully inert: deleting it changes the accname on two variants. Either delete the prop + its render branch + the `ariaLabel` clause together, or make compact/mini render it. Related: the two Learning cards (`client/src/pages/ChiefOfStaff.jsx` ~512-540 compact, ~836-862 ascii `mini`) are hand-rolled buttons rather than `StatCard`s precisely because StatCard supports neither `onClick` nor a status-driven border color nor a visible sub-label on the compact variant — and each duplicates the same `status === 'critical' ? … : 'warning' ? …` color ternary twice (once for the border, once for the icon). Wiring a visible sub-label slot through all variants plus `onClick`/border-tone props would let both collapse onto StatCard. Deferred from the mobile-overflow fix (which only restructured the compact card's value/label stacking): removing or re-speccing a prop on a shared component used by every CoS stat card is a distinct refactor deserving its own PR + tests, and the overflow fix must not ride on it.diff --git a/client/src/components/character/GoalsCard.jsx b/client/src/components/character/GoalsCard.jsxnew file mode 100644index 0000000000..c82073ab28--- /dev/null+++ b/client/src/components/character/GoalsCard.jsx@@ -0,0 +1,139 @@+import { useState, useEffect } from 'react';+import { Link } from 'react-router-dom';+import { Target, ArrowRight } from 'lucide-react';+import { getGoals } from '../../services/api';+import BrailleSpinner from '../BrailleSpinner';++// The human's real life-goals, surfaced read-only on the Character sheet (#2675) so the sheet+// reflects what the person is actually working toward. Surface, don't duplicate: the goals+// feature at /goals owns every mutation and this card only mirrors the existing service, so+// goal data keeps living in exactly one place.+//+// Like SkillsCard/MetricsCard on the same page this is deliberately a plain read-only card —+// Slice 5 (#2677) owns the page's framing/redesign, so it stays easy to restyle or relocate+// wholesale.++// Goals has no routed per-goal detail today (GoalsListView selects into a local `selectedGoal`+// panel), so every row links to the list rather than inventing a deep link the router cannot+// honor. See PLAN.md — routing that selection through the URL is the goals feature's job.+export const GOALS_PATH = '/goals/list';++const TOP_N = 4;++// `urgency` is null until the user sets a birth date — the horizon math has no denominator+// without one. That is NOT the same as urgency 0 ("plenty of time"), so nulls sort last+// instead of being coerced to a number they don't have: a user with no birth date still gets+// their goals listed in service order rather than a bogus ranking. Ties keep the service's+// order because Array#sort is stable.+const urgencyRank = (urgency) => (Number.isFinite(urgency) ? urgency : -1);++export function selectTopGoals(goals, limit = TOP_N) {+ return goals+ .filter((goal) => goal?.status === 'active')+ .sort((a, b) => urgencyRank(b.urgency) - urgencyRank(a.urgency))+ .slice(0, limit);+}++// A goal that has never been progressed is legitimately 0%; a malformed/absent progress value+// also floors to 0 rather than rendering a NaN-width bar.+export function progressPct(goal) {+ const value = Number(goal?.progress);+ return Number.isFinite(value) ? Math.min(100, Math.max(0, Math.round(value))) : 0;+}++function GoalRow({ goal }) {+ const pct = progressPct(goal);++ return (+ <Link+ to={GOALS_PATH}+ // Named explicitly: the row's own text nodes would otherwise concatenate into a+ // redundant "Example Goal 25%" that never says where the link goes. The bar itself is+ // decorative — the percentage text is its accessible representation, matching how the+ // sheet's existing HP/XP bars are built.+ aria-label={`${goal.title} — ${pct}% complete. Open in Goals`}+ className="block bg-port-bg border border-port-border rounded-lg px-3 py-2 hover:border-port-accent transition-colors"+ >+ <div className="flex items-baseline justify-between gap-2">+ <span className="text-sm text-gray-300 truncate" title={goal.title}>{goal.title}</span>+ <span className="text-xs font-semibold text-port-accent shrink-0">{pct}%</span>+ </div>+ <div className="h-1.5 mt-1.5 bg-port-border rounded-full overflow-hidden" aria-hidden="true">+ <div className="h-full bg-port-accent rounded-full" style={{ width: `${pct}%` }} />+ </div>+ </Link>+ );+}++export default function GoalsCard() {+ // THREE states, never two — mirroring the sentinel discipline the rest of the sheet uses:+ // - loading → we don't know yet+ // - error → we could not read the goals. Must NOT render as "you have no goals".+ // - ready → the real list, INCLUDING a real empty one.+ const [state, setState] = useState({ status: 'loading', goals: [] });++ useEffect(() => {+ let cancelled = false;+ // silent: this card owns its own error UI (the message below), so letting request() toast+ // as well would surface the same failure twice.+ getGoals({ silent: true })+ .then((data) => {+ if (cancelled) return;+ // Array.isArray, not truthiness: a genuinely zero-goal install must reach the empty+ // state, while a malformed payload must reach the error state.+ if (Array.isArray(data?.goals)) setState({ status: 'ready', goals: data.goals });+ else setState({ status: 'error', goals: [] });+ })+ .catch(() => {+ if (!cancelled) setState({ status: 'error', goals: [] });+ });+ return () => { cancelled = true; };+ }, []);++ const top = selectTopGoals(state.goals);++ return (+ <section aria-labelledby="character-goals-heading" className="bg-port-card border border-port-border rounded-xl p-4">+ <div className="flex items-center gap-1.5 mb-3">+ <Target className="w-4 h-4 text-port-accent" />+ <h2 id="character-goals-heading" className="text-sm font-medium text-gray-300">Life Goals</h2>+ <span className="text-xs text-gray-500">— what you're actually working toward</span>+ {state.status === 'ready' && top.length > 0 && (+ <Link to={GOALS_PATH} className="ml-auto text-xs text-port-accent hover:underline shrink-0">+ View all+ </Link>+ )}+ </div>++ {state.status === 'loading' && <BrailleSpinner text="Loading goals" />}++ {state.status === 'error' && (+ <p className="text-sm text-gray-500">+ Your goals could not be loaded right now.{' '}+ <Link to={GOALS_PATH} className="text-port-accent hover:underline">Open Goals</Link>+ </p>+ )}++ {state.status === 'ready' && top.length === 0 && (+ <div className="text-center py-4">+ <p className="text-sm text-gray-400">No active goals yet.</p>+ <p className="text-xs text-gray-500 mt-1">+ Your sheet reflects what you're working toward — set a goal to fill it in.+ </p>+ <Link+ to={GOALS_PATH}+ className="inline-flex items-center gap-1.5 mt-3 px-3 py-1.5 rounded-lg text-sm font-medium bg-port-accent/20 text-port-accent hover:bg-port-accent/30 transition-colors"+ >+ Set your goals <ArrowRight className="w-3.5 h-3.5" />+ </Link>+ </div>+ )}++ {state.status === 'ready' && top.length > 0 && (+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">+ {top.map((goal) => <GoalRow key={goal.id} goal={goal} />)}+ </div>+ )}+ </section>+ );+}diff --git a/client/src/components/character/GoalsCard.test.jsx b/client/src/components/character/GoalsCard.test.jsxnew file mode 100644index 0000000000..842fe13d0a--- /dev/null+++ b/client/src/components/character/GoalsCard.test.jsx@@ -0,0 +1,195 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { render, screen, waitFor, within } from '@testing-library/react';+import { MemoryRouter } from 'react-router-dom';++// Coverage for the Character sheet's life-goals card (#2675). The load-bearing behavior:+// the card mirrors the goals service read-only, ranks by urgency without inventing a rank+// for goals that don't have one, and keeps "no goals" distinct from "couldn't read goals".+//+// All fixture goals use obviously-fake placeholder titles — never real goal data.++const getGoals = vi.fn();++vi.mock('../../services/api', () => ({+ getGoals: (...a) => getGoals(...a),+}));++import GoalsCard, { selectTopGoals, progressPct, GOALS_PATH } from './GoalsCard';++const goal = (overrides = {}) => ({+ id: 'goal-1',+ title: 'Example Goal',+ status: 'active',+ progress: 40,+ urgency: 0.5,+ ...overrides,+});++// Scoped to the card's own region: the sheet renders other percentages, and a page-wide+// query would let a broken row pass.+const renderCard = async (goals) => {+ getGoals.mockResolvedValue(goals === undefined ? {} : { goals });+ render(<MemoryRouter><GoalsCard /></MemoryRouter>);+ const region = await screen.findByRole('region', { name: 'Life Goals' });+ await waitFor(() => expect(within(region).queryByText(/Loading goals/)).not.toBeInTheDocument());+ return within(region);+};++beforeEach(() => {+ vi.clearAllMocks();+});++describe('selectTopGoals', () => {+ it('ranks most-urgent first', () => {+ const picked = selectTopGoals([+ goal({ id: 'a', urgency: 0.1 }),+ goal({ id: 'b', urgency: 0.9 }),+ goal({ id: 'c', urgency: 0.5 }),+ ]);+ expect(picked.map(g => g.id)).toEqual(['b', 'c', 'a']);+ });++ it('drops goals that are not active', () => {+ const picked = selectTopGoals([+ goal({ id: 'a' }),+ goal({ id: 'b', status: 'completed' }),+ goal({ id: 'c', status: 'abandoned' }),+ ]);+ expect(picked.map(g => g.id)).toEqual(['a']);+ });++ it('sorts un-ranked goals last rather than treating null urgency as 0', () => {+ // urgency is null until a birth date is set — that is "we don't know", not "plenty of+ // time". A null must never outrank a real 0.+ const picked = selectTopGoals([+ goal({ id: 'unranked', urgency: null }),+ goal({ id: 'relaxed', urgency: 0 }),+ ]);+ expect(picked.map(g => g.id)).toEqual(['relaxed', 'unranked']);+ });++ it('still lists goals in service order when NO goal has an urgency', () => {+ // The common no-birth-date install: an unranked list beats a bogus ranking, and beats+ // showing nothing at all.+ const picked = selectTopGoals([+ goal({ id: 'a', urgency: null }),+ goal({ id: 'b', urgency: null }),+ ]);+ expect(picked.map(g => g.id)).toEqual(['a', 'b']);+ });++ it('caps the list at the top N', () => {+ const picked = selectTopGoals(Array.from({ length: 9 }, (_, i) => goal({ id: `g${i}` })));+ expect(picked).toHaveLength(4);+ });++ it('does not mutate the caller’s array', () => {+ const goals = [goal({ id: 'a', urgency: 0.1 }), goal({ id: 'b', urgency: 0.9 })];+ selectTopGoals(goals);+ expect(goals.map(g => g.id)).toEqual(['a', 'b']);+ });+});++describe('progressPct', () => {+ it('rounds a real value and keeps a real 0', () => {+ expect(progressPct({ progress: 40.4 })).toBe(40);+ expect(progressPct({ progress: 0 })).toBe(0);+ });++ it('clamps out-of-range values instead of rendering an impossible bar', () => {+ expect(progressPct({ progress: 140 })).toBe(100);+ expect(progressPct({ progress: -5 })).toBe(0);+ });++ it('floors a missing or malformed progress to 0 rather than NaN', () => {+ expect(progressPct({})).toBe(0);+ expect(progressPct({ progress: 'abc' })).toBe(0);+ });+});++describe('GoalsCard — populated', () => {+ it('renders each active goal with its title, progress and a link to Goals', async () => {+ const card = await renderCard([+ goal({ id: 'a', title: 'Ship Example Project', progress: 25, urgency: 0.9 }),+ goal({ id: 'b', title: 'Learn Example Skill', progress: 60, urgency: 0.2 }),+ ]);++ expect(card.getByText('Ship Example Project')).toBeInTheDocument();+ expect(card.getByText('25%')).toBeInTheDocument();+ expect(card.getByText('Learn Example Skill')).toBeInTheDocument();+ expect(card.getByText('60%')).toBeInTheDocument();++ for (const link of card.getAllByRole('link')) {+ expect(link).toHaveAttribute('href', GOALS_PATH);+ }+ });++ it('orders the rendered rows most-urgent first', async () => {+ const card = await renderCard([+ goal({ id: 'a', title: 'Least Urgent Example', urgency: 0.1 }),+ goal({ id: 'b', title: 'Most Urgent Example', urgency: 0.9 }),+ ]);++ const rows = card.getAllByRole('link', { name: /Open in Goals/ });+ expect(rows.map(row => row.getAttribute('aria-label'))).toEqual([+ 'Most Urgent Example — 40% complete. Open in Goals',+ 'Least Urgent Example — 40% complete. Open in Goals',+ ]);+ });++ it('names each row for assistive tech with its goal, progress and destination', async () => {+ // The bar is decorative, so the row's name is the only place progress reaches a screen+ // reader as part of the link.+ const card = await renderCard([goal({ title: 'Example Goal', progress: 25 })]);+ expect(card.getByRole('link', { name: 'Example Goal — 25% complete. Open in Goals' }))+ .toBeInTheDocument();+ });++ it('reads goals from the service without ever writing them back', async () => {+ await renderCard([goal()]);+ // Surface, don't duplicate: a read-only mirror calls the read endpoint exactly once and+ // owns no write path at all.+ expect(getGoals).toHaveBeenCalledTimes(1);+ // silent — the card renders its own error message, so request() must not toast it too.+ expect(getGoals).toHaveBeenCalledWith({ silent: true });+ });+});++describe('GoalsCard — empty', () => {+ it('prompts the user to set goals and links to Goals when none exist', async () => {+ const card = await renderCard([]);++ expect(card.getByText('No active goals yet.')).toBeInTheDocument();+ expect(card.getByRole('link', { name: /Set your goals/ })).toHaveAttribute('href', GOALS_PATH);+ // A real empty state, not a broken/blank block.+ expect(card.queryByRole('link', { name: /Open in Goals/ })).not.toBeInTheDocument();+ });++ it('shows the empty state when every goal is completed or abandoned', async () => {+ // Goals exist, but none are active — the card is about what you're working toward now.+ const card = await renderCard([+ goal({ id: 'a', status: 'completed' }),+ goal({ id: 'b', status: 'abandoned' }),+ ]);+ expect(card.getByText('No active goals yet.')).toBeInTheDocument();+ });+});++describe('GoalsCard — error', () => {+ it('says the goals could not be loaded rather than claiming there are none', async () => {+ // The sentinel rule: "we could not read this" must not read as "you have never done this".+ getGoals.mockRejectedValue(new Error('network'));+ render(<MemoryRouter><GoalsCard /></MemoryRouter>);++ const card = within(await screen.findByRole('region', { name: 'Life Goals' }));+ await waitFor(() => expect(card.getByText(/could not be loaded/)).toBeInTheDocument());+ expect(card.queryByText('No active goals yet.')).not.toBeInTheDocument();+ expect(card.getByRole('link', { name: 'Open Goals' })).toHaveAttribute('href', GOALS_PATH);+ });++ it('treats a malformed payload as an error, not as an empty goal list', async () => {+ const card = await renderCard(undefined);+ expect(card.getByText(/could not be loaded/)).toBeInTheDocument();+ expect(card.queryByText('No active goals yet.')).not.toBeInTheDocument();+ });+});diff --git a/client/src/pages/CharacterSheet.a11y.test.jsx b/client/src/pages/CharacterSheet.a11y.test.jsxindex 6d813281c7..54f14aa22e 100644--- a/client/src/pages/CharacterSheet.a11y.test.jsx+++ b/client/src/pages/CharacterSheet.a11y.test.jsx@@ -13,6 +13,9 @@ const put = vi.fn();vi.mock('../services/api', () => ({default: { get: (...a) => get(...a), post: vi.fn(), put: (...a) => put(...a) },generateAvatar: vi.fn(() => Promise.resolve({})),+ // The sheet's GoalsCard fetches goals itself (#2675); stubbed empty so this suite stays+ // scoped to the name-edit control.+ getGoals: vi.fn(() => Promise.resolve({ goals: [] })),}));vi.mock('../services/socket', () => ({diff --git a/client/src/pages/CharacterSheet.jsx b/client/src/pages/CharacterSheet.jsxindex 9f0a04c3dd..16f7499741 100644--- a/client/src/pages/CharacterSheet.jsx+++ b/client/src/pages/CharacterSheet.jsx@@ -4,6 +4,7 @@ import {Sparkles, RefreshCw, Dices, X, ChevronDown, Zap, Image, Activity} from 'lucide-react';import BrailleSpinner from '../components/BrailleSpinner';+import GoalsCard from '../components/character/GoalsCard';import toast from '../components/ui/Toast';import { timeAgo, formatCompactCount } from '../utils/formatters';import api, { generateAvatar } from '../services/api';@@ -571,6 +572,11 @@ export default function CharacterSheet() {above the fold. */}<MetricsCard metrics={char.metrics} />+ {/* Life Goals — the human's real goals, mirrored read-only from the goals service+ (#2675). Owns its own fetch (the goals API is a separate surface from /character),+ so it is rendered unconditionally and handles its own loading/empty/error states. */}+ <GoalsCard />+{/* Skills — derived per-domain from real PortOS usage (#2674) */}<SkillsCard skills={char.skills} />diff --git a/client/src/pages/CharacterSheet.metrics.test.jsx b/client/src/pages/CharacterSheet.metrics.test.jsxindex 598d89ebe2..b812088c79 100644--- a/client/src/pages/CharacterSheet.metrics.test.jsx+++ b/client/src/pages/CharacterSheet.metrics.test.jsx@@ -12,6 +12,9 @@ const get = vi.fn();vi.mock('../services/api', () => ({default: { get: (...a) => get(...a), post: vi.fn(), put: vi.fn() },generateAvatar: vi.fn(() => Promise.resolve({})),+ // The sheet's GoalsCard fetches goals itself (#2675); stubbed empty so this suite stays+ // scoped to the metrics grid. GoalsCard's own states are covered in CharacterSheet.goals.test.jsx.+ getGoals: vi.fn(() => Promise.resolve({ goals: [] })),}));vi.mock('../services/socket', () => ({