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: render the Wiki health report as Markdown with the full body (#13009) (#13030)
[._.]/dae4447bbc56
diff --git a/client/src/components/wiki/tabs/OverviewTab.jsx b/client/src/components/wiki/tabs/OverviewTab.jsxindex 7f27e30da2..96711aad2c 100644--- a/client/src/components/wiki/tabs/OverviewTab.jsx+++ b/client/src/components/wiki/tabs/OverviewTab.jsx@@ -1,9 +1,12 @@-import { useState, useEffect, useMemo } from 'react';+import { useState, useEffect, useMemo, useRef } from 'react';import { Link, useNavigate, useSearchParams } from 'react-router';import * as api from '../../../services/api';import { FolderOpen, RefreshCw, AlertTriangle } from 'lucide-react';import { timeAgo, formatDateTime } from '../../../utils/formatters';import { WIKI_CATEGORIES, PageTypeIcon } from '../constants.jsx';+import MarkdownOutput from '../../cos/MarkdownOutput';++const LINT_REPORT_PATH = 'wiki/lint-report.md';const WIKI_JOB_ID = 'job-wiki-maintenance';@@ -50,8 +53,9 @@ export default function OverviewTab({ vaultId, stats, notes, allNotes, onRefreshconst [searchParams] = useSearchParams();const [lintReport, setLintReport] = useState(null);const [loadingLint, setLoadingLint] = useState(false);+ const [lintError, setLintError] = useState(false);- const lintExists = allNotes?.some(n => n.path === 'wiki/lint-report.md');+ const lintExists = allNotes?.some(n => n.path === LINT_REPORT_PATH);const openNote = (notePath) => {const next = new URLSearchParams(searchParams);@@ -59,16 +63,34 @@ export default function OverviewTab({ vaultId, stats, notes, allNotes, onRefreshnavigate({ pathname: '/wiki/browse', search: next.toString() });};+ // Each load gets a generation; a response from a superseded load (vault switched, Retry, report removed) is dropped.+ const lintRequestRef = useRef(0);+useEffect(() => {if (lintExists) loadLintReport();- else setLintReport(null);+ else {+ lintRequestRef.current++;+ setLoadingLint(false);+ setLintReport(null);+ setLintError(false);+ }}, [vaultId, lintExists]);- const loadLintReport = async () => {+ // A failed read is kept distinct from "no report yet" so it never reads as an absent report.+ const loadLintReport = () => {+ const requestId = ++lintRequestRef.current;+ const isCurrent = () => requestId === lintRequestRef.current;setLoadingLint(true);- const data = await api.getNote(vaultId, 'wiki/lint-report.md').catch(() => null);- setLintReport(data?.error ? null : data);- setLoadingLint(false);+ setLintError(false);+ setLintReport(null);+ api.getNote(vaultId, LINT_REPORT_PATH, { silent: true })+ .then(data => {+ if (!isCurrent()) return;+ if (data?.error) throw new Error(data.error);+ setLintReport(data);+ })+ .catch(() => { if (isCurrent()) { setLintReport(null); setLintError(true); } })+ .finally(() => { if (isCurrent()) setLoadingLint(false); });};const recentPages = useMemo(() =>@@ -128,7 +150,10 @@ export default function OverviewTab({ vaultId, stats, notes, allNotes, onRefresh<div className="px-4 py-3 border-b border-port-border flex items-center justify-between"><h3 className="text-sm font-medium text-white">Health Report</h3>{lintReport && (- <span className="text-xs text-gray-500">Updated {timeAgo(lintReport.modifiedAt)}</span>+ <div className="flex items-center gap-3">+ <span className="text-xs text-gray-500">Updated {timeAgo(lintReport.modifiedAt)}</span>+ <button onClick={() => openNote(LINT_REPORT_PATH)} className="text-xs text-port-accent hover:underline">Open full report</button>+ </div>)}</div><div className="p-4">@@ -136,9 +161,14 @@ export default function OverviewTab({ vaultId, stats, notes, allNotes, onRefresh<div className="flex items-center justify-center h-20"><RefreshCw size={16} className="animate-spin text-port-accent" /></div>+ ) : lintError ? (+ <div className="text-center py-6">+ <p className="text-sm text-gray-500">Couldn't load the health report</p>+ <button onClick={loadLintReport} className="text-xs text-port-accent hover:underline mt-2">Retry</button>+ </div>) : lintReport ? (- <div className="text-sm text-gray-300 whitespace-pre-wrap max-h-64 overflow-auto font-mono text-xs leading-relaxed">- {lintReport.body?.slice(0, 2000) || 'Report empty'}+ <div className="text-sm text-gray-300 max-h-64 overflow-auto">+ {lintReport.body?.trim() ? <MarkdownOutput content={lintReport.body} baseLevel={4} /> : <p className="text-gray-500">Report empty</p>}</div>) : (<div className="text-center py-6">diff --git a/client/src/components/wiki/tabs/OverviewTab.test.jsx b/client/src/components/wiki/tabs/OverviewTab.test.jsxindex 4102660110..e2d313f676 100644--- a/client/src/components/wiki/tabs/OverviewTab.test.jsx+++ b/client/src/components/wiki/tabs/OverviewTab.test.jsx@@ -1,5 +1,5 @@-import { render, screen, waitFor } from '@testing-library/react';-import { MemoryRouter } from 'react-router';+import { render, screen, waitFor, fireEvent } from '@testing-library/react';+import { MemoryRouter, useLocation } from 'react-router';import { describe, it, expect, vi, beforeEach } from 'vitest';import OverviewTab from './OverviewTab';import * as api from '../../../services/api';@@ -8,14 +8,21 @@ vi.mock('../../../services/api');const stats = { rawSources: 0, total: 0 };-function renderTab() {+function renderTab(allNotes = []) {return render(<MemoryRouter>- <OverviewTab vaultId="v1" stats={stats} notes={[]} allNotes={[]} onRefresh={() => {}} />+ <OverviewTab vaultId="v1" stats={stats} notes={[]} allNotes={allNotes} onRefresh={() => {}} /></MemoryRouter>);}+const LINT_NOTE = [{ path: 'wiki/lint-report.md', name: 'lint-report', folder: 'wiki', modifiedAt: '2026-05-10T00:00:00.000Z' }];++function LocationProbe() {+ const loc = useLocation();+ return <div data-testid="location">{loc.pathname + loc.search}</div>;+}+describe('OverviewTab empty Health Report', () => {beforeEach(() => vi.clearAllMocks());@@ -43,3 +50,71 @@ describe('OverviewTab empty Health Report', () => {expect(screen.queryByText(/is off/)).toBeNull();});});++describe('OverviewTab Health Report', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ api.getCosJobs.mockResolvedValue({ jobs: [] });+ });++ it('renders the lint report as Markdown and keeps the whole body past 2,000 characters', async () => {+ const tail = 'FINAL-FINDING-AFTER-2000-CHARS';+ const body = '# Wiki Lint Report\n\n**Zero structural issues**\n\n' + 'filler line.\n'.repeat(300) + tail;+ api.getNote.mockResolvedValue({ body, modifiedAt: '2026-05-10T00:00:00.000Z' });+ const { container } = renderTab(LINT_NOTE);+ expect(await screen.findByRole('heading', { name: 'Wiki Lint Report' })).toBeTruthy();+ expect(container.querySelector('strong').textContent).toBe('Zero structural issues');+ expect(screen.queryByText(/\*\*/)).toBeNull();+ expect(container.textContent).toContain(tail);+ expect(api.getNote).toHaveBeenCalledWith('v1', 'wiki/lint-report.md', { silent: true });+ });++ it('opens the full report in the Browse tab', async () => {+ api.getNote.mockResolvedValue({ body: '# Report', modifiedAt: '2026-05-10T00:00:00.000Z' });+ render(+ <MemoryRouter initialEntries={['/wiki/overview']}>+ <OverviewTab vaultId="v1" stats={stats} notes={[]} allNotes={LINT_NOTE} onRefresh={() => {}} />+ <LocationProbe />+ </MemoryRouter>+ );+ fireEvent.click(await screen.findByRole('button', { name: 'Open full report' }));+ expect(screen.getByTestId('location').textContent).toBe('/wiki/browse?note=wiki%2Flint-report.md');+ });++ it('shows a retry state when the read fails, and retry reloads the report', async () => {+ api.getNote.mockRejectedValueOnce(new Error('boom'));+ api.getNote.mockResolvedValueOnce({ body: '# Recovered', modifiedAt: '2026-05-10T00:00:00.000Z' });+ renderTab(LINT_NOTE);+ expect(await screen.findByText("Couldn't load the health report")).toBeTruthy();+ expect(screen.queryByText('No lint report yet')).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ expect(await screen.findByRole('heading', { name: 'Recovered' })).toBeTruthy();+ });++ it('drops a superseded response that resolves after the vault has switched', async () => {+ let resolveFirst;+ api.getNote+ .mockImplementationOnce(() => new Promise(r => { resolveFirst = r; }))+ .mockResolvedValueOnce({ body: '# Vault B report', modifiedAt: '2026-05-10T00:00:00.000Z' });+ const tree = (vaultId) => (+ <MemoryRouter>+ <OverviewTab vaultId={vaultId} stats={stats} notes={[]} allNotes={LINT_NOTE} onRefresh={() => {}} />+ </MemoryRouter>+ );+ const { rerender } = render(tree('v1'));+ await waitFor(() => expect(api.getNote).toHaveBeenCalledTimes(1));+ rerender(tree('v2'));+ expect(await screen.findByRole('heading', { name: 'Vault B report' })).toBeTruthy();+ resolveFirst({ body: '# Vault A report', modifiedAt: '2026-05-10T00:00:00.000Z' });+ await new Promise(r => setTimeout(r, 0));+ expect(screen.queryByRole('heading', { name: 'Vault A report' })).toBeNull();+ expect(screen.getByRole('heading', { name: 'Vault B report' })).toBeTruthy();+ });++ it('shows the empty state, not an error, when no lint report exists', async () => {+ renderTab([]);+ expect(await screen.findByText('No lint report yet')).toBeTruthy();+ expect(screen.queryByText("Couldn't load the health report")).toBeNull();+ expect(api.getNote).not.toHaveBeenCalled();+ });+});