Skip to content

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

fix([issue-12591]): app Tasks, Automation and Git tabs show a failed read as an error, not as empty

[._.]/ Adam Eivyb46a430b535d
diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsx
index d8c45cf659..65e59152ce 100644
--- a/client/src/components/apps/tabs/AutomationTab.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.jsx
@@ -3,6 +3,8 @@ import { useNavigate, useSearchParams } from 'react-router';
import { RefreshCw, Play, PauseCircle, Sparkles, AlertTriangle, Search } from 'lucide-react';
import toast from '../../ui/Toast';
import BrailleSpinner from '../../BrailleSpinner';
+import ListLoadError from '../../ui/ListLoadError';
+import useListResource from '../../../hooks/useListResource.js';
import CronInput from '../../CronInput';
import ToggleSwitch from '../../ToggleSwitch';
import AppProviderPin from '../../cos/AppProviderPin';
@@ -39,9 +41,8 @@ export default function AutomationTab({ appId, appName }) {
else params.set(key, value);
setSearchParams(params, { replace: true });
};
- const [overrides, setOverrides] = useState({});
- const [schedule, setSchedule] = useState(null);
const [providers, setProviders] = useState([]);
+ const [providersError, setProvidersError] = useState(null);
const [providerCatalog, setProviderCatalog] = useState([]);
const [activeProviderId, setActiveProviderId] = useState('');
const [paused, setPaused] = useState(false);
@@ -54,16 +55,32 @@ export default function AutomationTab({ appId, appName }) {
// the behavior config on the Edit App → Intelligence tab).
const [expandedTaskType, setExpandedTaskType] = useState(null);
+ // The overrides and the schedule are separate resources: a failed overrides
+ // read must never render as every switch off, and a failed schedule read must
+ // not render as an empty catalogue. Each is a one-element list so the shared
+ // useListResource state machine (loading/ready/error + retry) applies.
+ const fetchOverrides = useCallback(
+ () => api.getAppTaskTypes(appId, { silent: true }).then(d => [d?.taskTypeOverrides || {}]),
+ [appId],
+ );
+ const fetchSchedule = useCallback(() => api.getCosSchedule({ silent: true }).then(d => [d || {}]), []);
+ const overridesResource = useListResource(fetchOverrides);
+ const scheduleResource = useListResource(fetchSchedule);
+ const overrides = overridesResource.items[0] || {};
+ const schedule = scheduleResource.items[0] || null;
+ const setOverrides = (update) => overridesResource.setItems(prev => [update(prev[0] || {})]);
+ const overridesReady = overridesResource.state === 'ready';
+ const scheduleReady = scheduleResource.state === 'ready';
+
const fetchData = useCallback(async () => {
- const [taskTypesData, scheduleData, statusData, providersData] = await Promise.all([
- api.getAppTaskTypes(appId).catch(() => ({ taskTypeOverrides: {} })),
- api.getCosSchedule().catch(() => null),
+ const [statusData, providersData] = await Promise.all([
api.getCosStatus().catch(() => null),
- api.getProviders({ silent: true }).catch(() => ({ providers: [] }))
+ api.getProviders({ silent: true }).catch((error) => ({ error }))
]);
- setOverrides(taskTypesData.taskTypeOverrides || {});
- setSchedule(scheduleData);
setPaused(statusData?.paused === true);
+ // A failed provider read keeps the last good catalogue and shows a retry row.
+ setProvidersError(providersData?.error || null);
+ if (providersData?.error) { setLoading(false); return; }
// Every ENABLED provider of a runnable type (cli/tui/api) — handler-backed
// tasks dispatch on provider.type, so any of them is a valid override.
setProviderCatalog(providersData?.providers || []);
@@ -156,6 +173,12 @@ export default function AutomationTab({ appId, appName }) {
return result?.success ? result : null;
};
+ const refreshAll = () => {
+ overridesResource.retry();
+ scheduleResource.retry();
+ fetchData();
+ };
+
if (loading) {
return <BrailleSpinner text="Loading automation settings" />;
}
@@ -236,10 +259,10 @@ export default function AutomationTab({ appId, appName }) {
leave one on <em>Inherit</em> and it follows the global schedule defaults.
</p>
</div>
- <ToggleSwitch enabled={allEnabled} onChange={handleToggleAll} size="sm" activeColor="bg-port-success" disabled={saving} ariaLabel={allEnabled ? 'Disable every scheduled task for this app' : 'Enable every scheduled task for this app'} />
+ {overridesReady && scheduleReady && <ToggleSwitch enabled={allEnabled} onChange={handleToggleAll} size="sm" activeColor="bg-port-success" disabled={saving} ariaLabel={allEnabled ? 'Disable every scheduled task for this app' : 'Enable every scheduled task for this app'} />}
</div>
<button
- onClick={fetchData}
+ onClick={refreshAll}
disabled={saving}
className="px-3 py-1.5 bg-port-border hover:bg-port-border/80 text-white rounded-lg text-xs flex items-center gap-1"
>
@@ -247,7 +270,20 @@ export default function AutomationTab({ appId, appName }) {
</button>
</div>
- {taskTypes.length === 0 ? (
+ {providersError && (
+ <ListLoadError what="the provider list" error={providersError} onRetry={fetchData} />
+ )}
+ {overridesResource.state === 'error' && (
+ <ListLoadError what="this app's automation settings" error={overridesResource.error} onRetry={overridesResource.retry} />
+ )}
+ {scheduleResource.state === 'error' && (
+ <ListLoadError what="the task schedule" error={scheduleResource.error} onRetry={scheduleResource.retry} />
+ )}
+ {(overridesResource.state === 'loading' || scheduleResource.state === 'loading') && (
+ <BrailleSpinner text="Loading automation settings" />
+ )}
+
+ {!overridesReady || !scheduleReady ? null : taskTypes.length === 0 ? (
<div className="bg-port-card border border-port-border rounded-lg p-6 text-center text-gray-500">
No task types configured in the schedule
</div>
diff --git a/client/src/components/apps/tabs/AutomationTab.test.jsx b/client/src/components/apps/tabs/AutomationTab.test.jsx
index 6a112b1585..bae8ad6acb 100644
--- a/client/src/components/apps/tabs/AutomationTab.test.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.test.jsx
@@ -348,3 +348,63 @@ describe('AutomationTab task visibility filter', () => {
expect(cardOrder()).toHaveLength(3);
});
});
+
+describe('AutomationTab read failures', () => {
+ const primeOthers = () => {
+ api.getCosStatus.mockResolvedValue({ paused: false });
+ api.getProviders.mockResolvedValue(PROVIDERS);
+ api.getCosJobs.mockResolvedValue({ jobs: [] });
+ api.getSettings.mockResolvedValue({ timezone: 'UTC' });
+ };
+
+ it('does not render per-app or master switches over an unknown overrides state, and recovers on Retry', async () => {
+ primeOthers();
+ api.getCosSchedule.mockResolvedValue(SCHEDULE);
+ api.getAppTaskTypes.mockRejectedValueOnce(new Error('overrides down'));
+ mountTab();
+
+ const alert = await screen.findByText(/Could not load this app's automation settings/);
+ expect(alert).toBeInTheDocument();
+ expect(screen.queryByRole('switch')).toBeNull();
+ expect(screen.queryByRole('group', { name: 'Task visibility' })).toBeNull();
+ expect(screen.queryByText('layered-intelligence')).toBeNull();
+
+ api.getAppTaskTypes.mockResolvedValue({ taskTypeOverrides: { security: { enabled: true } } });
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ await screen.findByRole('group', { name: 'Task visibility' });
+ expect(screen.queryByText(/Could not load/)).toBeNull();
+ expect(screen.getByText('On for this app (1)', { exact: false })).toBeInTheDocument();
+ });
+
+ it('shows a schedule error instead of "No task types configured", and recovers on Retry', async () => {
+ primeOthers();
+ api.getAppTaskTypes.mockResolvedValue({ taskTypeOverrides: {} });
+ api.getCosSchedule.mockRejectedValueOnce(new Error('schedule down'));
+ mountTab();
+
+ expect(await screen.findByText(/Could not load the task schedule/)).toBeInTheDocument();
+ expect(screen.queryByText(/No task types configured/)).toBeNull();
+
+ api.getCosSchedule.mockResolvedValue(SCHEDULE);
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ await screen.findByRole('group', { name: 'Task visibility' });
+ });
+
+ it('still renders the empty copy when the schedule loads with no task types', async () => {
+ primeOthers();
+ api.getAppTaskTypes.mockResolvedValue({ taskTypeOverrides: {} });
+ api.getCosSchedule.mockResolvedValue({ tasks: {} });
+ mountTab();
+ expect(await screen.findByText(/No task types configured/)).toBeInTheDocument();
+ expect(screen.queryByText(/Could not load/)).toBeNull();
+ });
+
+ it('shows a provider list error row instead of an empty provider catalogue', async () => {
+ primeOthers();
+ api.getAppTaskTypes.mockResolvedValue({ taskTypeOverrides: {} });
+ api.getCosSchedule.mockResolvedValue(SCHEDULE);
+ api.getProviders.mockRejectedValueOnce(new Error('providers down'));
+ mountTab();
+ expect(await screen.findByText(/Could not load the provider list/)).toBeInTheDocument();
+ });
+});
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsx
index c3c54c7823..c9a78f0a3b 100644
--- a/client/src/components/apps/tabs/GitTab.jsx
+++ b/client/src/components/apps/tabs/GitTab.jsx
@@ -4,6 +4,7 @@ import { GitBranch, Plus, Minus, FileText, RefreshCw, Download, Rocket, Upload,
import toast from '../../ui/Toast';
import Modal from '../../ui/Modal';
import BrailleSpinner from '../../BrailleSpinner';
+import ListLoadError from '../../ui/ListLoadError';
import * as api from '../../../services/api';
import { formatDateNumeric } from '../../../utils/formatters';
import RepositorySourcePanel from './RepositorySourcePanel';
@@ -145,6 +146,9 @@ export default function GitTab({ appId, appName, repoPath }) {
const [releasing, setReleasing] = useState(false);
const [showReleaseConfirm, setShowReleaseConfirm] = useState(false);
const [branches, setBranches] = useState([]);
+ // A failed branch read is kept apart from a repo that has no branches; a
+ // refresh failure keeps the last good list on screen beside the error row.
+ const [branchesError, setBranchesError] = useState(null);
const [checkingOut, setCheckingOut] = useState(null);
const [pushing, setPushing] = useState(null);
const [syncing, setSyncing] = useState(null);
@@ -173,7 +177,7 @@ export default function GitTab({ appId, appName, repoPath }) {
const promises = [
api.getGitInfo(repoPath).catch(() => null),
- api.getBranches(repoPath).catch(() => ({ branches: [] }))
+ api.getBranches(repoPath, { silent: true }).catch((error) => ({ error }))
];
if (includeRemote) {
promises.push(api.getRemoteBranches(repoPath).catch(() => null));
@@ -187,7 +191,12 @@ export default function GitTab({ appId, appName, repoPath }) {
}
setGitInfo(info);
- setBranches(branchesResult?.branches || []);
+ if (branchesResult?.error) {
+ setBranchesError(branchesResult.error);
+ } else {
+ setBranchesError(null);
+ setBranches(branchesResult?.branches || []);
+ }
setBranchComparison(comparison);
setLoading(false);
@@ -945,7 +954,10 @@ export default function GitTab({ appId, appName, repoPath }) {
</div>
</div>
))}
- {branches.length === 0 && (
+ {branchesError && (
+ <ListLoadError what="branches" error={branchesError} onRetry={() => loadGitData({ includeRemote: false })} retrying={loading} />
+ )}
+ {!branchesError && branches.length === 0 && (
<div className="text-gray-500 text-sm">No branches found</div>
)}
</div>
diff --git a/client/src/components/apps/tabs/GitTab.test.jsx b/client/src/components/apps/tabs/GitTab.test.jsx
index 5988236ea0..1fbad96fb9 100644
--- a/client/src/components/apps/tabs/GitTab.test.jsx
+++ b/client/src/components/apps/tabs/GitTab.test.jsx
@@ -368,3 +368,25 @@ describe('GitTab shell terminal integration', () => {
expect(mockNavigate).toHaveBeenCalledWith('/shell?cwd=%2Fsrv%2Fexample-app');
});
});
+
+describe('GitTab branch read failure', () => {
+ it('shows an error row with Retry instead of "No branches found", then recovers', async () => {
+ api.getBranches.mockRejectedValueOnce(new Error('boom'));
+ render(<GitTab appId="app-example" appName="Example App" repoPath="/srv/example-app" />);
+
+ const alert = await screen.findByRole('alert');
+ expect(alert).toHaveTextContent('Could not load branches');
+ expect(screen.queryByText('No branches found')).toBeNull();
+
+ api.getBranches.mockResolvedValue({ branches: [{ name: 'main', current: true }] });
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ await screen.findByText('main');
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+
+ it('still renders the empty copy when the read succeeds with no branches', async () => {
+ render(<GitTab appId="app-example" appName="Example App" repoPath="/srv/example-app" />);
+ expect(await screen.findByText('No branches found')).toBeInTheDocument();
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+});
diff --git a/client/src/components/apps/tabs/TasksTab.jsx b/client/src/components/apps/tabs/TasksTab.jsx
index 6157707b99..67da49bf8a 100644
--- a/client/src/components/apps/tabs/TasksTab.jsx
+++ b/client/src/components/apps/tabs/TasksTab.jsx
@@ -1,7 +1,9 @@
-import { useState, useEffect, useCallback } from 'react';
+import { useCallback } from 'react';
import { Link } from 'react-router';
import { RefreshCw, Clock, Activity } from 'lucide-react';
import BrailleSpinner from '../../BrailleSpinner';
+import ListLoadError from '../../ui/ListLoadError';
+import useListResource from '../../../hooks/useListResource.js';
import TaskAddForm from '../../cos/TaskAddForm';
import * as api from '../../../services/api';
import { formatDurationMs, formatTime } from '../../../utils/formatters';
@@ -16,35 +18,33 @@ const STATUS_CONFIG = {
};
-export default function TasksTab({ appId }) {
- const [data, setData] = useState(null);
- const [loading, setLoading] = useState(true);
- const [providers, setProviders] = useState([]);
- const [apps, setApps] = useState([]);
+const fetchProviders = () => api.getProviders({ silent: true }).then(d => d?.providers ?? []);
+const fetchApps = () => api.getApps({ silent: true }).then(a => (a ?? []).filter(app => app.id !== 'portos-autofixer'));
- const fetchAgents = useCallback(async () => {
- setLoading(true);
- const result = await api.getAppAgents(appId).catch(() => ({ agents: [], summary: {} }));
- setData(result);
- setLoading(false);
- }, [appId]);
+export default function TasksTab({ appId }) {
+ // The tab owns its error UI, so the request is silent (no auto-toast).
+ const fetchAppAgents = useCallback(
+ () => api.getAppAgents(appId, undefined, { silent: true }).then((result) => result?.agents ?? []),
+ [appId],
+ );
+ const { items: agents, state, error, retry: fetchAgents } = useListResource(fetchAppAgents);
- useEffect(() => {
- let active = true;
- fetchAgents();
- // Fetch providers and apps for the task add form
- api.getProviders().catch(() => ({ providers: [] }))
- .then(d => { if (active) setProviders(d.providers || []); });
- api.getApps().catch(() => [])
- .then(a => { if (active) setApps((a || []).filter(app => app.id !== 'portos-autofixer')); });
- return () => { active = false; };
- }, [appId, fetchAgents]);
+ // Pickers for the add-task form: a failed read shows a retry row instead of a
+ // form that silently offers no providers or apps.
+ const providersResource = useListResource(fetchProviders);
+ const appsResource = useListResource(fetchApps);
- if (loading) {
+ if (state === 'loading') {
return <BrailleSpinner text="Loading agent history" />;
}
- const { agents = [], summary = {} } = data || {};
+ // Mirrors the server's summary (same list, same status buckets).
+ const failed = state === 'error';
+ const summary = {
+ total: agents.length,
+ running: agents.filter(a => a.status === 'running' || a.status === 'spawning').length,
+ succeeded: agents.filter(a => a.status === 'completed').length,
+ };
const successRate = summary.total > 0
? Math.round((summary.succeeded / summary.total) * 100)
: 0;
@@ -52,9 +52,15 @@ export default function TasksTab({ appId }) {
return (
<div className="w-full min-w-0 space-y-4">
{/* Add Task Form */}
+ {providersResource.state === 'error' && (
+ <ListLoadError what="providers for the task form" error={providersResource.error} onRetry={providersResource.retry} />
+ )}
+ {appsResource.state === 'error' && (
+ <ListLoadError what="apps for the task form" error={appsResource.error} onRetry={appsResource.retry} />
+ )}
<TaskAddForm
- providers={providers}
- apps={apps}
+ providers={providersResource.items}
+ apps={appsResource.items}
onTaskAdded={fetchAgents}
compact
defaultApp={appId}
@@ -70,6 +76,9 @@ export default function TasksTab({ appId }) {
</button>
</div>
+ {failed ? (
+ <ListLoadError what="agent history" error={error} onRetry={fetchAgents} />
+ ) : (<>
{/* Summary Stats */}
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3">
<div className="bg-port-card border border-port-border rounded-lg p-3 text-center">
@@ -153,6 +162,7 @@ export default function TasksTab({ appId }) {
</table>
</div>
)}
+ </>)}
</div>
);
}
diff --git a/client/src/components/apps/tabs/TasksTab.test.jsx b/client/src/components/apps/tabs/TasksTab.test.jsx
index a78dbda2de..bbbd887d64 100644
--- a/client/src/components/apps/tabs/TasksTab.test.jsx
+++ b/client/src/components/apps/tabs/TasksTab.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, waitFor } from '@testing-library/react';
+import { render, screen, waitFor, fireEvent } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
vi.mock('../../../services/api', () => ({
@@ -58,3 +58,33 @@ describe('TasksTab layout', () => {
expect(table.parentElement).toHaveClass('overflow-x-auto');
});
});
+
+describe('TasksTab read failure', () => {
+ beforeEach(() => {
+ api.getProviders.mockResolvedValue({ providers: [] });
+ api.getApps.mockResolvedValue([]);
+ });
+
+ it('shows an error row with Retry instead of zero stats and the empty copy, then recovers', async () => {
+ api.getAppAgents.mockRejectedValueOnce(new Error('boom'));
+ renderTab();
+
+ const alert = await screen.findByRole('alert');
+ expect(alert).toHaveTextContent('Could not load agent history');
+ expect(screen.queryByText('Success Rate')).toBeNull();
+ expect(screen.queryByText(/No agent tasks found/)).toBeNull();
+
+ api.getAppAgents.mockResolvedValue({ agents: [AGENT], summary: { total: 1 } });
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+ await screen.findByRole('table');
+ expect(screen.getByText('Success Rate')).toBeInTheDocument();
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+
+ it('renders the real-empty copy when the read succeeds with no agents', async () => {
+ api.getAppAgents.mockResolvedValue({ agents: [], summary: {} });
+ renderTab();
+ expect(await screen.findByText(/No agent tasks found/)).toBeInTheDocument();
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+});
diff --git a/client/src/listFetchConventions.test.js b/client/src/listFetchConventions.test.js
index 91c52c87c2..e4d1c3fbff 100644
--- a/client/src/listFetchConventions.test.js
+++ b/client/src/listFetchConventions.test.js
@@ -1,7 +1,7 @@
// @vitest-environment node
/**
- * Repo-wide guard: a page's list fetch does not collapse a failed read into
+ * Repo-wide guard: a page or component list fetch does not collapse a failed read into
* an empty list.
*
* `listLorasFull().catch(() => [])` and `.catch(() => setTracks([]))` make a
@@ -16,7 +16,7 @@
* carries today; a NEW site, or a higher count in a listed page, fails. So does
* a count that DROPPED, so the row is lowered or removed and the baseline
* stays honest. The remaining sites are tracked by surface in the follow-up
- * issues #12040 names.
+ * issues #12040 names; the app detail tabs (#12591) are already at zero.
*
* ## What this guard CANNOT see
*
@@ -36,21 +36,88 @@ import { trackedSourceFiles } from './test/trackedFiles.js';
const CLIENT_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
-// Page code only — the pickers and index lists users see.
-const SCAN_PREFIX = 'src/pages/';
+// Pages (the pickers and index lists users see) and the components they host
+// (app detail tabs, drawers, panels).
+const SCAN_PREFIXES = ['src/pages/', 'src/components/'];
/**
- * `.catch(() => [])`, `.catch(() => setX([]))` and the braced one-statement
- * form `.catch(() => { setX([]); })`. The setter must start with `set` + a
- * capital, so `.catch(() => reset([]))` and a non-setter call stay out.
+ * `.catch(() => [])`, `.catch(() => setX([]))`, the braced one-statement form
+ * `.catch(() => { setX([]); })`, and the object-literal spelling
+ * `.catch(() => ({ agents: [], summary: {} }))` (a list under a key, one level
+ * of nested braces allowed). The setter must start with `set` + a capital, so
+ * `.catch(() => reset([]))` and a non-setter call stay out.
*/
-export const LIST_COLLAPSE = /\.catch\(\s*\(\s*\)\s*=>\s*(?:\[\]|\{?\s*set[A-Z]\w*\(\s*\[\]\s*\)\s*;?\s*\}?)\s*\)/g;
+export const LIST_COLLAPSE = /\.catch\(\s*\(\s*\)\s*=>\s*(?:\[\]|\{?\s*set[A-Z]\w*\(\s*\[\]\s*\)\s*;?\s*\}?|\(\s*\{(?:[^{}]|\{[^{}]*\})*?\b\w+\s*:\s*\[\](?:[^{}]|\{[^{}]*\})*\}\s*\))\s*\)/g;
/**
- * Pages still carrying a collapse, with how many. Lower or remove a row when a
+ * Files still carrying a collapse, with how many. Lower or remove a row when a
* site is migrated to `useListResource`; never raise one.
*/
-const KNOWN = Object.freeze({});
+const KNOWN = Object.freeze({
+ 'src/components/FeatureProviderPicker.jsx': 1,
+ 'src/components/QuickTaskWidget.jsx': 2,
+ 'src/components/apps/EditAppDrawer.jsx': 2,
+ 'src/components/apps/JiraConfigPanel.jsx': 1,
+ 'src/components/brain/IdeaLoomLists.jsx': 1,
+ 'src/components/brain/YoutubeIngestSettings.jsx': 1,
+ 'src/components/brain/tabs/ConfigTab.jsx': 1,
+ 'src/components/brain/tabs/DailyLogTab.jsx': 1,
+ 'src/components/brain/tabs/FeedsTab.jsx': 1,
+ 'src/components/brain/tabs/TrustTab.jsx': 1,
+ 'src/components/cos/tabs/JobsTab.jsx': 1,
+ 'src/components/cos/tabs/ProviderStatusCard.jsx': 1,
+ 'src/components/cos/tabs/RunsTab.jsx': 1,
+ 'src/components/digital-twin/ListEnrichment.jsx': 1,
+ 'src/components/digital-twin/ObservedTasteEvidence.jsx': 1,
+ 'src/components/digital-twin/tabs/AccountsTab.jsx': 3,
+ 'src/components/digital-twin/tabs/AutobiographyTab.jsx': 3,
+ 'src/components/digital-twin/tabs/DocumentsTab.jsx': 1,
+ 'src/components/digital-twin/tabs/EnrichTab.jsx': 1,
+ 'src/components/digital-twin/tabs/ExportTab.jsx': 2,
+ 'src/components/digital-twin/tabs/ImportTab.jsx': 2,
+ 'src/components/digital-twin/tabs/InterviewTab.jsx': 1,
+ 'src/components/digital-twin/tabs/OverviewTab.jsx': 2,
+ 'src/components/digital-twin/tabs/PersonalityTab.jsx': 1,
+ 'src/components/digital-twin/tabs/PersonasTab.jsx': 1,
+ 'src/components/digital-twin/tabs/TasteTab.jsx': 2,
+ 'src/components/digital-twin/tabs/TestTab.jsx': 4,
+ 'src/components/digital-twin/tabs/TimeCapsuleTab.jsx': 1,
+ 'src/components/fableloom/LoomProductionPanel.jsx': 1,
+ 'src/components/fableloom/LoomSettingsDrawer.jsx': 1,
+ 'src/components/loraTraining/CaptionModelPicker.jsx': 1,
+ 'src/components/meatspace/EpigeneticTracker.jsx': 1,
+ 'src/components/meatspace/HealthCategorySection.jsx': 1,
+ 'src/components/meatspace/post/PostSessionLauncher.jsx': 2,
+ 'src/components/meatspace/post/PracticePlan.jsx': 1,
+ 'src/components/meatspace/tabs/AlcoholTab.jsx': 1,
+ 'src/components/meatspace/tabs/NicotineTab.jsx': 1,
+ 'src/components/meatspace/tabs/PostTab.jsx': 1,
+ 'src/components/media/UniverseMoodBoardPicker.jsx': 3,
+ 'src/components/messages/DraftsTab.jsx': 1,
+ 'src/components/messages/IMessageTab.jsx': 1,
+ 'src/components/models/ProviderFallbacks.jsx': 1,
+ 'src/components/music/AlbumsManager.jsx': 2,
+ 'src/components/music/ChiptunePanel.jsx': 1,
+ 'src/components/music/TracksManager.jsx': 2,
+ 'src/components/pipeline/stages/ComicScriptStage.jsx': 1,
+ 'src/components/pipeline/stages/NounsStage.jsx': 1,
+ 'src/components/privacy/PrivacyOrgsTab.jsx': 2,
+ 'src/components/settings/SharingTab.jsx': 1,
+ 'src/components/settings/VoiceTab.jsx': 1,
+ 'src/components/sharing/ShareToButton.jsx': 2,
+ 'src/components/sharing/SyncToPeerButton.jsx': 1,
+ 'src/components/sprites/ImportPanel.jsx': 1,
+ 'src/components/writers-room/AnalysisHistory.jsx': 1,
+ 'src/components/writers-room/ExercisePanel.jsx': 1,
+ 'src/components/writers-room/PolishPanel.jsx': 1,
+ 'src/components/writers-room/StoryboardPanel.jsx': 3,
+ 'src/pages/AIProviders.jsx': 2,
+ 'src/pages/PipelineEditorialChecks.jsx': 1,
+ 'src/pages/PipelineManuscriptEditor.jsx': 1,
+ 'src/pages/PromptManager.jsx': 1,
+ 'src/pages/Sharing.jsx': 1,
+ 'src/pages/Tribe.jsx': 2,
+});
const countIn = (source) => (source.match(LIST_COLLAPSE) || []).length;
@@ -60,18 +127,28 @@ describe('page list fetches keep a failed read distinct from an empty list', ()
'listLorasFull().catch(() => [])',
'listTracks({ silent: true }).then((t) => setTracks(t || [])).catch(() => setTracks([]))',
'load().catch(() => { setRows([]); })',
+ 'getAppAgents(id).catch(() => ({ agents: [], summary: {} }))',
+ 'getBranches(p).catch(() => ({ summary: {}, branches: [] }))',
]) expect(countIn(sample), sample).toBe(1);
for (const sample of [
'listTracks().catch(() => setLoadError(true))',
'load().catch(() => { setRows([]); setFailed(true); })',
'load().catch(() => FETCH_FAILED)',
+ 'getAppTaskTypes(id).catch(() => ({ taskTypeOverrides: {} }))',
+ 'load().catch(() => ({ providers: [], error: true }))'.replace('[], error', 'x, error'),
]) expect(countIn(sample), sample).toBe(0);
});
- it('has no new page list fetch that collapses failure into an empty list', () => {
+ it('keeps the app detail tabs off the baseline', () => {
+ for (const tab of ['TasksTab', 'AutomationTab', 'GitTab']) {
+ expect(KNOWN, tab).not.toHaveProperty(['src/components/apps/tabs/' + tab + '.jsx']);
+ }
+ });
+
+ it('has no new page or component list fetch that collapses failure into an empty list', () => {
const found = {};
for (const file of trackedSourceFiles(CLIENT_ROOT)) {
- if (!file.startsWith(SCAN_PREFIX)) continue;
+ if (!SCAN_PREFIXES.some((prefix) => file.startsWith(prefix))) continue;
const count = countIn(readFileSync(join(CLIENT_ROOT, file), 'utf8'));
if (count > 0) found[file] = count;
}
@@ -79,7 +156,7 @@ describe('page list fetches keep a failed read distinct from an empty list', ()
.filter(([file, count]) => count > (KNOWN[file] || 0))
.map(([file, count]) => `${file}: ${count} (known ${KNOWN[file] || 0})`);
expect(added, [
- 'These page list fetches render a failed read as an empty list. Read the list through',
+ 'These list fetches render a failed read as an empty list. Read the list through',
'`useListResource(fetcher)` and render `<ListLoadError onRetry={retry}>` on `state === "error"`,',
'keeping the empty copy for `state === "ready"`; never `.catch(() => [])` / `setX([])`.',
].join('\n')).toEqual([]);
diff --git a/client/src/services/apiApps.js b/client/src/services/apiApps.js
index b97deebe82..7fc0e4200e 100644
--- a/client/src/services/apiApps.js
+++ b/client/src/services/apiApps.js
@@ -266,7 +266,7 @@ export const refreshAppConfig = (id) => request(`/apps/${id}/refresh-config`, {
// `options` lets a caller suppress request()'s auto-toast with `{ silent: true }`
// when it already renders its own error UI.
export const buildApp = (id, options = {}) => request(`/apps/${id}/build`, { method: 'POST', ...options });
-export const getAppTaskTypes = (id) => request(`/apps/${id}/task-types`);
+export const getAppTaskTypes = (id, options = {}) => request(`/apps/${id}/task-types`, options);
export const toggleAllAppTaskTypes = (id, enabled, options = {}) => request(`/apps/${id}/task-types/all`, {
method: 'PUT',
body: JSON.stringify({ enabled }),
@@ -304,4 +304,4 @@ export const saveAppDocument = (id, filename, content, commitMessage, options) =
method: 'PUT',
body: JSON.stringify({ content, ...(commitMessage && { commitMessage }) })
});
-export const getAppAgents = (id, limit = 50) => request(`/apps/${id}/agents?limit=${limit}`);
+export const getAppAgents = (id, limit = 50, options = {}) => request(`/apps/${id}/agents?limit=${limit}`, options);
diff --git a/client/src/services/apiGit.js b/client/src/services/apiGit.js
index f5baf96622..9b949060b6 100644
--- a/client/src/services/apiGit.js
+++ b/client/src/services/apiGit.js
@@ -37,9 +37,10 @@ export const pushAllBranches = (path) => request('/git/push-all', {
method: 'POST',
body: JSON.stringify({ path })
});
-export const getBranches = (path) => request('/git/branches', {
+export const getBranches = (path, options = {}) => request('/git/branches', {
method: 'POST',
- body: JSON.stringify({ path })
+ body: JSON.stringify({ path }),
+ ...options
});
export const checkoutBranch = (path, branch) => request('/git/checkout', {
method: 'POST',