fix(system): MemorySummaryCard catches its own getEntityStats failure

Sibling RecentFailuresCard already defended against query failure
with `.catch(() => [])`. MemorySummaryCard let getEntityStats throw
straight through Suspense — the most likely root cause of the
/system "Something went wrong" black-box screen that ee6df43 wrapped
with an error.tsx boundary.

Try/catch the query; render a small degraded card when the stats
can't be loaded, explaining the rest of System is unaffected and the
section will refresh on the next page load. Console.error keeps the
postmortem signal even when Vercel logs are unreliable
(pattern_vercel_log_fallback).

Now both server-component Suspense children on /system are isolated
— a failure in either renders a per-card degraded state instead of
falling through to the route-level error boundary. The page itself
stays functional.
This commit is contained in:
g-but committed 2026-05-31 04:09:22 +02:00
1 parent ee6df432b1
commit ef2ceffae8
1 file changed
+25 -1
+25 -1
View File
@@ -7,7 +7,31 @@ import Link from "next/link";
export async function MemorySummaryCard() { export async function MemorySummaryCard() {
const userId = await requirePageUserId(); const userId = await requirePageUserId();
const stats = await getEntityStats(userId); // Match the defensive shape of sibling RecentFailuresCard
// (`getRecentDebugLogs(10).catch(() => [])`). Without this, any
// Neon-side error in getEntityStats propagated past Suspense into
// the route boundary and took the whole /system page down — the
// most likely cause of the "Something went wrong" black-box screen
// ee6df43 caught. Render a degraded card explaining what's missing
// instead of breaking the route. console.error keeps the postmortem
// signal even when Vercel logs are unreliable.
let stats: Awaited<ReturnType<typeof getEntityStats>> | null = null;
try {
stats = await getEntityStats(userId);
} catch (err) {
console.error("[MemorySummaryCard] getEntityStats failed:", err);
}
if (!stats) {
return (
<Card>
<CardHeader icon={Brain} title="Memory" />
<p className="text-sm text-text-tertiary">
Couldn&apos;t load knowledge-graph stats. The rest of System is unaffected; this section will refresh on the next page load.
</p>
</Card>
);
}
return ( return (
<Card> <Card>