TheYuchen commited on
Commit ·
8311ef0
1
Parent(s): 123b5a8
Compare reachability: one hop from where the question arises
Browse files* RunHistory: while exactly one compare checkbox is ticked, a status
chip at the panel top says what completes the gesture ("1 of 2
picked — tick one more run, or A/B a card in Multiverse"); the
first tick used to feed only a tab badge.
* Fidelity card: with >=2 archived runs of the current configuration
the across-runs strip grows a "compare vs previous run" link
(marker compare-vs-previous) setting compareIds to the two latest
run_ids via the new store action setCompareIds — the Evidence
pane's existing length===2 auto-switch takes over.
frontend/src/components/RunHistory.tsx
CHANGED
|
@@ -47,7 +47,7 @@
|
|
| 47 |
// by dimming unrelated rows, nodes and edges.
|
| 48 |
|
| 49 |
import { useEffect, useMemo, useState } from "react";
|
| 50 |
-
import { History, Play, RotateCcw, Trash2 } from "lucide-react";
|
| 51 |
import { useApp } from "../lib/store";
|
| 52 |
import { deleteRun, listRuns, type RunRecord } from "../lib/runStore";
|
| 53 |
import { hashHue, hueCss } from "../lib/hues";
|
|
@@ -404,6 +404,23 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 404 |
{(embedded || open) && (
|
| 405 |
<>
|
| 406 |
{records.some((r) => r.demo) && <DemoArchiveBanner />}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 407 |
<div className={embedded ? "" : "max-h-[320px] overflow-y-auto"}>
|
| 408 |
{/* Relative wrapper: the SVG gutter is absolutely positioned
|
| 409 |
inside the scrolled content, so lineage marks scroll in
|
|
|
|
| 47 |
// by dimming unrelated rows, nodes and edges.
|
| 48 |
|
| 49 |
import { useEffect, useMemo, useState } from "react";
|
| 50 |
+
import { GitCompareArrows, History, Play, RotateCcw, Trash2 } from "lucide-react";
|
| 51 |
import { useApp } from "../lib/store";
|
| 52 |
import { deleteRun, listRuns, type RunRecord } from "../lib/runStore";
|
| 53 |
import { hashHue, hueCss } from "../lib/hues";
|
|
|
|
| 404 |
{(embedded || open) && (
|
| 405 |
<>
|
| 406 |
{records.some((r) => r.demo) && <DemoArchiveBanner />}
|
| 407 |
+
{/* Compare needs TWO runs, but nothing used to acknowledge the
|
| 408 |
+
first checkbox beyond a "1" on a tab the user may never
|
| 409 |
+
look at — the interaction just seemed to do nothing. One
|
| 410 |
+
transient chip closes the loop and names the alternative
|
| 411 |
+
entry point (Multiverse A/B). Disappears at 0 or 2. */}
|
| 412 |
+
{compareIds.length === 1 && (
|
| 413 |
+
<div
|
| 414 |
+
role="status"
|
| 415 |
+
className="mx-2 mt-2 flex items-center gap-1.5 rounded-md border border-accent/40 bg-accent/10 px-2 py-1 text-[10px] text-accent"
|
| 416 |
+
>
|
| 417 |
+
<GitCompareArrows className="w-3 h-3 shrink-0" />
|
| 418 |
+
<span>
|
| 419 |
+
1 of 2 picked — tick one more run to compare, or A/B a
|
| 420 |
+
card in Multiverse.
|
| 421 |
+
</span>
|
| 422 |
+
</div>
|
| 423 |
+
)}
|
| 424 |
<div className={embedded ? "" : "max-h-[320px] overflow-y-auto"}>
|
| 425 |
{/* Relative wrapper: the SVG gutter is absolutely positioned
|
| 426 |
inside the scrolled content, so lineage marks scroll in
|
frontend/src/components/results/cards.tsx
CHANGED
|
@@ -565,6 +565,12 @@ function ReplicateStrip({ currentPoint }: { currentPoint: number }) {
|
|
| 565 |
const configHash = useApp((st) => st.lastConfigHash);
|
| 566 |
const [points, setPoints] = useState<number[]>([]);
|
| 567 |
const [pooled, setPooled] = useState<PooledEvidence | null>(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
|
| 569 |
useEffect(() => {
|
| 570 |
if (!configHash) return;
|
|
@@ -572,6 +578,11 @@ function ReplicateStrip({ currentPoint }: { currentPoint: number }) {
|
|
| 572 |
listRunsByConfig(configHash)
|
| 573 |
.then((rs) => {
|
| 574 |
if (cancelled) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 575 |
setPoints(
|
| 576 |
rs
|
| 577 |
.filter((r) => r.headline_label === "fidelity" && r.headline_value != null)
|
|
@@ -624,6 +635,22 @@ function ReplicateStrip({ currentPoint }: { currentPoint: number }) {
|
|
| 624 |
{pooled.nRuns} runs)
|
| 625 |
</div>
|
| 626 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
</div>
|
| 628 |
);
|
| 629 |
}
|
|
|
|
| 565 |
const configHash = useApp((st) => st.lastConfigHash);
|
| 566 |
const [points, setPoints] = useState<number[]>([]);
|
| 567 |
const [pooled, setPooled] = useState<PooledEvidence | null>(null);
|
| 568 |
+
// The two most recent archived runs of this configuration (oldest →
|
| 569 |
+
// newest pair), fuel for the one-hop compare link below. By the time
|
| 570 |
+
// this card renders, the run it belongs to is already archived
|
| 571 |
+
// (FlowCanvas archives before bumping historyVersion), so "the two
|
| 572 |
+
// latest" is "this run vs its predecessor".
|
| 573 |
+
const [latestPair, setLatestPair] = useState<[string, string] | null>(null);
|
| 574 |
|
| 575 |
useEffect(() => {
|
| 576 |
if (!configHash) return;
|
|
|
|
| 578 |
listRunsByConfig(configHash)
|
| 579 |
.then((rs) => {
|
| 580 |
if (cancelled) return;
|
| 581 |
+
setLatestPair(
|
| 582 |
+
rs.length >= 2
|
| 583 |
+
? [rs[rs.length - 2].run_id, rs[rs.length - 1].run_id]
|
| 584 |
+
: null,
|
| 585 |
+
);
|
| 586 |
setPoints(
|
| 587 |
rs
|
| 588 |
.filter((r) => r.headline_label === "fidelity" && r.headline_value != null)
|
|
|
|
| 635 |
{pooled.nRuns} runs)
|
| 636 |
</div>
|
| 637 |
)}
|
| 638 |
+
{/* One-hop route into the Compare view. Without it, comparison is
|
| 639 |
+
only reachable via two History checkboxes or a Multiverse A/B —
|
| 640 |
+
three panels away from the card that just made the user ask
|
| 641 |
+
"is this different from last time?". Setting both ids at once
|
| 642 |
+
rides the Evidence pane's existing auto-switch to Compare. */}
|
| 643 |
+
{latestPair && (
|
| 644 |
+
<button
|
| 645 |
+
type="button"
|
| 646 |
+
data-marker="compare-vs-previous"
|
| 647 |
+
className="text-[10px] text-accent hover:underline"
|
| 648 |
+
onClick={() => useApp.getState().setCompareIds(latestPair)}
|
| 649 |
+
title="Open the Compare tab with this configuration's two most recent archived runs side by side."
|
| 650 |
+
>
|
| 651 |
+
compare vs previous run of this configuration ↗
|
| 652 |
+
</button>
|
| 653 |
+
)}
|
| 654 |
</div>
|
| 655 |
);
|
| 656 |
}
|
frontend/src/lib/store.ts
CHANGED
|
@@ -182,6 +182,12 @@ interface AppState {
|
|
| 182 |
*/
|
| 183 |
compareIds: string[];
|
| 184 |
toggleCompare: (runId: string) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
clearCompare: () => void;
|
| 186 |
|
| 187 |
health: HealthResponse | null;
|
|
@@ -366,6 +372,7 @@ export const useApp = create<AppState>((set) => ({
|
|
| 366 |
return { compareIds: s.compareIds.filter((x) => x !== runId) };
|
| 367 |
return { compareIds: [...s.compareIds, runId].slice(-2) };
|
| 368 |
}),
|
|
|
|
| 369 |
clearCompare: () => set({ compareIds: [] }),
|
| 370 |
health: null,
|
| 371 |
setHealth: (h) => set({ health: h }),
|
|
|
|
| 182 |
*/
|
| 183 |
compareIds: string[];
|
| 184 |
toggleCompare: (runId: string) => void;
|
| 185 |
+
/** Replace the selection wholesale (max 2 kept). Used by one-hop
|
| 186 |
+
* affordances that KNOW both runs — e.g. the fidelity card's
|
| 187 |
+
* "compare vs previous run of this configuration" link — so the
|
| 188 |
+
* user doesn't have to find and tick two checkboxes. Setting two
|
| 189 |
+
* ids triggers the Evidence pane's auto-switch to Compare. */
|
| 190 |
+
setCompareIds: (ids: string[]) => void;
|
| 191 |
clearCompare: () => void;
|
| 192 |
|
| 193 |
health: HealthResponse | null;
|
|
|
|
| 372 |
return { compareIds: s.compareIds.filter((x) => x !== runId) };
|
| 373 |
return { compareIds: [...s.compareIds, runId].slice(-2) };
|
| 374 |
}),
|
| 375 |
+
setCompareIds: (ids) => set({ compareIds: ids.slice(-2) }),
|
| 376 |
clearCompare: () => set({ compareIds: [] }),
|
| 377 |
health: null,
|
| 378 |
setHealth: (h) => set({ health: h }),
|