TheYuchen commited on
Commit ·
f2fb736
1
Parent(s): dee698c
Evidence pane: compare-selection lifecycle, honest empties, marker clamps
Browse files- pane auto-switch keyed on compareIds identity (pair replacement re-fires)
- compare selection pruned after Clear demo data / archive import;
setCompareIds dedupes; CompareView renders "runs no longer archived"
instead of a silent blank when records are gone
- interval-bar point markers clamp at the 0/1 scale edges (cards clipped
by overflow-hidden; CompareView twins overhung)
- RunHistory restore/replay titles tell uploaded-circuit records' truth
("re-upload to reproduce"); lineage footer names the 50-run window
- PluginFigures bar with data:[] renders a stub instead of crashing the pane
- frontend/src/components/CompareView.tsx +48 -7
- frontend/src/components/PluginFigures.tsx +12 -0
- frontend/src/components/ResultsPane.tsx +5 -1
- frontend/src/components/RunHistory.tsx +29 -5
- frontend/src/components/results/cards.tsx +5 -1
- frontend/src/lib/demoArchive.ts +3 -0
- frontend/src/lib/runStore.ts +20 -0
- frontend/src/lib/store.ts +3 -1
frontend/src/components/CompareView.tsx
CHANGED
|
@@ -187,22 +187,37 @@ export function CompareView() {
|
|
| 187 |
// view kept rendering the deleted run's data.
|
| 188 |
const historyVersion = useApp((s) => s.historyVersion);
|
| 189 |
const [recs, setRecs] = useState<[RunRecord, RunRecord] | null>(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
useEffect(() => {
|
| 192 |
if (compareIds.length !== 2) {
|
| 193 |
setRecs(null);
|
|
|
|
| 194 |
return;
|
| 195 |
}
|
| 196 |
let cancelled = false;
|
| 197 |
Promise.all([getRun(compareIds[0]), getRun(compareIds[1])])
|
| 198 |
.then(([a, b]) => {
|
| 199 |
if (cancelled) return;
|
| 200 |
-
// Either record gone (deleted / IndexedDB hiccup) →
|
| 201 |
-
//
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
})
|
| 204 |
.catch(() => {
|
| 205 |
-
if (!cancelled)
|
|
|
|
|
|
|
|
|
|
| 206 |
});
|
| 207 |
return () => {
|
| 208 |
cancelled = true;
|
|
@@ -215,7 +230,33 @@ export function CompareView() {
|
|
| 215 |
// funnel will actually render.
|
| 216 |
const diffData = useDifferenceEvidence(recs?.[0] ?? null, recs?.[1] ?? null);
|
| 217 |
|
| 218 |
-
if (compareIds.length !== 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
const [A, B] = recs;
|
| 220 |
const diffs = paramDiff(A, B);
|
| 221 |
const fa = fidelityStep(A);
|
|
@@ -346,12 +387,12 @@ export function CompareView() {
|
|
| 346 |
<div className="absolute top-1 h-1.5 bg-accent/30 rounded"
|
| 347 |
style={{ left: `${ciA[0] * 100}%`, width: `${Math.max(0.5, (ciA[1] - ciA[0]) * 100)}%` }} />
|
| 348 |
)}
|
| 349 |
-
<div className="absolute top-0.5 h-2.5 w-0.5 bg-accent" style={{ left: `${va * 100}%` }} title={`A: ${(va * 100).toFixed(2)}%`} />
|
| 350 |
{ciB && (
|
| 351 |
<div className="absolute bottom-1 h-1.5 bg-warn/30 rounded"
|
| 352 |
style={{ left: `${ciB[0] * 100}%`, width: `${Math.max(0.5, (ciB[1] - ciB[0]) * 100)}%` }} />
|
| 353 |
)}
|
| 354 |
-
<div className="absolute bottom-0.5 h-2.5 w-0.5 bg-warn" style={{ left: `${vb * 100}%` }} title={`B: ${(vb * 100).toFixed(2)}%`} />
|
| 355 |
</div>
|
| 356 |
<div className="text-[10px] text-mute font-mono">
|
| 357 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
|
|
|
| 187 |
// view kept rendering the deleted run's data.
|
| 188 |
const historyVersion = useApp((s) => s.historyVersion);
|
| 189 |
const [recs, setRecs] = useState<[RunRecord, RunRecord] | null>(null);
|
| 190 |
+
// Distinguishes "lookup in flight" (render nothing, brief) from
|
| 191 |
+
// "records gone" (render an honest explanation — audit S2: a null
|
| 192 |
+
// return here left the Compare tab silently blank after Clear demo
|
| 193 |
+
// data / delete).
|
| 194 |
+
const [missing, setMissing] = useState(false);
|
| 195 |
|
| 196 |
useEffect(() => {
|
| 197 |
if (compareIds.length !== 2) {
|
| 198 |
setRecs(null);
|
| 199 |
+
setMissing(false);
|
| 200 |
return;
|
| 201 |
}
|
| 202 |
let cancelled = false;
|
| 203 |
Promise.all([getRun(compareIds[0]), getRun(compareIds[1])])
|
| 204 |
.then(([a, b]) => {
|
| 205 |
if (cancelled) return;
|
| 206 |
+
// Either record gone (deleted / IndexedDB hiccup) → say so
|
| 207 |
+
// rather than rendering a stale or half pair.
|
| 208 |
+
if (a && b) {
|
| 209 |
+
setRecs([a, b]);
|
| 210 |
+
setMissing(false);
|
| 211 |
+
} else {
|
| 212 |
+
setRecs(null);
|
| 213 |
+
setMissing(true);
|
| 214 |
+
}
|
| 215 |
})
|
| 216 |
.catch(() => {
|
| 217 |
+
if (!cancelled) {
|
| 218 |
+
setRecs(null);
|
| 219 |
+
setMissing(true);
|
| 220 |
+
}
|
| 221 |
});
|
| 222 |
return () => {
|
| 223 |
cancelled = true;
|
|
|
|
| 230 |
// funnel will actually render.
|
| 231 |
const diffData = useDifferenceEvidence(recs?.[0] ?? null, recs?.[1] ?? null);
|
| 232 |
|
| 233 |
+
if (compareIds.length !== 2) return null;
|
| 234 |
+
if (!recs) {
|
| 235 |
+
if (!missing) return null; // lookup in flight — resolves in ms
|
| 236 |
+
return (
|
| 237 |
+
<div className="panel-alt p-3 space-y-2 border !border-warn/40">
|
| 238 |
+
<div className="flex items-center gap-2">
|
| 239 |
+
<span className="text-xs font-semibold text-ink">
|
| 240 |
+
Comparing two runs
|
| 241 |
+
</span>
|
| 242 |
+
<button
|
| 243 |
+
type="button"
|
| 244 |
+
className="ml-auto p-0.5 text-mute hover:text-ink rounded hover:bg-surfaceAlt"
|
| 245 |
+
onClick={clearCompare}
|
| 246 |
+
aria-label="Clear comparison selection"
|
| 247 |
+
>
|
| 248 |
+
<X className="w-3.5 h-3.5" />
|
| 249 |
+
</button>
|
| 250 |
+
</div>
|
| 251 |
+
<p className="text-[11px] text-mute leading-relaxed">
|
| 252 |
+
The selected runs are no longer archived — they were deleted or
|
| 253 |
+
removed with the demo data. Tick two runs in the{" "}
|
| 254 |
+
<span className="text-ink">“This configuration”</span> tab to
|
| 255 |
+
start a new comparison.
|
| 256 |
+
</p>
|
| 257 |
+
</div>
|
| 258 |
+
);
|
| 259 |
+
}
|
| 260 |
const [A, B] = recs;
|
| 261 |
const diffs = paramDiff(A, B);
|
| 262 |
const fa = fidelityStep(A);
|
|
|
|
| 387 |
<div className="absolute top-1 h-1.5 bg-accent/30 rounded"
|
| 388 |
style={{ left: `${ciA[0] * 100}%`, width: `${Math.max(0.5, (ciA[1] - ciA[0]) * 100)}%` }} />
|
| 389 |
)}
|
| 390 |
+
<div className="absolute top-0.5 h-2.5 w-0.5 bg-accent" style={{ left: `clamp(0px, calc(${va * 100}% - 1px), calc(100% - 2px))` }} title={`A: ${(va * 100).toFixed(2)}%`} />
|
| 391 |
{ciB && (
|
| 392 |
<div className="absolute bottom-1 h-1.5 bg-warn/30 rounded"
|
| 393 |
style={{ left: `${ciB[0] * 100}%`, width: `${Math.max(0.5, (ciB[1] - ciB[0]) * 100)}%` }} />
|
| 394 |
)}
|
| 395 |
+
<div className="absolute bottom-0.5 h-2.5 w-0.5 bg-warn" style={{ left: `clamp(0px, calc(${vb * 100}% - 1px), calc(100% - 2px))` }} title={`B: ${(vb * 100).toFixed(2)}%`} />
|
| 396 |
</div>
|
| 397 |
<div className="text-[10px] text-mute font-mono">
|
| 398 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
frontend/src/components/PluginFigures.tsx
CHANGED
|
@@ -365,6 +365,18 @@ function BarBlock({
|
|
| 365 |
),
|
| 366 |
);
|
| 367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
// Screen-reader friendly summary of the chart. Without this, an
|
| 369 |
// assistive-tech user just hears "Bar chart" and can't interrogate
|
| 370 |
// the actual data. We keep it brief: count, max, top bar.
|
|
|
|
| 365 |
),
|
| 366 |
);
|
| 367 |
|
| 368 |
+
// Empty data guard (audit S2): a plugin returning data: [] made the
|
| 369 |
+
// reduce below crash on top.value and took the whole Evidence pane
|
| 370 |
+
// down with it. Say what happened instead.
|
| 371 |
+
if (data.length === 0) {
|
| 372 |
+
return (
|
| 373 |
+
<div className="text-[11px] text-mute italic">
|
| 374 |
+
Bar figure has no data points (the plugin returned an empty
|
| 375 |
+
list).
|
| 376 |
+
</div>
|
| 377 |
+
);
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
// Screen-reader friendly summary of the chart. Without this, an
|
| 381 |
// assistive-tech user just hears "Bar chart" and can't interrogate
|
| 382 |
// the actual data. We keep it brief: count, max, top bar.
|
frontend/src/components/ResultsPane.tsx
CHANGED
|
@@ -90,9 +90,13 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 90 |
setTab(pendingTab);
|
| 91 |
useApp.getState().setPendingEvidenceTab(null);
|
| 92 |
}, [pendingTab]);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
useEffect(() => {
|
| 94 |
if (compareIds.length === 2) setTab("compare");
|
| 95 |
-
}, [compareIds
|
| 96 |
|
| 97 |
return (
|
| 98 |
<div className="flex-1 flex flex-col min-h-0">
|
|
|
|
| 90 |
setTab(pendingTab);
|
| 91 |
useApp.getState().setPendingEvidenceTab(null);
|
| 92 |
}, [pendingTab]);
|
| 93 |
+
// Keyed on the ARRAY IDENTITY, not .length: one-hop affordances
|
| 94 |
+
// (e.g. "compare vs previous run") replace a 2-element selection
|
| 95 |
+
// with another 2-element selection — a length dep never re-fires
|
| 96 |
+
// and the pane silently stayed on the old tab (audit S2).
|
| 97 |
useEffect(() => {
|
| 98 |
if (compareIds.length === 2) setTab("compare");
|
| 99 |
+
}, [compareIds]);
|
| 100 |
|
| 101 |
return (
|
| 102 |
<div className="flex-1 flex flex-col min-h-0">
|
frontend/src/components/RunHistory.tsx
CHANGED
|
@@ -58,7 +58,7 @@
|
|
| 58 |
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
| 59 |
import { Download, GitCompareArrows, History, KeyRound, Play, RotateCcw, Trash2, Upload, X } from "lucide-react";
|
| 60 |
import { useApp } from "../lib/store";
|
| 61 |
-
import { deleteRun, exportArchive, importArchive, listRuns, type RunRecord } from "../lib/runStore";
|
| 62 |
import { hashHue, hueCss } from "../lib/hues";
|
| 63 |
import { R_MIN, evidenceRadius } from "../lib/evidenceMass";
|
| 64 |
import { runEvidence, wilson95 } from "../lib/stats";
|
|
@@ -588,6 +588,10 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 588 |
const compareIds = useApp((s) => s.compareIds);
|
| 589 |
const toggleCompare = useApp((s) => s.toggleCompare);
|
| 590 |
const [records, setRecords] = useState<RunRecord[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 591 |
const [open, setOpen] = useState(false);
|
| 592 |
const [hoverId, setHoverId] = useState<string | null>(null);
|
| 593 |
|
|
@@ -600,6 +604,13 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 600 |
.catch(() => {
|
| 601 |
/* IndexedDB unavailable (private mode etc.) — panel stays empty */
|
| 602 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 603 |
return () => {
|
| 604 |
cancelled = true;
|
| 605 |
};
|
|
@@ -839,7 +850,11 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 839 |
<button
|
| 840 |
type="button"
|
| 841 |
className="p-0.5 text-mute hover:text-ink rounded hover:bg-surfaceAlt"
|
| 842 |
-
title=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 843 |
aria-label="Restore run"
|
| 844 |
onClick={() => restore(r, false)}
|
| 845 |
>
|
|
@@ -849,9 +864,11 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 849 |
type="button"
|
| 850 |
className="p-0.5 text-mute hover:text-accent rounded hover:bg-surfaceAlt disabled:opacity-30"
|
| 851 |
title={
|
| 852 |
-
r.root_seed
|
| 853 |
-
? "
|
| 854 |
-
:
|
|
|
|
|
|
|
| 855 |
}
|
| 856 |
aria-label="Replay run"
|
| 857 |
disabled={r.root_seed == null}
|
|
@@ -1054,6 +1071,13 @@ cumulative Wilson CI half-width of this configuration's pooled counts, widest (o
|
|
| 1054 |
</svg>
|
| 1055 |
</div>
|
| 1056 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1057 |
</>
|
| 1058 |
)}
|
| 1059 |
</div>
|
|
|
|
| 58 |
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
| 59 |
import { Download, GitCompareArrows, History, KeyRound, Play, RotateCcw, Trash2, Upload, X } from "lucide-react";
|
| 60 |
import { useApp } from "../lib/store";
|
| 61 |
+
import { countRuns, deleteRun, exportArchive, importArchive, listRuns, type RunRecord } from "../lib/runStore";
|
| 62 |
import { hashHue, hueCss } from "../lib/hues";
|
| 63 |
import { R_MIN, evidenceRadius } from "../lib/evidenceMass";
|
| 64 |
import { runEvidence, wilson95 } from "../lib/stats";
|
|
|
|
| 588 |
const compareIds = useApp((s) => s.compareIds);
|
| 589 |
const toggleCompare = useApp((s) => s.toggleCompare);
|
| 590 |
const [records, setRecords] = useState<RunRecord[]>([]);
|
| 591 |
+
// Total archive size — the lineage renders a 50-run window, and a
|
| 592 |
+
// window must SAY it is a window (audit S2: older runs silently
|
| 593 |
+
// vanished from the view with no hint they still exist).
|
| 594 |
+
const [total, setTotal] = useState<number | null>(null);
|
| 595 |
const [open, setOpen] = useState(false);
|
| 596 |
const [hoverId, setHoverId] = useState<string | null>(null);
|
| 597 |
|
|
|
|
| 604 |
.catch(() => {
|
| 605 |
/* IndexedDB unavailable (private mode etc.) — panel stays empty */
|
| 606 |
});
|
| 607 |
+
countRuns()
|
| 608 |
+
.then((n) => {
|
| 609 |
+
if (!cancelled) setTotal(n);
|
| 610 |
+
})
|
| 611 |
+
.catch(() => {
|
| 612 |
+
/* count unavailable — footer simply doesn't render */
|
| 613 |
+
});
|
| 614 |
return () => {
|
| 615 |
cancelled = true;
|
| 616 |
};
|
|
|
|
| 850 |
<button
|
| 851 |
type="button"
|
| 852 |
className="p-0.5 text-mute hover:text-ink rounded hover:bg-surfaceAlt"
|
| 853 |
+
title={
|
| 854 |
+
r.sample_key == null
|
| 855 |
+
? "Restore this run's graph — it used an uploaded circuit; re-upload it on the left to reproduce the numbers"
|
| 856 |
+
: "Restore this run's graph + circuit onto the canvas"
|
| 857 |
+
}
|
| 858 |
aria-label="Restore run"
|
| 859 |
onClick={() => restore(r, false)}
|
| 860 |
>
|
|
|
|
| 864 |
type="button"
|
| 865 |
className="p-0.5 text-mute hover:text-accent rounded hover:bg-surfaceAlt disabled:opacity-30"
|
| 866 |
title={
|
| 867 |
+
r.root_seed == null
|
| 868 |
+
? "This run has no recorded seed (cached response) — plain restore is available."
|
| 869 |
+
: r.sample_key == null
|
| 870 |
+
? "Replay: restore + pin this run's seed — this run used an uploaded circuit; re-upload it on the left to reproduce the exact numbers."
|
| 871 |
+
: "Replay: restore + pin this run's seed. Pressing Run then reproduces the exact numbers."
|
| 872 |
}
|
| 873 |
aria-label="Replay run"
|
| 874 |
disabled={r.root_seed == null}
|
|
|
|
| 1071 |
</svg>
|
| 1072 |
</div>
|
| 1073 |
</div>
|
| 1074 |
+
{total != null && total > records.length && (
|
| 1075 |
+
<div className="px-3 py-1.5 border-t border-edge/40 text-[10px] text-mute">
|
| 1076 |
+
showing the {records.length} most recent of {total} archived
|
| 1077 |
+
runs — older runs stay archived (and exported) even though this
|
| 1078 |
+
lineage view doesn't draw them
|
| 1079 |
+
</div>
|
| 1080 |
+
)}
|
| 1081 |
</>
|
| 1082 |
)}
|
| 1083 |
</div>
|
frontend/src/components/results/cards.tsx
CHANGED
|
@@ -510,7 +510,11 @@ function UncertaintyBlock({
|
|
| 510 |
/>
|
| 511 |
<div
|
| 512 |
className="absolute top-0 h-full w-0.5 bg-accent"
|
| 513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
/>
|
| 515 |
{/* Optional-stopping target rendered as the width the user
|
| 516 |
asked for: two ticks at point ± target. When the interval
|
|
|
|
| 510 |
/>
|
| 511 |
<div
|
| 512 |
className="absolute top-0 h-full w-0.5 bg-accent"
|
| 513 |
+
// clamp: a fidelity of exactly 0/1 must render AT the scale
|
| 514 |
+
// edge, not clipped by overflow-hidden (audit S2)
|
| 515 |
+
style={{
|
| 516 |
+
left: `clamp(0px, calc(${point * 100}% - 1px), calc(100% - 2px))`,
|
| 517 |
+
}}
|
| 518 |
/>
|
| 519 |
{/* Optional-stopping target rendered as the width the user
|
| 520 |
asked for: two ticks at point ± target. When the interval
|
frontend/src/lib/demoArchive.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
| 30 |
countRuns,
|
| 31 |
deleteRun,
|
| 32 |
listRuns,
|
|
|
|
| 33 |
saveRun,
|
| 34 |
} from "./runStore";
|
| 35 |
import { useApp } from "./store";
|
|
@@ -156,5 +157,7 @@ export async function clearDemoRuns(): Promise<void> {
|
|
| 156 |
} catch {
|
| 157 |
/* nothing to clear if the archive is unreadable */
|
| 158 |
}
|
|
|
|
|
|
|
| 159 |
useApp.getState().bumpHistoryVersion();
|
| 160 |
}
|
|
|
|
| 30 |
countRuns,
|
| 31 |
deleteRun,
|
| 32 |
listRuns,
|
| 33 |
+
pruneCompareSelection,
|
| 34 |
saveRun,
|
| 35 |
} from "./runStore";
|
| 36 |
import { useApp } from "./store";
|
|
|
|
| 157 |
} catch {
|
| 158 |
/* nothing to clear if the archive is unreadable */
|
| 159 |
}
|
| 160 |
+
// Deleted demo runs must not stay selected for comparison (audit S2).
|
| 161 |
+
await pruneCompareSelection();
|
| 162 |
useApp.getState().bumpHistoryVersion();
|
| 163 |
}
|
frontend/src/lib/runStore.ts
CHANGED
|
@@ -122,6 +122,25 @@ export function getRun(runId: string): Promise<RunRecord | undefined> {
|
|
| 122 |
return tx("readonly", (s) => s.get(runId)) as Promise<RunRecord | undefined>;
|
| 123 |
}
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
/** Archive size without materializing records — IDBObjectStore.count.
|
| 126 |
* Cheap enough to call on every historyVersion bump (badge material
|
| 127 |
* for the Evidence pane's History tab). */
|
|
@@ -461,5 +480,6 @@ export async function importArchive(file: File): Promise<ImportReport> {
|
|
| 461 |
report.imported += 1;
|
| 462 |
}
|
| 463 |
if (report.imported > 0) useApp.getState().bumpHistoryVersion();
|
|
|
|
| 464 |
return report;
|
| 465 |
}
|
|
|
|
| 122 |
return tx("readonly", (s) => s.get(runId)) as Promise<RunRecord | undefined>;
|
| 123 |
}
|
| 124 |
|
| 125 |
+
/** Drop compare selections whose records no longer resolve (bulk
|
| 126 |
+
* deletions: Clear demo data, archive replacement). Row-level deletes
|
| 127 |
+
* prune inline; this is the sweep for everything else (audit S2).
|
| 128 |
+
* At most two getRun lookups — cheap enough to call after any bulk
|
| 129 |
+
* archive mutation. */
|
| 130 |
+
export async function pruneCompareSelection(): Promise<void> {
|
| 131 |
+
const s = useApp.getState();
|
| 132 |
+
if (s.compareIds.length === 0) return;
|
| 133 |
+
try {
|
| 134 |
+
const alive: string[] = [];
|
| 135 |
+
for (const id of s.compareIds) {
|
| 136 |
+
if (await getRun(id)) alive.push(id);
|
| 137 |
+
}
|
| 138 |
+
if (alive.length !== s.compareIds.length) s.setCompareIds(alive);
|
| 139 |
+
} catch {
|
| 140 |
+
/* archive unreadable — CompareView's missing-record state covers it */
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
/** Archive size without materializing records — IDBObjectStore.count.
|
| 145 |
* Cheap enough to call on every historyVersion bump (badge material
|
| 146 |
* for the Evidence pane's History tab). */
|
|
|
|
| 480 |
report.imported += 1;
|
| 481 |
}
|
| 482 |
if (report.imported > 0) useApp.getState().bumpHistoryVersion();
|
| 483 |
+
await pruneCompareSelection();
|
| 484 |
return report;
|
| 485 |
}
|
frontend/src/lib/store.ts
CHANGED
|
@@ -488,7 +488,9 @@ export const useApp = create<AppState>((set) => ({
|
|
| 488 |
return { compareIds: s.compareIds.filter((x) => x !== runId) };
|
| 489 |
return { compareIds: [...s.compareIds, runId].slice(-2) };
|
| 490 |
}),
|
| 491 |
-
|
|
|
|
|
|
|
| 492 |
clearCompare: () => set({ compareIds: [] }),
|
| 493 |
differenceRunIds: null,
|
| 494 |
setDifferenceRunIds: (ids) =>
|
|
|
|
| 488 |
return { compareIds: s.compareIds.filter((x) => x !== runId) };
|
| 489 |
return { compareIds: [...s.compareIds, runId].slice(-2) };
|
| 490 |
}),
|
| 491 |
+
// Dedupe defensively: a caller passing [x, x] would render a
|
| 492 |
+
// "comparison" of a run with itself.
|
| 493 |
+
setCompareIds: (ids) => set({ compareIds: [...new Set(ids)].slice(-2) }),
|
| 494 |
clearCompare: () => set({ compareIds: [] }),
|
| 495 |
differenceRunIds: null,
|
| 496 |
setDifferenceRunIds: (ids) =>
|