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: wrap the Trust Panel header stats so a phone viewport stops scrolling sideways (#3527)

[._.]/ Adam Eivy07ae3fd0d10b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 621a5634f9..421d9bdd2e 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -140,3 +140,5 @@
- **[issue-3516] Applying an AI-suggested goal hierarchy no longer reports success when it failed.** The routine that writes the suggestion back — creating the new north-star goal, creating the sub-goals under it, then re-parenting everything else — already gave up and reported failure the moment any of those steps was rejected by the server, but both views that call it threw that answer away and showed "Goal hierarchy applied" regardless. So a run that created nothing at all still looked like it had worked, and the list you were staring at kept showing the old arrangement. Both the list and the tree view now say so when the apply fails, and both refresh the goals afterwards either way, because a failure can still have created part of the hierarchy before aborting and leaving that half-written state off screen was the actual complaint. The apply routine swallows each server error on purpose so it can report one clean yes-or-no, so it now also asks those calls to stay quiet — otherwise the failure would have surfaced as two error toasts stacked on top of each other.
- **[issue-3530] Deleting a Digital Twin document no longer leaves it to be resurrected by your other machines.** Peer sync merged the identity documents add-only: whichever machine still had the file put its metadata entry back into `meta.json` and re-wrote the `.md` on disk, so a document you deleted came back on the next sync cycle, every cycle, forever. A delete now records a tombstone on the document's filename, and those tombstones union in both directions — so the machine that still holds the document drops its entry and removes the file, instead of the deleting machine merely defending itself while the peer keeps re-sending. Filename is the key rather than the document id because ids are minted per install and the same document can carry a different one on each machine. Deleting is not permanent in the way a naive tombstone would make it: a document created — or edited — after the delete records a stamp that supersedes the tombstone, which is then dropped, so re-creating a document you removed (by hand, or by an enrichment session regenerating its target) works and survives a peer that has not seen the re-create yet, and an edit you made on one machine is not silently destroyed by a delete another machine performed before that edit. Those two stamps are the one part of a document's entry that is not add-only — each machine takes the newer of its own and its peer's — so a machine holding a stale copy cannot keep a third machine's older delete alive against a document that has since come back. A peer running an older build simply ignores the new field and keeps offering its copy; the upgraded machine still refuses it, so nothing is corrupted while the two versions differ.
+
+- **[issue-3527] The Brain Trust Panel no longer scrolls sideways on a phone.** Its header put the title block and the five audit counters — Total, Filed, Review, Corrected, Errors — on one row that was not allowed to wrap, so on a 375px screen the counters ran off the right edge and dragged the whole page's horizontal scrollbar with them. The title and the counters now stack under `sm` and re-join from `sm` up, the counters wrap among themselves, and the status-filter row wraps too so its Refresh button cannot spill off screen either. Every counter stays visible without scrolling; the desktop layout is unchanged.
diff --git a/client/src/components/brain/tabs/TrustTab.jsx b/client/src/components/brain/tabs/TrustTab.jsx
index 661a4bab40..25e46bc293 100644
--- a/client/src/components/brain/tabs/TrustTab.jsx
+++ b/client/src/components/brain/tabs/TrustTab.jsx
@@ -81,16 +81,16 @@ export default function TrustTab({ onRefresh }) {
return (
<div className="space-y-6">
{/* Header with stats */}
- <div className="flex items-center justify-between">
+ <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
<div className="flex items-center gap-3">
- <Shield className="w-6 h-6 text-port-accent" />
- <div>
+ <Shield className="w-6 h-6 text-port-accent shrink-0" />
+ <div className="min-w-0">
<h2 className="text-lg font-semibold text-white">Trust Panel</h2>
<p className="text-sm text-gray-500">Audit trail and system settings</p>
</div>
</div>
- <div className="flex items-center gap-4 text-sm">
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm">
<span className="text-gray-500">Total: {counts.total || 0}</span>
<span className="text-port-success">Filed: {counts.filed || 0}</span>
<span className="text-port-warning">Review: {counts.needs_review || 0}</span>
@@ -207,7 +207,7 @@ export default function TrustTab({ onRefresh }) {
</div>
{/* Filters */}
- <div className="flex items-center gap-4">
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
<span className="text-sm text-gray-500">Filter by status:</span>
<select
value={statusFilter}
diff --git a/client/src/components/brain/tabs/TrustTab.test.jsx b/client/src/components/brain/tabs/TrustTab.test.jsx
new file mode 100644
index 0000000000..40d2a4ffce
--- /dev/null
+++ b/client/src/components/brain/tabs/TrustTab.test.jsx
@@ -0,0 +1,77 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, act } from '@testing-library/react';
+
+// ── Mock toast ────────────────────────────────────────────────────────────────
+const mockToast = vi.hoisted(() => Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn() }));
+vi.mock('../../ui/Toast', () => ({ default: mockToast }));
+
+// ── Mock API ──────────────────────────────────────────────────────────────────
+const api = vi.hoisted(() => ({
+ getBrainInbox: vi.fn(),
+ getBrainSettings: vi.fn(),
+ updateBrainSettings: vi.fn(),
+}));
+vi.mock('../../../services/api', () => api);
+
+const TrustTab = (await import('./TrustTab')).default;
+
+const COUNTS = { total: 128, filed: 96, needs_review: 18, corrected: 12, error: 2 };
+
+const renderTab = async () => {
+ const result = render(<TrustTab />);
+ // Flush the mount fetches (inbox + settings).
+ await act(async () => {});
+ return result;
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ api.getBrainInbox.mockResolvedValue({ entries: [], counts: COUNTS });
+ api.getBrainSettings.mockResolvedValue({
+ confidenceThreshold: 0.6,
+ dailyDigestTime: '09:00',
+ weeklyReviewDay: 'sunday',
+ weeklyReviewTime: '16:00',
+ defaultProvider: 'lmstudio',
+ });
+});
+
+// The header laid the title block and 5 stat counters out as one non-wrapping
+// row, which pushed the counters past a 375px viewport and forced the page body
+// to scroll horizontally (#3527). jsdom has no layout engine, so these assert
+// the structure that makes the row wrap rather than measured pixel widths.
+describe('TrustTab mobile header', () => {
+ const stats = () => screen.getByText(/^Total:/).parentElement;
+
+ it('stacks the title block above the stats under sm and re-joins them from sm up', async () => {
+ await renderTab();
+ const header = stats().parentElement;
+
+ expect(header.className).toContain('flex-col');
+ expect(header.className).toContain('sm:flex-row');
+ expect(header.children).toHaveLength(2);
+ });
+
+ it('wraps the stat counters instead of overflowing the row', async () => {
+ await renderTab();
+
+ expect(stats().className).toContain('flex-wrap');
+ });
+
+ it('keeps all five counters rendered and readable', async () => {
+ await renderTab();
+
+ expect(screen.getByText('Total: 128')).toBeInTheDocument();
+ expect(screen.getByText('Filed: 96')).toBeInTheDocument();
+ expect(screen.getByText('Review: 18')).toBeInTheDocument();
+ expect(screen.getByText('Corrected: 12')).toBeInTheDocument();
+ expect(screen.getByText('Errors: 2')).toBeInTheDocument();
+ });
+
+ it('wraps the status-filter row so the Refresh button never spills off screen', async () => {
+ await renderTab();
+ const filters = screen.getByText('Filter by status:').parentElement;
+
+ expect(filters.className).toContain('flex-wrap');
+ });
+});