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: explain what forced catalog type deletion removes (#9961)
Adam Eivy5274ba295197
diff --git a/client/src/components/settings/CatalogTypesTab.jsx b/client/src/components/settings/CatalogTypesTab.jsxindex d3a1bc85c7..309deea1cf 100644--- a/client/src/components/settings/CatalogTypesTab.jsx+++ b/client/src/components/settings/CatalogTypesTab.jsx@@ -89,7 +89,7 @@ export function CatalogTypesTab() {.catch((err) => {// 409 with the in-use code → offer a forced delete inline.if (err?.code === 'CATALOG_TYPE_IN_USE' || /force=true/.test(err?.message || '')) {- toast.error('Type has ingredients — confirm again to delete anyway');+ toast.error('This type is still in use. Review the effects before deleting its definition.');setArmedDeleteId(`force:${id}`);} else {toast.error(err?.message || 'Failed to delete type');@@ -98,7 +98,7 @@ export function CatalogTypesTab() {});setBusy(false);if (!ok) return;- toast.success('Type deleted');+ toast.success('Type definition deleted; ingredient records were kept.');setArmedDeleteId(null);refresh();};@@ -145,7 +145,7 @@ export function CatalogTypesTab() {)}<div className="space-y-2">{userTypes.map((t) => (- <div key={t.id} className="flex items-center justify-between gap-3 p-3 bg-port-bg border border-port-border rounded">+ <div key={t.id} className="flex flex-wrap items-center justify-between gap-3 p-3 bg-port-bg border border-port-border rounded"><div className="min-w-0"><div className="text-white text-sm font-medium truncate">{t.label}</div><div className="text-xs text-gray-500 font-mono">{t.id} · {(t.editorFields || []).length} field(s)</div>@@ -157,7 +157,8 @@ export function CatalogTypesTab() {</button>{armedDeleteId === t.id || armedDeleteId === `force:${t.id}` ? (<ConfirmButtonPair- confirmText="Confirm"+ prompt={armedDeleteId === t.id ? `Delete the ${t.label} type definition?` : undefined}+ confirmText={armedDeleteId === t.id ? 'Delete type' : 'Delete type definition anyway'}confirmIcon={Trash2}busy={busy}onConfirm={() => confirmDelete(t.id, { force: armedDeleteId === `force:${t.id}` })}@@ -171,6 +172,13 @@ export function CatalogTypesTab() {</button>)}</div>+ {armedDeleteId === `force:${t.id}` && (+ <p className="basis-full text-xs text-port-warning" role="alert">+ Existing ingredients use {t.label}. Deleting this type keeps those ingredients, removes its+ type filter, and replaces its custom-field editor with the standard editor. Their stored+ field values are retained.+ </p>+ )}</div>))}</div>diff --git a/client/src/components/settings/CatalogTypesTab.test.jsx b/client/src/components/settings/CatalogTypesTab.test.jsxindex 4b637a614a..8d9999d783 100644--- a/client/src/components/settings/CatalogTypesTab.test.jsx+++ b/client/src/components/settings/CatalogTypesTab.test.jsx@@ -69,7 +69,7 @@ describe('CatalogTypesTab', () => {await waitFor(() => expect(screen.getByText('Faction')).toBeTruthy());fireEvent.click(screen.getByLabelText(/Delete Faction/i));- const confirm = await screen.findByRole('button', { name: /Confirm/i });+ const confirm = await screen.findByRole('button', { name: /Delete type/i });await act(async () => { fireEvent.click(confirm); });expect(deleteCatalogType).toHaveBeenCalledWith('faction', { force: false, silent: true });@@ -85,13 +85,35 @@ describe('CatalogTypesTab', () => {await waitFor(() => expect(screen.getByText('Faction')).toBeTruthy());fireEvent.click(screen.getByLabelText(/Delete Faction/i));- await act(async () => { fireEvent.click(await screen.findByRole('button', { name: /Confirm/i })); });+ await act(async () => { fireEvent.click(await screen.findByRole('button', { name: /Delete type/i })); });// First attempt was refused (non-force).expect(deleteCatalogType).toHaveBeenLastCalledWith('faction', { force: false, silent: true });expect(toast.error).toHaveBeenCalled();+ // Persistent disclosure + stronger action name, no toast reliance.+ expect(screen.getByText(/keeps those ingredients, removes its type filter/i)).toBeTruthy();+ expect(screen.getByRole('button', { name: 'Delete type definition anyway' })).toBeTruthy();+ expect(deleteCatalogType).toHaveBeenCalledTimes(1);// Confirm again → forced delete.- await act(async () => { fireEvent.click(await screen.findByRole('button', { name: /Confirm/i })); });+ await act(async () => { fireEvent.click(await screen.findByRole('button', { name: /Delete type/i })); });expect(deleteCatalogType).toHaveBeenLastCalledWith('faction', { force: true, silent: true });+ expect(toast.success).toHaveBeenCalledWith('Type definition deleted; ingredient records were kept.');+ });++ it('cancelling the forced state makes no forced request', async () => {+ listCatalogTypes.mockResolvedValue({+ types: [{ id: 'faction', label: 'Faction', system: false, primaryContentKey: 'creed', fields: [] }],+ });+ deleteCatalogType.mockRejectedValueOnce(Object.assign(new Error('in use'), { code: 'CATALOG_TYPE_IN_USE' }));+ renderTab();+ await waitFor(() => expect(screen.getByText('Faction')).toBeTruthy());++ fireEvent.click(screen.getByLabelText(/Delete Faction/i));+ expect(screen.getByText('Delete the Faction type definition?')).toBeTruthy();+ await act(async () => { fireEvent.click(await screen.findByRole('button', { name: 'Delete type' })); });+ await act(async () => { fireEvent.click(await screen.findByRole('button', { name: /Cancel/i })); });++ expect(screen.queryByText(/keeps those ingredients/i)).toBeNull();+ expect(deleteCatalogType).toHaveBeenCalledTimes(1);});});