feat(diag): E2EE investigation kit for the KE-1→4 cluster
LOTUS_E2EE_INVESTIGATION.md: per-KE capture runbook (console signatures, synapse log greps + SQL against the documented LXC deployment, the KE-1⇒KE-2 causality decision tree, ranked remediations incl. what a crypto-store reset wipes; SDK finding: stable 41.6.0 has no OTK fix over our RC pin). Client: capture-only console ring buffer (cryptoDiagLog, KE-signature-matched, max 200) + a Crypto Diagnostics card in Developer Tools with a download-report button. ClientRoot installs the capture hook at module load and mounts useSessionSync (cross-tab sessions, prior commit). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
} from '../../../components/AccountDataEditor';
|
||||
import { copyToClipboard } from '../../../utils/dom';
|
||||
import { AccountData } from './AccountData';
|
||||
import { CryptoDiagnostics } from '../developer/CryptoDiagnostics';
|
||||
|
||||
type DeveloperToolsProps = {
|
||||
requestClose: () => void;
|
||||
@@ -109,6 +110,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
/>
|
||||
</SequenceCard>
|
||||
)}
|
||||
{developerTools && <CryptoDiagnostics />}
|
||||
</Box>
|
||||
{developerTools && (
|
||||
<AccountData
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Badge, Box, Button, Text } from 'folds';
|
||||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
import { SequenceCardStyle } from '../styles.css';
|
||||
import { SettingTile } from '../../../components/setting-tile';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { useForceUpdate } from '../../../hooks/useForceUpdate';
|
||||
import { useInterval } from '../../../hooks/useInterval';
|
||||
import { buildCryptoDiagReport, getCryptoDiagEntries } from '../../../utils/cryptoDiagLog';
|
||||
|
||||
// Lotus E2EE investigation kit — Crypto Diagnostics settings card.
|
||||
// Mirrors the surrounding Developer Tools cards (see DevelopTools.tsx).
|
||||
|
||||
const REFRESH_MS = 1000;
|
||||
|
||||
export function CryptoDiagnostics() {
|
||||
const mx = useMatrixClient();
|
||||
// Re-render on a light interval so the live matched-entry count stays fresh
|
||||
// while the settings pane is open.
|
||||
const [, forceUpdate] = useForceUpdate();
|
||||
useInterval(forceUpdate, REFRESH_MS);
|
||||
|
||||
const count = getCryptoDiagEntries().length;
|
||||
|
||||
const handleDownload = useCallback(() => {
|
||||
const report = buildCryptoDiagReport(mx);
|
||||
const blob = new Blob([report], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `lotus-crypto-diag-${new Date().toISOString().replace(/[:.]/g, '-')}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}, [mx]);
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Crypto Diagnostics</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Crypto Diagnostics — captures E2EE error signatures this session"
|
||||
description="Ring-buffers up to 200 matched console warnings/errors for the KE-1..KE-4 bug cluster. Local only — no network calls. The downloaded report includes the matched log lines as evidence."
|
||||
after={
|
||||
<Box alignItems="Center" gap="200" shrink="No">
|
||||
<Badge variant={count > 0 ? 'Critical' : 'Secondary'} fill="Solid" radii="Pill">
|
||||
<Text as="span" size="L400">
|
||||
{count}
|
||||
</Text>
|
||||
</Badge>
|
||||
<Button
|
||||
onClick={handleDownload}
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
size="300"
|
||||
radii="300"
|
||||
outlined
|
||||
>
|
||||
<Text size="B300">Download report</Text>
|
||||
</Button>
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user