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: hide social-account ingestion controls until ingestion exists (#10061)
[._.]/ Adam Eivyc119bc8007b9
diff --git a/client/src/components/digital-twin/tabs/AccountsTab.jsx b/client/src/components/digital-twin/tabs/AccountsTab.jsxindex 405f42ddd6..4d7b544d9f 100644--- a/client/src/components/digital-twin/tabs/AccountsTab.jsx+++ b/client/src/components/digital-twin/tabs/AccountsTab.jsx@@ -94,8 +94,7 @@ const EMPTY_FORM = {displayName: '',url: '',bio: '',- notes: '',- ingestionEnabled: false+ notes: ''};export default function AccountsTab() {@@ -184,8 +183,7 @@ export default function AccountsTab() {displayName: account.displayName || '',url: account.url || '',bio: account.bio || '',- notes: account.notes || '',- ingestionEnabled: account.ingestionEnabled || false+ notes: account.notes || ''});setEditingId(account.id);setShowForm(true);@@ -233,7 +231,7 @@ export default function AccountsTab() {<div><h2 className="text-lg font-semibold text-white">Social Accounts</h2><p className="text-sm text-gray-500">- Your online presence for content learning and style reference+ Your online presence directory and profile reference</p></div><div className="flex items-center gap-2">@@ -256,15 +254,11 @@ export default function AccountsTab() {{/* Stats Summary */}{stats && stats.total > 0 && (- <div className="grid grid-cols-2 sm:grid-cols-4 gap-3">+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3"><div className="bg-port-card border border-port-border rounded-lg p-3"><div className="text-2xl font-bold text-white">{stats.total}</div><div className="text-xs text-gray-500">Total Accounts</div></div>- <div className="bg-port-card border border-port-border rounded-lg p-3">- <div className="text-2xl font-bold text-port-accent">{stats.ingestionEnabled}</div>- <div className="text-xs text-gray-500">Ingestion Enabled</div>- </div><div className="bg-port-card border border-port-border rounded-lg p-3"><div className="text-2xl font-bold text-port-accent-2">{Object.keys(stats.byCategory || {}).length}</div><div className="text-xs text-gray-500">Categories</div>@@ -386,26 +380,6 @@ export default function AccountsTab() {/></FormField>- {/* Ingestion toggle */}- <div className="flex items-center gap-3">- <button- type="button"- role="switch"- aria-checked={!!form.ingestionEnabled}- aria-label="Enable content ingestion"- onClick={() => setForm(prev => ({ ...prev, ingestionEnabled: !prev.ingestionEnabled }))}- className={`relative w-10 h-5 rounded-full transition-colors ${- form.ingestionEnabled ? 'bg-port-accent' : 'bg-gray-600'- }`}- >- <span className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${- form.ingestionEnabled ? 'left-5' : 'left-0.5'- }`} />- </button>- <span className="text-sm text-gray-400">- Enable content ingestion (future: download and learn from content)- </span>- </div>{/* Actions */}<div className="flex items-center gap-2 pt-2 border-t border-port-border">@@ -437,8 +411,8 @@ export default function AccountsTab() {<Globe className="w-12 h-12 text-gray-600 mx-auto mb-3" /><h3 className="text-white font-medium mb-1">No social accounts yet</h3><p className="text-sm text-gray-500 mb-4">- Add your social media accounts to build your digital identity profile.- These will be used for content learning and style reference.+ Add your social media accounts to build your digital identity profile+ and reference your profiles across platforms.</p><buttononClick={() => setShowForm(true)}@@ -480,11 +454,6 @@ export default function AccountsTab() {<span className="text-xs text-gray-500">@{account.username}</span>- {account.ingestionEnabled && (- <span className="text-[10px] px-1.5 py-0.5 bg-port-accent/20 text-port-accent rounded">- ingestion- </span>- )}</div>{account.bio && (<p className="text-xs text-gray-500 mt-0.5 line-clamp-1">{account.bio}</p>diff --git a/client/src/components/digital-twin/tabs/AccountsTab.test.jsx b/client/src/components/digital-twin/tabs/AccountsTab.test.jsxnew file mode 100644index 0000000000..c8799feb5f--- /dev/null+++ b/client/src/components/digital-twin/tabs/AccountsTab.test.jsx@@ -0,0 +1,171 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';++vi.mock('../../../services/api', () => ({+ getSocialAccounts: vi.fn(),+ getSocialAccountPlatforms: vi.fn(),+ getSocialAccountStats: vi.fn(),+ getSocialAccountOrgLinks: vi.fn(),+ createSocialAccount: vi.fn(),+ updateSocialAccount: vi.fn(),+ deleteSocialAccount: vi.fn(),+ createPrivacyOrg: vi.fn()+}));++vi.mock('../../ui/Toast', () => ({+ default: { success: vi.fn(), error: vi.fn() }+}));++import AccountsTab from './AccountsTab';+import * as api from '../../../services/api';++const MOCK_PLATFORMS = {+ platforms: [+ { id: 'github', label: 'GitHub', category: 'developer', urlTemplate: 'https://github.com/{username}' },+ { id: 'x', label: 'X (Twitter)', category: 'social', urlTemplate: 'https://x.com/{username}' }+ ]+};++const MOCK_STATS = {+ total: 2,+ ingestionEnabled: 1,+ byCategory: { developer: 1, social: 1 },+ byPlatform: { github: 1, x: 1 }+};++const MOCK_ACCOUNTS = {+ accounts: [+ {+ id: 'acc-1',+ platform: 'github',+ username: 'octocat',+ displayName: 'The Octocat',+ url: 'https://github.com/octocat',+ bio: 'Mona Lisa Octocat',+ notes: 'Work account',+ ingestionEnabled: true+ },+ {+ id: 'acc-2',+ platform: 'x',+ username: 'octo_x',+ displayName: 'Octo X',+ url: 'https://x.com/octo_x',+ bio: '',+ notes: '',+ ingestionEnabled: false+ }+ ]+};++beforeEach(() => {+ vi.clearAllMocks();+ api.getSocialAccounts.mockResolvedValue(MOCK_ACCOUNTS);+ api.getSocialAccountPlatforms.mockResolvedValue(MOCK_PLATFORMS);+ api.getSocialAccountStats.mockResolvedValue(MOCK_STATS);+ api.getSocialAccountOrgLinks.mockResolvedValue([]);+ api.createSocialAccount.mockResolvedValue({ id: 'acc-3', platform: 'github', username: 'newuser' });+ api.updateSocialAccount.mockResolvedValue({ id: 'acc-1', platform: 'github', username: 'octocat' });+});++describe('AccountsTab', () => {+ it('renders directory/profile reference text and hides ingestion metric and badge', async () => {+ render(<AccountsTab />);++ expect(await screen.findByText('Social Accounts')).toBeInTheDocument();+ expect(screen.getByText('Your online presence directory and profile reference')).toBeInTheDocument();++ // Stats tiles: Total, Categories, Platforms are shown, Ingestion Enabled is NOT+ expect(screen.getByText('Total Accounts')).toBeInTheDocument();+ expect(screen.getByText('Categories')).toBeInTheDocument();+ expect(screen.getByText('Platforms')).toBeInTheDocument();+ expect(screen.queryByText(/Ingestion Enabled/i)).not.toBeInTheDocument();++ // Ingestion badge must not appear even though acc-1 has ingestionEnabled: true+ expect(screen.queryByText('ingestion')).not.toBeInTheDocument();+ expect(screen.getByText('@octocat')).toBeInTheDocument();+ });++ it('omits ingestionEnabled when creating a new account and does not render switch', async () => {+ const user = userEvent.setup();+ render(<AccountsTab />);+ await screen.findByText('Social Accounts');++ // Open add account form+ await user.click(screen.getByRole('button', { name: /add account/i }));++ // Verify no ingestion toggle/switch exists+ expect(screen.queryByRole('switch')).not.toBeInTheDocument();+ expect(screen.queryByLabelText(/ingestion/i)).not.toBeInTheDocument();+ expect(screen.queryByText(/content ingestion/i)).not.toBeInTheDocument();++ // Select platform and fill form+ await user.click(screen.getByRole('button', { name: 'GitHub' }));+ await user.type(screen.getByPlaceholderText(/Your GitHub username/i), 'newuser');+ await user.type(screen.getByPlaceholderText(/Optional display name/i), 'New User');+ await user.type(screen.getByPlaceholderText(/What you use this account for/i), 'Coding samples');+ await user.type(screen.getByPlaceholderText(/Private notes about this account/i), 'Secret notes');++ // Submit form: find the button inside the form actions (second "Add Account" button)+ const addButtons = screen.getAllByRole('button', { name: /^add account$/i });+ const submitBtn = addButtons[addButtons.length - 1];+ await user.click(submitBtn);++ await waitFor(() => expect(api.createSocialAccount).toHaveBeenCalledOnce());+ const submittedPayload = api.createSocialAccount.mock.calls[0][0];++ expect(submittedPayload.platform).toBe('github');+ expect(submittedPayload.username).toBe('newuser');+ expect(submittedPayload.displayName).toBe('New User');+ expect(submittedPayload.bio).toBe('Coding samples');+ expect(submittedPayload.notes).toBe('Secret notes');+ expect(submittedPayload.ingestionEnabled).toBeUndefined();+ expect('ingestionEnabled' in submittedPayload).toBe(false);+ });++ it('omits ingestionEnabled on edit and does not render switch for legacy account', async () => {+ const user = userEvent.setup();+ render(<AccountsTab />);+ await screen.findByText('Social Accounts');++ // Click edit on the first account (which has legacy ingestionEnabled: true)+ const editButtons = screen.getAllByRole('button', { name: 'Edit' });+ await user.click(editButtons[0]);++ // Verify edit form header and absence of ingestion switch+ expect(screen.getByText('Edit Account')).toBeInTheDocument();+ expect(screen.queryByRole('switch')).not.toBeInTheDocument();+ expect(screen.queryByText(/content ingestion/i)).not.toBeInTheDocument();++ // Update display name+ const displayNameInput = screen.getByPlaceholderText(/Optional display name/i);+ expect(displayNameInput).toHaveValue('The Octocat');+ await user.clear(displayNameInput);+ await user.type(displayNameInput, 'Updated Octocat');++ // Submit update+ const updateBtn = screen.getByRole('button', { name: /^update$/i });+ await user.click(updateBtn);++ await waitFor(() => expect(api.updateSocialAccount).toHaveBeenCalledOnce());+ const [id, submittedPayload] = api.updateSocialAccount.mock.calls[0];++ expect(id).toBe('acc-1');+ expect(submittedPayload.displayName).toBe('Updated Octocat');+ expect(submittedPayload.platform).toBe('github');+ expect(submittedPayload.username).toBe('octocat');+ expect(submittedPayload.ingestionEnabled).toBeUndefined();+ expect('ingestionEnabled' in submittedPayload).toBe(false);+ });++ it('renders updated empty state without content-learning claims', async () => {+ api.getSocialAccounts.mockResolvedValue({ accounts: [] });+ api.getSocialAccountStats.mockResolvedValue({ total: 0, ingestionEnabled: 0 });++ render(<AccountsTab />);+ expect(await screen.findByText('No social accounts yet')).toBeInTheDocument();+ expect(screen.getByText(/Add your social media accounts to build your digital identity profile and reference your profiles across platforms\./i)).toBeInTheDocument();+ expect(screen.queryByText(/content learning/i)).not.toBeInTheDocument();+ });+});diff --git a/server/services/socialAccounts.js b/server/services/socialAccounts.jsindex c79504433c..a6c9d2a41e 100644--- a/server/services/socialAccounts.js+++ b/server/services/socialAccounts.js@@ -3,9 +3,9 @@** Manages the user's social media accounts as part of the Digital Twin.* These are the user's OWN accounts (not agent platform accounts) used for:- * - Content ingestion and style learning* - Building a communication profile- * - Reference for content creation+ * - Reference for content creation and profile directory+ * - Future content ingestion and style learning (when supported)* - Future account management automation*/diff --git a/server/services/socialAccounts.tombstone.test.js b/server/services/socialAccounts.tombstone.test.jsindex b2862780c6..0656318fa9 100644--- a/server/services/socialAccounts.tombstone.test.js+++ b/server/services/socialAccounts.tombstone.test.js@@ -24,7 +24,7 @@ vi.mock('../lib/fileUtils.js', async () => {return makePathsProxy(actual, { dataRoot: tempRoot });});-const { createAccount, updateAccount, deleteAccount, getAllAccounts, loadAccounts, invalidateCache } =+const { createAccount, updateAccount, deleteAccount, getAllAccounts, loadAccounts, invalidateCache, getAccountById } =await import('./socialAccounts.js');const { applyDigitalTwinRemote, getDigitalTwinSnapshot, mergeSocialAccounts } = await import('./digital-twin-sync.js');@@ -130,6 +130,22 @@ describe('social account tombstones (#3532)', () => {});expect(await accountIds()).toContain('peer-1');});++ it('preserves existing legacy ingestionEnabled flag when updates omit it (#10061)', async () => {+ const created = await createAccount({+ platform: 'github',+ username: 'legacy-user',+ ingestionEnabled: true+ });+ expect(created.ingestionEnabled).toBe(true);++ const edited = await updateAccount(created.id, { displayName: 'Updated Name', notes: 'Updated notes' });+ expect(edited.displayName).toBe('Updated Name');+ expect(edited.ingestionEnabled).toBe(true);++ const fetched = await getAccountById(created.id);+ expect(fetched.ingestionEnabled).toBe(true);+ });});describe('mergeSocialAccounts tombstone semantics (#3532)', () => {