A high-performance Android storage analyzer that bypasses MTP using a native C++ daemon, a Rust TCP bridge, and a React Treemap UI.
Rust
Prioritize file browsing space in results layout (#107)
Vishnu Srivatsava8651696d3f68
diff --git a/docs/scan-store.md b/docs/scan-store.mdindex 5f42443..71e2ae7 100644--- a/docs/scan-store.md+++ b/docs/scan-store.md@@ -5,6 +5,10 @@ statistics, the root summary, and a fresh public generation rather than anested tree. Generations use independent random IDs; the daemon's secretsession token never crosses IPC.+Results keep scan statistics compact and show the map beside the scrollable file+list at desktop widths. Narrower windows use a short map above the list.+Diagnostics start collapsed; open **Diagnostics** to inspect the retained log.+`get_scan_view` accepts a generation, revision, node ID and optional cursor.It returns the current node, exact path, breadcrumbs, up to 128 children, andprevious/next cursors. Directory indexes sort by size descending, name, thendiff --git a/src/ResultScreen.tsx b/src/ResultScreen.tsxindex 1e0e0a3..e78ddc1 100644--- a/src/ResultScreen.tsx+++ b/src/ResultScreen.tsx@@ -13,9 +13,9 @@ import { ScanHistory } from "./ScanHistory";function StatCard({ label, value, accent = false }: { label: string; value: string; accent?: boolean }) {return (- <div className="glass-card rounded-xl px-5 py-4 flex flex-col gap-1">- <span className="text-xs font-medium text-zinc-500 uppercase tracking-wider">{label}</span>- <span className={`text-xl font-bold font-mono tracking-tight ${accent ? "text-accent-400" : "text-zinc-100"}`}>+ <div className="glass-card rounded-lg px-3 py-2 flex flex-col gap-0.5">+ <span className="text-[10px] font-medium text-zinc-500 uppercase tracking-wider">{label}</span>+ <span className={`text-lg font-bold font-mono tracking-tight ${accent ? "text-accent-400" : "text-zinc-100"}`}>{value}</span></div>@@ -101,9 +101,9 @@ export function ResultScreen({const breadcrumbs = page?.breadcrumbs ?? [];return (- <div className="flex flex-col h-full animate-fade-in-up">+ <div className="flex flex-col h-full min-h-0 animate-fade-in-up">{/* Top bar */}- <header className="flex items-center justify-between px-6 py-4 border-b border-zinc-800/80 shrink-0">+ <header className="flex items-center justify-between gap-3 px-4 py-2 border-b border-zinc-800/80 shrink-0"><div className="flex items-center gap-3"><div className="w-2 h-2 rounded-full bg-emerald-500 animate-pulse" /><h1 className="text-base font-semibold text-zinc-200 tracking-tight">SocketSweep</h1>@@ -151,23 +151,23 @@ export function ResultScreen({</div></header>- <p id="connected-device" className="px-6 pt-3 text-xs text-zinc-500 break-all">Device: <span className="font-mono">{deviceSerial}</span></p>+ <p id="connected-device" className="px-4 pt-2 text-xs text-zinc-500 break-all">Device: <span className="font-mono">{deviceSerial}</span></p>{data.read_only && (- <div className="px-6 pt-3 text-xs text-accent-300">+ <div className="px-4 pt-2 text-xs text-accent-300">Root access · Read-only · Deletion disabled</div>)}<ScanHistory scope={data} />{/* Stats row */}- <div className="grid grid-cols-2 sm:grid-cols-4 gap-3 px-6 py-4 shrink-0">+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-2 px-4 py-2 shrink-0"><StatCard label="Total Size" value={formatBytes(data.total_size)} accent /><StatCard label="Files" value={data.total_files.toLocaleString("en-US")} /><StatCard label="Directories" value={data.total_dirs.toLocaleString("en-US")} /><StatCard label="Scan Time" value={`${data.scan_time_ms}ms`} /></div>- <div className="flex gap-2 px-6 pb-3 shrink-0" role="group" aria-label="Scan view">+ <div className="flex gap-2 px-4 pb-2 shrink-0" role="group" aria-label="Scan view"><button aria-pressed={mode === "map"} disabled={busy} onClick={() => setMode("map")}className={`px-3 py-2 rounded-lg text-xs ${mode === "map" ? "bg-zinc-700 text-white" : "bg-zinc-900 text-zinc-400"}`}>Storage map</button><button aria-pressed={mode === "largest"} disabled={busy} onClick={() => setMode("largest")}@@ -175,9 +175,9 @@ export function ResultScreen({<button aria-pressed={mode === "types"} disabled={busy} onClick={() => setMode("types")}className={`px-3 py-2 rounded-lg text-xs ${mode === "types" ? "bg-zinc-700 text-white" : "bg-zinc-900 text-zinc-400"}`}>File types</button></div>- {mode === "types" ? <FileTypes scope={data} busy={busy} /> : mode === "largest" ? <LargestFiles scope={data} busy={busy} onZoom={onZoom} onNuke={onNuke} /> : <>+ {mode === "types" ? <FileTypes scope={data} busy={busy} /> : mode === "largest" ? <LargestFiles scope={data} busy={busy} onZoom={onZoom} onNuke={onNuke} /> : <div className="flex-1 min-h-0 grid grid-rows-[7rem_minmax(0,1fr)] md:grid-rows-1 md:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] gap-3 px-4 pb-3">{/* Treemap */}- <div className="px-6 mb-4 shrink-0 h-48">+ <div className="min-h-0 min-w-0"><div className="glass-card rounded-xl p-2 w-full h-full relative group"><ResponsiveContainer width="100%" height="100%"><Treemap@@ -212,9 +212,9 @@ export function ResultScreen({</div>{/* File tree */}- <div className="flex-1 overflow-y-auto px-3 pb-4 min-h-0">+ <section aria-label="Files and folders" className="glass-card rounded-xl overflow-y-auto px-2 pb-3 min-h-0 min-w-0"><div className="flex items-center gap-2 px-3 py-2 mb-1">- <span className="text-xs font-semibold text-zinc-500 uppercase tracking-wider flex-1">Storage Map</span>+ <span className="text-xs font-semibold text-zinc-500 uppercase tracking-wider flex-1">Files and folders</span><span className="text-xs text-zinc-500">{[data.errors > 0 ? `${data.errors} access errors` : "", data.skipped > 0 ? `${data.skipped} excluded or duplicate entries` : ""].filter(Boolean).join(" · ")}</span>@@ -224,8 +224,8 @@ export function ResultScreen({{page && <FileTreeNode node={page.node} scope={data} parentSize={page.node.size} depth={0}onNuke={onNuke} onZoom={onZoom} expanded={expanded} toggle={toggle} busy={busy} rootView={view} />}- </div>- </>}+ </section>+ </div>}</div>);}diff --git a/src/ScanHistory.tsx b/src/ScanHistory.tsxindex b7b2187..4e061f0 100644--- a/src/ScanHistory.tsx+++ b/src/ScanHistory.tsx@@ -53,5 +53,5 @@ export function ScanHistory({ scope }: { scope: ScanResponse }) {} else {text = "Previous-scan comparison unavailable.";}- return <p id="scan-history" role="status" className="px-6 pt-1 text-xs text-zinc-500">{text}</p>;+ return <p id="scan-history" role="status" className="px-4 pt-1 text-xs text-zinc-500">{text}</p>;}diff --git a/src/TerminalLog.tsx b/src/TerminalLog.tsxindex 0efe714..92c4a8d 100644--- a/src/TerminalLog.tsx+++ b/src/TerminalLog.tsx@@ -13,12 +13,17 @@ export function TerminalLog({ history }: { history: LogHistory }) {if (history.entries.length === 0) return null;return (- <section aria-label="Diagnostic log" id="terminal-log"- className="h-32 shrink-0 border-t border-zinc-800 bg-zinc-950 font-mono text-[11px] text-zinc-400 flex flex-col">+ <details aria-label="Diagnostic log" id="terminal-log"+ className="shrink-0 border-t border-zinc-800 bg-zinc-950 font-mono text-[11px] text-zinc-400"+ onToggle={event => { if (event.currentTarget.open) endRef.current?.scrollIntoView({ block: "nearest" }); }}>+ <summary className="cursor-pointer px-4 py-2 select-none focus-visible:outline-2 focus-visible:outline-accent-400">+ Diagnostics+ <span className="ml-3 text-zinc-500">{history.entries.length.toLocaleString("en-US")} entries</span>+ </summary>{history.discarded > 0 && <p id="log-retention-notice" className="m-0 px-4 pt-1 text-zinc-500 shrink-0">Showing recent logs · {history.discarded.toLocaleString("en-US")} older {history.discarded === 1 ? "entry" : "entries"} discarded.</p>}- <div className="flex-1 min-h-0 overflow-y-auto px-4 py-2">+ <div className="h-32 max-h-[25vh] overflow-y-auto px-4 py-2">{history.entries.map((log, i) => (<div key={history.discarded + i} className="log-entry mb-0.5 break-all"><span className="text-accent-500 mr-2">❯</span>@@ -27,6 +32,6 @@ export function TerminalLog({ history }: { history: LogHistory }) {))}<div ref={endRef} /></div>- </section>+ </details>);}diff --git a/tests/log_history_fixture.jsx b/tests/log_history_fixture.jsxindex a6a5931..c7e2c00 100644--- a/tests/log_history_fixture.jsx+++ b/tests/log_history_fixture.jsx@@ -17,6 +17,7 @@ const renderMeasured = async history => {const start = performance.now();root.render(<TerminalLog history={history} />);await waitFor(() => rows().length === history.entries.length, "Log rows missing");+ document.querySelector("#terminal-log").open = true;layout();await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));return performance.now() - start;diff --git a/tests/scan_ui_fixture.js b/tests/scan_ui_fixture.jsindex 88aba6f..ddad75e 100644--- a/tests/scan_ui_fixture.js+++ b/tests/scan_ui_fixture.js@@ -215,7 +215,7 @@const report = (passed, error) => {const output = document.createElement("pre");output.id = "scan-test-report";- output.textContent = JSON.stringify({ fixture: "scan-ui", passed, error, ipc_calls: calls.length, checks: passed ? ["offline fonts under CSP", "bounded collapsed discovery diagnostics", "discovery retry recovery", "setup alignment", "result fonts", "file label semantics", "complete paging", "first-scan comparison", "unchanged comparison after rescan", "deletion delta comparison", "cross-device comparison isolation", "bounded file-type totals", "file-type retry and malformed response", "file-type generation and deletion revision", "file-type coverage and empty scan", "bounded largest files", "late largest response", "largest query retry", "malformed largest response recovery", "largest ID-only deletion", "largest read-only guards", "largest folder navigation without rescanning", "late zoom", "Other tile", "stale confirmation", "ID-only deletion", "revision refresh", "partial failure", "read-only", "acknowledged shutdown", "unconfirmed shutdown", "reconnect", "stop action ordering", "duplicate rescan guard", "rescan failure recovery", "rescan cancellation recovery", "toast dismissal integration", "bounded diagnostic integration"] : undefined });+ output.textContent = JSON.stringify({ fixture: "scan-ui", passed, error, ipc_calls: calls.length, checks: passed ? ["offline fonts under CSP", "bounded collapsed discovery diagnostics", "discovery retry recovery", "setup alignment", "result fonts", "file label semantics", "usable file workspace", "collapsible diagnostics", "complete paging", "first-scan comparison", "unchanged comparison after rescan", "deletion delta comparison", "cross-device comparison isolation", "bounded file-type totals", "file-type retry and malformed response", "file-type generation and deletion revision", "file-type coverage and empty scan", "bounded largest files", "late largest response", "largest query retry", "malformed largest response recovery", "largest ID-only deletion", "largest read-only guards", "largest folder navigation without rescanning", "late zoom", "Other tile", "stale confirmation", "ID-only deletion", "revision refresh", "partial failure", "read-only", "acknowledged shutdown", "unconfirmed shutdown", "reconnect", "stop action ordering", "duplicate rescan guard", "rescan failure recovery", "rescan cancellation recovery", "toast dismissal integration", "bounded diagnostic integration"] : undefined });document.body.append(output);void fetch("/report", { method: "POST", body: output.textContent }).then(() => {if (passed) location.replace("/tests/toast_lifecycle_fixture.html");@@ -310,6 +310,23 @@check(document.documentElement.scrollWidth <= innerWidth, "Results overflow horizontally");check(document.body.textContent.includes("128 entries on this page of 271"), "Missing full entry count");check(!rows().find(item => item.textContent.includes("file-0")).querySelector("button:disabled"), "File label became an unavailable control");+ const fileViewport = document.querySelector('[aria-label="Files and folders"]');+ const fileBounds = fileViewport.getBoundingClientRect();+ check(fileBounds.height >= innerHeight * 0.55, `File browser too short: ${fileBounds.height}px of ${innerHeight}px`);+ check(fileViewport.scrollHeight > fileViewport.clientHeight, "File browser cannot scroll its entries");+ const logDisclosure = document.querySelector("#terminal-log");+ check(logDisclosure.tagName === "DETAILS" && !logDisclosure.open, "Diagnostics did not start collapsed");+ logDisclosure.querySelector("summary").click();+ await waitFor(() => logDisclosure.open, "Diagnostics did not open");+ check(logDisclosure.getBoundingClientRect().height > 100 && logRows[0].getBoundingClientRect().height > 0, "Expanded diagnostics are not readable");+ check(fileViewport.clientHeight >= innerHeight * 0.3, "Expanded diagnostics made files unusable");+ logDisclosure.querySelector("summary").click();+ await waitFor(() => !logDisclosure.open, "Diagnostics did not close");+ check(Math.abs(fileViewport.getBoundingClientRect().height - fileBounds.height) < 2, "Closing diagnostics did not restore browsing space");+ const scrollBefore = fileViewport.scrollTop;+ fileViewport.scrollTop = 200;+ check(fileViewport.scrollTop > scrollBefore, "File list does not scroll independently");+ fileViewport.scrollTop = 0;const scanCount = calls.filter(item => item.command === "run_scan").length;const typesPanel = () => document.querySelector('section[aria-label="File types"]');const typesReady = () => typesPanel()?.querySelector('table[aria-busy="false"]') && !typesPanel().querySelector('[role="alert"]');