Evidence pane S3 sweep: honest numbers, reachable tooltips, keyboard tabs
Browse filesAudit backlog wave 3, evidence area:
- dedupeDraws keys on (root_seed, shots, successes) [approved]: only
a bit-exact repetition of the whole draw is dropped — the same seed
with a different stopping point executed different measurements and
now pools as new evidence. Node-lane assertions added; F8
demo-archive numbers verified unchanged.
- Sparkline stops flattening sub-unit series (QuCAD loss traces);
divide-by-zero guard only fires on a truly flat trace
- KvRow never prints "[object Object]" (nested objects/arrays
JSON-stringify, truncated); viz fmt + CircuitDiff gateDiffOf
unexported (dead exports)
- QuBound/QuCAD NaN payloads render as absent ("—"), not "NaN" tiles;
Qshot's headline fidelity joins the % convention (formula + pilot
table keep the author's raw-unit notation); CI line tabular-nums
- fidelity histogram says what it hides ("+k more outcomes · n shots
not listed"); ReplicateStrip excludes errored runs, highlights the
newest matching dot with an epsilon (not float ===), clamps 0/1
dots to the scale edges
- TransformationSignature: width floor applied before the side
offset, so a tiny negative op delta no longer paints on the
positive half
- CompareView: divergence marker survives a 1-row shared prefix; A/B
chips show the date for non-today runs (full timestamp in
tooltip); 2px interval markers get 10px hover targets
- DifferenceFunnel: annotation flip widths use the shared
estimateTextW on the actual strings (no more 340/350px guesses);
sub-100-shot spans get axis ticks; a pair switch drops the previous
pair's trace instead of rendering it under the new chips
- PluginFigures: sandboxed iframes get the host's theme tokens
(plugin SVGs were black-on-dark); formatCell keeps tiny non-zeros
(3e-5 printed as "0"); bar labels truncate to the actual bar pitch
with full-label tooltips
- ResultsPane tabs: aria-controls + roving tabindex + arrow/Home/End
keys; the figure-export camera hides on tabs with nothing to export
- RunHistory: delete asks before destroying the only copy; unreadable
IndexedDB is distinguished from an empty archive; lineage dots are
focusable (focus mirrors hover highlight); certainty-funnel wording
stops claiming widest = oldest
- hashHue collision odds disclosed; RunStatusChips 9px exception
documented
- frontend/scripts/check_difference_funnel.test.ts +26 -1
- frontend/src/components/CircuitDiff.tsx +3 -1
- frontend/src/components/CompareView.tsx +34 -6
- frontend/src/components/DifferenceFunnel.tsx +34 -9
- frontend/src/components/PluginFigures.tsx +36 -3
- frontend/src/components/ResultsPane.tsx +44 -3
- frontend/src/components/RunHistory.tsx +47 -9
- frontend/src/components/RunStatusChips.tsx +5 -1
- frontend/src/components/TransformationSignature.tsx +6 -2
- frontend/src/components/results/cards.tsx +69 -15
- frontend/src/components/results/viz.tsx +28 -9
- frontend/src/lib/hues.ts +7 -1
- frontend/src/lib/stats.ts +11 -5
|
@@ -13,7 +13,9 @@
|
|
| 13 |
// zero (lo > 0 and hi < 0), chronological ordering, unequal run
|
| 14 |
// counts (the shorter side stops growing) and unequal
|
| 15 |
// shots-per-run (512-shot side vs 2048-shot side pool on counts);
|
| 16 |
-
// 3. replay dedup:
|
|
|
|
|
|
|
| 17 |
// 4. the scenario-F8 numbers, derived from src/data/demoArchive.json
|
| 18 |
// ITSELF (not hardcoded groupings), so the scenarios.ts comment,
|
| 19 |
// docs/EVIDENCE_WORKBENCH.md and the bundled data cannot drift.
|
|
@@ -143,6 +145,29 @@ const ev = (
|
|
| 143 |
assert.equal(t[t.length - 1].shotsA, 1024);
|
| 144 |
// Unknown seeds are never deduped — no proof they repeat a draw.
|
| 145 |
assert.equal(dedupeDraws([ev(1, 1, 10, null), ev(2, 1, 10, null)]).length, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
}
|
| 147 |
|
| 148 |
// -- 4. scenario F8: the bundled demo archive -----------------------------------
|
|
|
|
| 13 |
// zero (lo > 0 and hi < 0), chronological ordering, unequal run
|
| 14 |
// counts (the shorter side stops growing) and unequal
|
| 15 |
// shots-per-run (512-shot side vs 2048-shot side pool on counts);
|
| 16 |
+
// 3. replay dedup: bit-exact replays (same root_seed AND same
|
| 17 |
+
// shots/successes) pooled once; the same seed with a different
|
| 18 |
+
// stopping point survives (it executed different measurements);
|
| 19 |
// 4. the scenario-F8 numbers, derived from src/data/demoArchive.json
|
| 20 |
// ITSELF (not hardcoded groupings), so the scenarios.ts comment,
|
| 21 |
// docs/EVIDENCE_WORKBENCH.md and the bundled data cannot drift.
|
|
|
|
| 145 |
assert.equal(t[t.length - 1].shotsA, 1024);
|
| 146 |
// Unknown seeds are never deduped — no proof they repeat a draw.
|
| 147 |
assert.equal(dedupeDraws([ev(1, 1, 10, null), ev(2, 1, 10, null)]).length, 2);
|
| 148 |
+
// (root_seed, shots, successes) key — audit S3 (approved): the same
|
| 149 |
+
// seed with a DIFFERENT stopping point (early-stopped replay: fewer
|
| 150 |
+
// shots) is new evidence and must survive the dedupe; only a
|
| 151 |
+
// bit-exact repetition of the whole draw collapses.
|
| 152 |
+
assert.equal(
|
| 153 |
+
dedupeDraws([ev(1, 240, 512, 7), ev(2, 120, 256, 7)]).length,
|
| 154 |
+
2,
|
| 155 |
+
"same seed, different shots (early stop) kept",
|
| 156 |
+
);
|
| 157 |
+
assert.equal(
|
| 158 |
+
dedupeDraws([ev(1, 240, 512, 7), ev(2, 241, 512, 7)]).length,
|
| 159 |
+
2,
|
| 160 |
+
"same seed+shots, different successes kept (defensive)",
|
| 161 |
+
);
|
| 162 |
+
assert.equal(
|
| 163 |
+
dedupeDraws([
|
| 164 |
+
ev(1, 240, 512, 7),
|
| 165 |
+
ev(2, 240, 512, 7),
|
| 166 |
+
ev(3, 240, 512, 7),
|
| 167 |
+
]).length,
|
| 168 |
+
1,
|
| 169 |
+
"bit-exact replays collapse to one",
|
| 170 |
+
);
|
| 171 |
}
|
| 172 |
|
| 173 |
// -- 4. scenario F8: the bundled demo archive -----------------------------------
|
|
@@ -30,7 +30,9 @@ export interface GateDiffPayload {
|
|
| 30 |
n_added?: number;
|
| 31 |
}
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
t: TransformationPayload | null | undefined,
|
| 35 |
): GateDiffPayload | null {
|
| 36 |
const g = (t as unknown as Record<string, unknown> | null | undefined)
|
|
|
|
| 30 |
n_added?: number;
|
| 31 |
}
|
| 32 |
|
| 33 |
+
// Module-local since audit S3 (the export was dead — the card is the
|
| 34 |
+
// only consumer).
|
| 35 |
+
function gateDiffOf(
|
| 36 |
t: TransformationPayload | null | undefined,
|
| 37 |
): GateDiffPayload | null {
|
| 38 |
const g = (t as unknown as Record<string, unknown> | null | undefined)
|
|
@@ -52,6 +52,15 @@ interface StepPair {
|
|
| 52 |
b: StepResult | undefined;
|
| 53 |
}
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
/** One aligned step row. `divergence` marks the first row where the
|
| 56 |
* two compositions part ways — accent left border + tiny label, so
|
| 57 |
* the eye lands exactly where the evidence starts. */
|
|
@@ -311,9 +320,12 @@ export function CompareView() {
|
|
| 311 |
if (!sameSignature(a, b)) break;
|
| 312 |
prefixLen++;
|
| 313 |
}
|
| 314 |
-
|
|
|
|
|
|
|
| 315 |
const divergenceIdx =
|
| 316 |
prefixLen > 0 && prefixLen < rows.length ? prefixLen : -1;
|
|
|
|
| 317 |
|
| 318 |
return (
|
| 319 |
<div className="panel-alt p-3 space-y-2 border !border-accent/40">
|
|
@@ -323,8 +335,15 @@ export function CompareView() {
|
|
| 323 |
overflow-x-hidden aside. */}
|
| 324 |
<div className="flex flex-wrap items-center gap-2 gap-y-1">
|
| 325 |
<span className="text-xs font-semibold text-ink">Comparing two runs</span>
|
| 326 |
-
|
| 327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
{A.config_hash === B.config_hash ? (
|
| 329 |
<span className="chip !border-ok/40 !text-ok" title="Identical circuit + graph + params — any metric difference is run-to-run variation (shot noise, training stochasticity).">
|
| 330 |
same configuration — differences are noise
|
|
@@ -387,12 +406,19 @@ export function CompareView() {
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
|
|
|
|
|
| 396 |
</div>
|
| 397 |
<div className="text-[10px] text-mute font-mono">
|
| 398 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
|
@@ -469,7 +495,9 @@ export function CompareView() {
|
|
| 469 |
<CompareRow
|
| 470 |
key={prefixLen + i}
|
| 471 |
pair={pair}
|
| 472 |
-
|
|
|
|
|
|
|
| 473 |
/>
|
| 474 |
))}
|
| 475 |
</tbody>
|
|
|
|
| 52 |
b: StepResult | undefined;
|
| 53 |
}
|
| 54 |
|
| 55 |
+
/** Chip timestamp: time-only for today's runs, date + time otherwise
|
| 56 |
+
* (audit S3 — cross-day pairs looked minutes apart). */
|
| 57 |
+
function fmtWhen(t: number): string {
|
| 58 |
+
const d = new Date(t);
|
| 59 |
+
if (d.toDateString() === new Date().toDateString())
|
| 60 |
+
return d.toLocaleTimeString();
|
| 61 |
+
return `${d.toLocaleDateString()} ${d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
/** One aligned step row. `divergence` marks the first row where the
|
| 65 |
* two compositions part ways — accent left border + tiny label, so
|
| 66 |
* the eye lands exactly where the evidence starts. */
|
|
|
|
| 320 |
if (!sameSignature(a, b)) break;
|
| 321 |
prefixLen++;
|
| 322 |
}
|
| 323 |
+
// Marker before fold decision (audit S3): zeroing prefixLen for
|
| 324 |
+
// fold economy also erased the divergence marker whenever the
|
| 325 |
+
// shared prefix was a single row.
|
| 326 |
const divergenceIdx =
|
| 327 |
prefixLen > 0 && prefixLen < rows.length ? prefixLen : -1;
|
| 328 |
+
if (prefixLen < 2) prefixLen = 0; // folding a single row saves nothing
|
| 329 |
|
| 330 |
return (
|
| 331 |
<div className="panel-alt p-3 space-y-2 border !border-accent/40">
|
|
|
|
| 335 |
overflow-x-hidden aside. */}
|
| 336 |
<div className="flex flex-wrap items-center gap-2 gap-y-1">
|
| 337 |
<span className="text-xs font-semibold text-ink">Comparing two runs</span>
|
| 338 |
+
{/* Date shown whenever a run is not from today (audit S3):
|
| 339 |
+
bare times made "14:02 vs 14:07" from different days read
|
| 340 |
+
as five minutes apart. Full timestamp in the tooltip. */}
|
| 341 |
+
<span className="chip" title={new Date(A.created_at).toLocaleString()}>
|
| 342 |
+
A · {fmtWhen(A.created_at)}
|
| 343 |
+
</span>
|
| 344 |
+
<span className="chip" title={new Date(B.created_at).toLocaleString()}>
|
| 345 |
+
B · {fmtWhen(B.created_at)}
|
| 346 |
+
</span>
|
| 347 |
{A.config_hash === B.config_hash ? (
|
| 348 |
<span className="chip !border-ok/40 !text-ok" title="Identical circuit + graph + params — any metric difference is run-to-run variation (shot noise, training stochasticity).">
|
| 349 |
same configuration — differences are noise
|
|
|
|
| 406 |
<div className="absolute top-1 h-1.5 bg-accent/30 rounded"
|
| 407 |
style={{ left: `${ciA[0] * 100}%`, width: `${Math.max(0.5, (ciA[1] - ciA[0]) * 100)}%` }} />
|
| 408 |
)}
|
| 409 |
+
{/* 2px marks are unhoverable — a transparent 10px-wide
|
| 410 |
+
wrapper carries the tooltip (audit S3); the values are
|
| 411 |
+
also spelled out in the readout line below. */}
|
| 412 |
+
<div className="absolute top-0 h-3.5 w-2.5 flex justify-center" style={{ left: `clamp(0px, calc(${va * 100}% - 5px), calc(100% - 10px))` }} title={`A: ${(va * 100).toFixed(2)}%`}>
|
| 413 |
+
<div className="h-full w-0.5 bg-accent mt-0.5" style={{ height: "10px" }} />
|
| 414 |
+
</div>
|
| 415 |
{ciB && (
|
| 416 |
<div className="absolute bottom-1 h-1.5 bg-warn/30 rounded"
|
| 417 |
style={{ left: `${ciB[0] * 100}%`, width: `${Math.max(0.5, (ciB[1] - ciB[0]) * 100)}%` }} />
|
| 418 |
)}
|
| 419 |
+
<div className="absolute bottom-0 h-3.5 w-2.5 flex items-end justify-center" style={{ left: `clamp(0px, calc(${vb * 100}% - 5px), calc(100% - 10px))` }} title={`B: ${(vb * 100).toFixed(2)}%`}>
|
| 420 |
+
<div className="w-0.5 bg-warn mb-0.5" style={{ height: "10px" }} />
|
| 421 |
+
</div>
|
| 422 |
</div>
|
| 423 |
<div className="text-[10px] text-mute font-mono">
|
| 424 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
|
|
|
| 495 |
<CompareRow
|
| 496 |
key={prefixLen + i}
|
| 497 |
pair={pair}
|
| 498 |
+
// Absolute row position, not "first rendered row": with
|
| 499 |
+
// a 1-row unfolded prefix the divergence is row 1.
|
| 500 |
+
divergence={prefixLen + i === divergenceIdx}
|
| 501 |
/>
|
| 502 |
))}
|
| 503 |
</tbody>
|
|
@@ -129,6 +129,8 @@ export function useDifferenceEvidence(
|
|
| 129 |
// CompareView re-looks-up its pair on historyVersion bumps).
|
| 130 |
const historyVersion = useApp((s) => s.historyVersion);
|
| 131 |
const [data, setData] = useState<DifferenceData>(null);
|
|
|
|
|
|
|
| 132 |
const aId = a?.run_id ?? null;
|
| 133 |
const bId = b?.run_id ?? null;
|
| 134 |
const aHash = a?.config_hash ?? null;
|
|
@@ -145,6 +147,15 @@ export function useDifferenceEvidence(
|
|
| 145 |
setData(null);
|
| 146 |
return;
|
| 147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
if (aHash === bHash) {
|
| 149 |
setData({ status: "same-config" });
|
| 150 |
return;
|
|
@@ -247,9 +258,11 @@ const fmtK = (n: number) =>
|
|
| 247 |
const fmtDpp = (v: number, dp = 1) =>
|
| 248 |
`${v > 0 ? "+" : ""}${(v * 100).toFixed(dp)}pp`;
|
| 249 |
|
| 250 |
-
/** Round-valued shot ticks, ≤ ~7 over the span.
|
|
|
|
|
|
|
| 251 |
function shotTickStep(span: number): number {
|
| 252 |
-
for (const s of [100, 200, 500, 1000, 2000, 2500, 5000, 10000, 25000, 50000])
|
| 253 |
if (span / s <= 6.5) return s;
|
| 254 |
return 100000;
|
| 255 |
}
|
|
@@ -327,11 +340,23 @@ function Chart({
|
|
| 327 |
: "rgb(var(--color-warn))";
|
| 328 |
// Flip the established label to the left of its line when the text
|
| 329 |
// would run into the right readout column (same flip rule as the
|
| 330 |
-
// theater's stop annotation).
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
const
|
| 334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
|
| 336 |
// Right-margin readout: one block, clamped into the plot band.
|
| 337 |
const finalHalf = (final.hi - final.lo) / 2;
|
|
@@ -526,7 +551,7 @@ function Chart({
|
|
| 526 |
fontWeight={600}
|
| 527 |
fill={estColor}
|
| 528 |
>
|
| 529 |
-
|
| 530 |
<title>{GLOSSARY.established}</title>
|
| 531 |
</text>
|
| 532 |
</g>
|
|
@@ -551,7 +576,7 @@ function Chart({
|
|
| 551 |
fontWeight={600}
|
| 552 |
fill="rgb(var(--color-warn))"
|
| 553 |
>
|
| 554 |
-
|
| 555 |
<title>{GLOSSARY.established}</title>
|
| 556 |
</text>
|
| 557 |
</g>
|
|
|
|
| 129 |
// CompareView re-looks-up its pair on historyVersion bumps).
|
| 130 |
const historyVersion = useApp((s) => s.historyVersion);
|
| 131 |
const [data, setData] = useState<DifferenceData>(null);
|
| 132 |
+
// Pair identity last staged — see the stale-trace guard below.
|
| 133 |
+
const pairKeyRef = useRef<string | null>(null);
|
| 134 |
const aId = a?.run_id ?? null;
|
| 135 |
const bId = b?.run_id ?? null;
|
| 136 |
const aHash = a?.config_hash ?? null;
|
|
|
|
| 147 |
setData(null);
|
| 148 |
return;
|
| 149 |
}
|
| 150 |
+
// Pair switch: drop the PREVIOUS pair's trace immediately instead
|
| 151 |
+
// of letting it render under the new pair's chips while the
|
| 152 |
+
// archive fetch resolves (audit S3). historyVersion bumps keep the
|
| 153 |
+
// old trace up (same pair, refreshed data — no flash).
|
| 154 |
+
const pairKey = `${aHash}|${bHash}`;
|
| 155 |
+
if (pairKeyRef.current !== pairKey) {
|
| 156 |
+
pairKeyRef.current = pairKey;
|
| 157 |
+
setData(null);
|
| 158 |
+
}
|
| 159 |
if (aHash === bHash) {
|
| 160 |
setData({ status: "same-config" });
|
| 161 |
return;
|
|
|
|
| 258 |
const fmtDpp = (v: number, dp = 1) =>
|
| 259 |
`${v > 0 ? "+" : ""}${(v * 100).toFixed(dp)}pp`;
|
| 260 |
|
| 261 |
+
/** Round-valued shot ticks, ≤ ~7 over the span. Sub-100 candidates
|
| 262 |
+
* (audit S3): a pair of small pilot runs spans <100 shots, and the
|
| 263 |
+
* old 100-minimum step rendered a tickless axis for them. */
|
| 264 |
function shotTickStep(span: number): number {
|
| 265 |
+
for (const s of [5, 10, 20, 25, 50, 100, 200, 500, 1000, 2000, 2500, 5000, 10000, 25000, 50000])
|
| 266 |
if (span / s <= 6.5) return s;
|
| 267 |
return 100000;
|
| 268 |
}
|
|
|
|
| 340 |
: "rgb(var(--color-warn))";
|
| 341 |
// Flip the established label to the left of its line when the text
|
| 342 |
// would run into the right readout column (same flip rule as the
|
| 343 |
+
// theater's stop annotation). Widths come from the shared estimator
|
| 344 |
+
// measuring the ACTUAL label at its font size — audit S3: the old
|
| 345 |
+
// hardcoded 340/350px guesses drifted from the strings they guarded.
|
| 346 |
+
const estLabel =
|
| 347 |
+
est != null
|
| 348 |
+
? `difference established at ${fmtShots(est.shots)} shots — Δ${fmtDpp(est.d, 1)} [${fmtDpp(est.lo, 1)}, ${fmtDpp(est.hi, 1)}]`
|
| 349 |
+
: "";
|
| 350 |
+
const estFlip =
|
| 351 |
+
est != null &&
|
| 352 |
+
x(est.shots) + 8 + estimateTextW(estLabel.length, 10.5) > w - M.r;
|
| 353 |
+
const lostLabel =
|
| 354 |
+
lost != null
|
| 355 |
+
? `re-includes 0 at ${fmtShots(lost.shots)} shots — not sustained, treat as inconclusive`
|
| 356 |
+
: "";
|
| 357 |
+
const lostFlip =
|
| 358 |
+
lost != null &&
|
| 359 |
+
x(lost.shots) - 8 - estimateTextW(lostLabel.length, 10.5) < M.l;
|
| 360 |
|
| 361 |
// Right-margin readout: one block, clamped into the plot band.
|
| 362 |
const finalHalf = (final.hi - final.lo) / 2;
|
|
|
|
| 551 |
fontWeight={600}
|
| 552 |
fill={estColor}
|
| 553 |
>
|
| 554 |
+
{estLabel}
|
| 555 |
<title>{GLOSSARY.established}</title>
|
| 556 |
</text>
|
| 557 |
</g>
|
|
|
|
| 576 |
fontWeight={600}
|
| 577 |
fill="rgb(var(--color-warn))"
|
| 578 |
>
|
| 579 |
+
{lostLabel}
|
| 580 |
<title>{GLOSSARY.established}</title>
|
| 581 |
</text>
|
| 582 |
</g>
|
|
@@ -318,6 +318,10 @@ function formatCell(c: string | number | boolean | null): string {
|
|
| 318 |
if (c === null || c === undefined) return "—";
|
| 319 |
if (typeof c === "number") {
|
| 320 |
if (Number.isInteger(c)) return String(c);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
return c.toFixed(4).replace(/\.?0+$/, "");
|
| 322 |
}
|
| 323 |
if (typeof c === "boolean") return c ? "true" : "false";
|
|
@@ -459,7 +463,12 @@ function BarBlock({
|
|
| 459 |
fillOpacity="0.65"
|
| 460 |
textAnchor="middle"
|
| 461 |
>
|
| 462 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
</text>
|
| 464 |
</g>
|
| 465 |
);
|
|
@@ -504,12 +513,36 @@ function SvgBlock({ content }: { content: string }) {
|
|
| 504 |
// Wrap in minimal HTML so the iframe knows it's rendering SVG.
|
| 505 |
// body padding 0 + neutral background matches the rest of the card.
|
| 506 |
const srcdoc = useMemo(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
const css = `
|
| 508 |
-
html,body{margin:0;padding:0;background:transparent
|
| 509 |
body{overflow:auto;max-width:100%}
|
| 510 |
svg{max-width:100%;height:auto;display:block}
|
| 511 |
`;
|
| 512 |
-
return `<!doctype html><html><head><meta charset="utf-8"><style>${css}</style></head><body>${content}</body></html>`;
|
| 513 |
}, [content]);
|
| 514 |
// Try to extract an aspect ratio from the SVG's viewBox attribute so
|
| 515 |
// the iframe gets a sensible height proportional to its content.
|
|
|
|
| 318 |
if (c === null || c === undefined) return "—";
|
| 319 |
if (typeof c === "number") {
|
| 320 |
if (Number.isInteger(c)) return String(c);
|
| 321 |
+
// Tiny non-zeros go scientific (same convention as the results
|
| 322 |
+
// pane's fmt) — audit S3: toFixed(4) turned 3e-5 into "0.0000",
|
| 323 |
+
// which the zero-strip then printed as a flat "0".
|
| 324 |
+
if (c !== 0 && Math.abs(c) < 1e-3) return c.toExponential(2);
|
| 325 |
return c.toFixed(4).replace(/\.?0+$/, "");
|
| 326 |
}
|
| 327 |
if (typeof c === "boolean") return c ? "true" : "false";
|
|
|
|
| 463 |
fillOpacity="0.65"
|
| 464 |
textAnchor="middle"
|
| 465 |
>
|
| 466 |
+
{/* Pitch-aware truncation (audit S3): a fixed 10-char
|
| 467 |
+
cut overlapped neighbours at every bar width (9px
|
| 468 |
+
chars ≈ 5.5px vs a 20-42px pitch). Full label in the
|
| 469 |
+
tooltip. */}
|
| 470 |
+
{truncate(d.label, Math.max(3, Math.floor((barW + barGap) / 5.5)))}
|
| 471 |
+
<title>{d.label}</title>
|
| 472 |
</text>
|
| 473 |
</g>
|
| 474 |
);
|
|
|
|
| 513 |
// Wrap in minimal HTML so the iframe knows it's rendering SVG.
|
| 514 |
// body padding 0 + neutral background matches the rest of the card.
|
| 515 |
const srcdoc = useMemo(() => {
|
| 516 |
+
// Theme-token bridge (audit S3): a sandboxed iframe inherits
|
| 517 |
+
// NOTHING from the host document, so `color:inherit` resolved to
|
| 518 |
+
// browser-default black and plugin SVGs using currentColor /
|
| 519 |
+
// var(--color-*) vanished on dark themes. Snapshot the host's
|
| 520 |
+
// tokens into the iframe's :root. (Snapshot is taken per srcdoc
|
| 521 |
+
// build; a live theme switch updates it on the next re-render.)
|
| 522 |
+
let tokenCss = "";
|
| 523 |
+
try {
|
| 524 |
+
const cs = getComputedStyle(document.documentElement);
|
| 525 |
+
const names = [
|
| 526 |
+
"ink", "mute", "edge", "surface", "surfaceAlt", "canvas",
|
| 527 |
+
"accent", "accent2", "accent3", "accent4", "ok", "warn", "danger",
|
| 528 |
+
];
|
| 529 |
+
const vars = names
|
| 530 |
+
.map((t) => {
|
| 531 |
+
const v = cs.getPropertyValue(`--color-${t}`).trim();
|
| 532 |
+
return v ? `--color-${t}:${v};` : "";
|
| 533 |
+
})
|
| 534 |
+
.join("");
|
| 535 |
+
const ink = cs.getPropertyValue("--color-ink").trim();
|
| 536 |
+
tokenCss = `:root{${vars}}body{color:${ink ? `rgb(${ink})` : "inherit"}}`;
|
| 537 |
+
} catch {
|
| 538 |
+
/* non-browser env (tests) — tokens just absent */
|
| 539 |
+
}
|
| 540 |
const css = `
|
| 541 |
+
html,body{margin:0;padding:0;background:transparent}
|
| 542 |
body{overflow:auto;max-width:100%}
|
| 543 |
svg{max-width:100%;height:auto;display:block}
|
| 544 |
`;
|
| 545 |
+
return `<!doctype html><html><head><meta charset="utf-8"><style>${css}${tokenCss}</style></head><body>${content}</body></html>`;
|
| 546 |
}, [content]);
|
| 547 |
// Try to extract an aspect ratio from the SVG's viewBox attribute so
|
| 548 |
// the iframe gets a sensible height proportional to its content.
|
|
@@ -104,8 +104,15 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 104 |
<h3 className="text-sm font-semibold text-ink truncate">Evidence</h3>
|
| 105 |
<div className="flex items-center gap-1.5 shrink-0">
|
| 106 |
{/* Paper-figure export of the active evidence tab (hybrid
|
| 107 |
-
path: cards/funnel/lineage/compare as shown).
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
<FigureExportButton
|
| 110 |
getTarget={() => contentRef.current}
|
| 111 |
name={`evidence-${tab}`}
|
|
@@ -167,14 +174,33 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 167 |
className="shrink-0 border-b border-edge px-2 py-1.5 flex flex-wrap items-center gap-1"
|
| 168 |
role="tablist"
|
| 169 |
aria-label="Evidence views"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
>
|
| 171 |
<TabButton
|
|
|
|
| 172 |
label="This run"
|
| 173 |
title="Scale 1 — steer a single estimate: one card per pipeline step; the funnel card expands into the Evidence Theater"
|
| 174 |
active={tab === "current"}
|
| 175 |
onClick={() => setTab("current")}
|
| 176 |
/>
|
| 177 |
<TabButton
|
|
|
|
| 178 |
label="This configuration"
|
| 179 |
title="Scale 2 — pool replicates of one configuration: every archived run as a lineage; restore, replay (exact numbers), tick two to compare"
|
| 180 |
active={tab === "history"}
|
|
@@ -182,6 +208,7 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 182 |
badge={archived > 0 ? archived : null}
|
| 183 |
/>
|
| 184 |
<TabButton
|
|
|
|
| 185 |
label="Between configurations"
|
| 186 |
title="Scale 3 — compare configurations: two runs side by side as 95% intervals, plus the difference funnel (sequential A/B)"
|
| 187 |
active={tab === "compare"}
|
|
@@ -201,7 +228,13 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 201 |
{tab === "compare" &&
|
| 202 |
"Scale 3 — two configurations side by side; the difference interval carries the verdict"}
|
| 203 |
</div>
|
| 204 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
{tab === "current" && (
|
| 206 |
<>
|
| 207 |
{!run && !running && <EmptyHint />}
|
|
@@ -227,12 +260,15 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
|
|
| 227 |
}
|
| 228 |
|
| 229 |
function TabButton({
|
|
|
|
| 230 |
label,
|
| 231 |
title,
|
| 232 |
active,
|
| 233 |
onClick,
|
| 234 |
badge = null,
|
| 235 |
}: {
|
|
|
|
|
|
|
| 236 |
label: string;
|
| 237 |
title?: string;
|
| 238 |
active: boolean;
|
|
@@ -243,7 +279,12 @@ function TabButton({
|
|
| 243 |
<button
|
| 244 |
type="button"
|
| 245 |
role="tab"
|
|
|
|
|
|
|
| 246 |
aria-selected={active}
|
|
|
|
|
|
|
|
|
|
| 247 |
title={title}
|
| 248 |
onClick={onClick}
|
| 249 |
className={`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs transition-colors border ${
|
|
|
|
| 104 |
<h3 className="text-sm font-semibold text-ink truncate">Evidence</h3>
|
| 105 |
<div className="flex items-center gap-1.5 shrink-0">
|
| 106 |
{/* Paper-figure export of the active evidence tab (hybrid
|
| 107 |
+
path: cards/funnel/lineage/compare as shown). Gated per
|
| 108 |
+
tab on that tab actually having content (audit S3: the
|
| 109 |
+
old gate offered the camera over an empty lineage or a
|
| 110 |
+
"pick two runs" placeholder). */}
|
| 111 |
+
{(tab === "current"
|
| 112 |
+
? run != null
|
| 113 |
+
: tab === "history"
|
| 114 |
+
? archived > 0
|
| 115 |
+
: compareIds.length === 2) && (
|
| 116 |
<FigureExportButton
|
| 117 |
getTarget={() => contentRef.current}
|
| 118 |
name={`evidence-${tab}`}
|
|
|
|
| 174 |
className="shrink-0 border-b border-edge px-2 py-1.5 flex flex-wrap items-center gap-1"
|
| 175 |
role="tablist"
|
| 176 |
aria-label="Evidence views"
|
| 177 |
+
// Arrow-key tab navigation (audit S3): roving focus follows
|
| 178 |
+
// selection, Home/End jump. tabIndex roves via TabButton.
|
| 179 |
+
onKeyDown={(e) => {
|
| 180 |
+
const order: EvidenceTab[] = ["current", "history", "compare"];
|
| 181 |
+
const i = order.indexOf(tab);
|
| 182 |
+
let next: EvidenceTab | null = null;
|
| 183 |
+
if (e.key === "ArrowRight") next = order[(i + 1) % order.length];
|
| 184 |
+
else if (e.key === "ArrowLeft")
|
| 185 |
+
next = order[(i + order.length - 1) % order.length];
|
| 186 |
+
else if (e.key === "Home") next = order[0];
|
| 187 |
+
else if (e.key === "End") next = order[order.length - 1];
|
| 188 |
+
if (next) {
|
| 189 |
+
e.preventDefault();
|
| 190 |
+
setTab(next);
|
| 191 |
+
document.getElementById(`evtab-${next}`)?.focus();
|
| 192 |
+
}
|
| 193 |
+
}}
|
| 194 |
>
|
| 195 |
<TabButton
|
| 196 |
+
tabKey="current"
|
| 197 |
label="This run"
|
| 198 |
title="Scale 1 — steer a single estimate: one card per pipeline step; the funnel card expands into the Evidence Theater"
|
| 199 |
active={tab === "current"}
|
| 200 |
onClick={() => setTab("current")}
|
| 201 |
/>
|
| 202 |
<TabButton
|
| 203 |
+
tabKey="history"
|
| 204 |
label="This configuration"
|
| 205 |
title="Scale 2 — pool replicates of one configuration: every archived run as a lineage; restore, replay (exact numbers), tick two to compare"
|
| 206 |
active={tab === "history"}
|
|
|
|
| 208 |
badge={archived > 0 ? archived : null}
|
| 209 |
/>
|
| 210 |
<TabButton
|
| 211 |
+
tabKey="compare"
|
| 212 |
label="Between configurations"
|
| 213 |
title="Scale 3 — compare configurations: two runs side by side as 95% intervals, plus the difference funnel (sequential A/B)"
|
| 214 |
active={tab === "compare"}
|
|
|
|
| 228 |
{tab === "compare" &&
|
| 229 |
"Scale 3 — two configurations side by side; the difference interval carries the verdict"}
|
| 230 |
</div>
|
| 231 |
+
<div
|
| 232 |
+
ref={contentRef}
|
| 233 |
+
role="tabpanel"
|
| 234 |
+
id={`evpanel-${tab}`}
|
| 235 |
+
aria-labelledby={`evtab-${tab}`}
|
| 236 |
+
className="flex-1 overflow-y-auto p-3 space-y-3 min-h-0"
|
| 237 |
+
>
|
| 238 |
{tab === "current" && (
|
| 239 |
<>
|
| 240 |
{!run && !running && <EmptyHint />}
|
|
|
|
| 260 |
}
|
| 261 |
|
| 262 |
function TabButton({
|
| 263 |
+
tabKey,
|
| 264 |
label,
|
| 265 |
title,
|
| 266 |
active,
|
| 267 |
onClick,
|
| 268 |
badge = null,
|
| 269 |
}: {
|
| 270 |
+
/** Stable tab id — pairs the tab with its panel (aria-controls). */
|
| 271 |
+
tabKey: string;
|
| 272 |
label: string;
|
| 273 |
title?: string;
|
| 274 |
active: boolean;
|
|
|
|
| 279 |
<button
|
| 280 |
type="button"
|
| 281 |
role="tab"
|
| 282 |
+
id={`evtab-${tabKey}`}
|
| 283 |
+
aria-controls={`evpanel-${tabKey}`}
|
| 284 |
aria-selected={active}
|
| 285 |
+
// Roving tabindex: the tablist exposes ONE tab stop; arrows move
|
| 286 |
+
// within it (handler on the tablist).
|
| 287 |
+
tabIndex={active ? 0 : -1}
|
| 288 |
title={title}
|
| 289 |
onClick={onClick}
|
| 290 |
className={`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs transition-colors border ${
|
|
@@ -157,7 +157,9 @@ interface Layout {
|
|
| 157 |
/** Wave J: per-run node radius (evidence mass). */
|
| 158 |
radius: Map<string, number>;
|
| 159 |
/** Wave J: one cumulative-certainty funnel per replicate band with
|
| 160 |
-
* ≥2 binomial runs. `pts` run oldest
|
|
|
|
|
|
|
| 161 |
funnels: {
|
| 162 |
x: number;
|
| 163 |
hue: number;
|
|
@@ -592,6 +594,8 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 592 |
// window, and a window must SAY it is a window (audit S2: older runs
|
| 593 |
// silently 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 |
|
|
@@ -605,7 +609,10 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 605 |
if (!cancelled) setRecords(rs);
|
| 606 |
})
|
| 607 |
.catch(() => {
|
| 608 |
-
/
|
|
|
|
|
|
|
|
|
|
| 609 |
});
|
| 610 |
countRuns()
|
| 611 |
.then((n) => {
|
|
@@ -633,10 +640,22 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 633 |
exactly where a handed-off archive file arrives. */}
|
| 634 |
<ArchiveIO count={0} />
|
| 635 |
<div className="p-4 text-[12px] text-mute leading-relaxed">
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
</div>
|
| 641 |
</div>
|
| 642 |
) : null;
|
|
@@ -885,6 +904,16 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 885 |
title="Delete this record"
|
| 886 |
aria-label="Delete run record"
|
| 887 |
onClick={() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 888 |
void deleteRun(r.run_id).then(() => {
|
| 889 |
const st = useApp.getState();
|
| 890 |
// A deleted run must not stay selected for
|
|
@@ -972,7 +1001,7 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
|
|
| 972 |
>
|
| 973 |
<title>
|
| 974 |
{`pooled ±${(newest.hw * 100).toFixed(1)}pp after ${newest.nRuns} runs / ${newest.shots} shots (exact replays counted once)
|
| 975 |
-
cumulative Wilson CI half-width of this configuration's pooled counts, widest
|
| 976 |
</title>
|
| 977 |
</polygon>
|
| 978 |
</g>
|
|
@@ -1056,15 +1085,24 @@ cumulative Wilson CI half-width of this configuration's pooled counts, widest (o
|
|
| 1056 |
/>
|
| 1057 |
</>
|
| 1058 |
)}
|
| 1059 |
-
{/* oversized invisible hit-target: tooltip +
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1060 |
<circle
|
| 1061 |
cx={pos.x}
|
| 1062 |
cy={pos.y}
|
| 1063 |
r={Math.max(9, rad + RING_PAD + 2.5)}
|
| 1064 |
fill="transparent"
|
| 1065 |
-
|
|
|
|
|
|
|
|
|
|
| 1066 |
onMouseEnter={() => enter(rec.run_id)}
|
| 1067 |
onMouseLeave={() => leave(rec.run_id)}
|
|
|
|
|
|
|
| 1068 |
>
|
| 1069 |
<title>{nodeTitle(rec)}</title>
|
| 1070 |
</circle>
|
|
|
|
| 157 |
/** Wave J: per-run node radius (evidence mass). */
|
| 158 |
radius: Map<string, number>;
|
| 159 |
/** Wave J: one cumulative-certainty funnel per replicate band with
|
| 160 |
+
* ≥2 binomial runs. `pts` run oldest → newest. (The WIDEST row is
|
| 161 |
+
* usually, not always, the oldest: pooling can nudge p̂ toward ½
|
| 162 |
+
* and briefly widen the interval — scaling keys on the widest.) */
|
| 163 |
funnels: {
|
| 164 |
x: number;
|
| 165 |
hue: number;
|
|
|
|
| 594 |
// window, and a window must SAY it is a window (audit S2: older runs
|
| 595 |
// silently vanished from the view with no hint they still exist).
|
| 596 |
const [total, setTotal] = useState<number | null>(null);
|
| 597 |
+
// Archive read failed (≠ empty archive) — drives an honest message.
|
| 598 |
+
const [archiveError, setArchiveError] = useState(false);
|
| 599 |
const [open, setOpen] = useState(false);
|
| 600 |
const [hoverId, setHoverId] = useState<string | null>(null);
|
| 601 |
|
|
|
|
| 609 |
if (!cancelled) setRecords(rs);
|
| 610 |
})
|
| 611 |
.catch(() => {
|
| 612 |
+
// IndexedDB unavailable (private mode, blocked storage): say
|
| 613 |
+
// so — an unreadable archive must not masquerade as an empty
|
| 614 |
+
// one (audit S3).
|
| 615 |
+
if (!cancelled) setArchiveError(true);
|
| 616 |
});
|
| 617 |
countRuns()
|
| 618 |
.then((n) => {
|
|
|
|
| 640 |
exactly where a handed-off archive file arrives. */}
|
| 641 |
<ArchiveIO count={0} />
|
| 642 |
<div className="p-4 text-[12px] text-mute leading-relaxed">
|
| 643 |
+
{archiveError ? (
|
| 644 |
+
<>
|
| 645 |
+
The run archive can't be read in this browser (private
|
| 646 |
+
browsing or blocked storage). Runs still execute, but
|
| 647 |
+
nothing can be archived, restored or compared until
|
| 648 |
+
storage is available.
|
| 649 |
+
</>
|
| 650 |
+
) : (
|
| 651 |
+
<>
|
| 652 |
+
No archived runs yet. Every run is archived here
|
| 653 |
+
automatically, seed included — run the pipeline once and
|
| 654 |
+
it will appear, ready to restore, replay (exact numbers),
|
| 655 |
+
or compare. Or import an archive file exported from
|
| 656 |
+
another device.
|
| 657 |
+
</>
|
| 658 |
+
)}
|
| 659 |
</div>
|
| 660 |
</div>
|
| 661 |
) : null;
|
|
|
|
| 904 |
title="Delete this record"
|
| 905 |
aria-label="Delete run record"
|
| 906 |
onClick={() => {
|
| 907 |
+
// Only copy of the evidence (audit S3): a
|
| 908 |
+
// single click destroyed it with no undo.
|
| 909 |
+
// Blocking confirm = the palette's plugin-
|
| 910 |
+
// delete idiom.
|
| 911 |
+
if (
|
| 912 |
+
!window.confirm(
|
| 913 |
+
"Delete this run record? This browser holds the only copy — export the archive first if you might need it.",
|
| 914 |
+
)
|
| 915 |
+
)
|
| 916 |
+
return;
|
| 917 |
void deleteRun(r.run_id).then(() => {
|
| 918 |
const st = useApp.getState();
|
| 919 |
// A deleted run must not stay selected for
|
|
|
|
| 1001 |
>
|
| 1002 |
<title>
|
| 1003 |
{`pooled ±${(newest.hw * 100).toFixed(1)}pp after ${newest.nRuns} runs / ${newest.shots} shots (exact replays counted once)
|
| 1004 |
+
cumulative Wilson CI half-width of this configuration's pooled counts, widest row scaled to ${FUNNEL_MAX_PX}px (usually the oldest — pooling isn't strictly monotone) — the funnel narrowing upward is certainty accumulating across replicate runs (same motif as the fidelity card's funnel, where shot batches accumulate inside one run)`}
|
| 1005 |
</title>
|
| 1006 |
</polygon>
|
| 1007 |
</g>
|
|
|
|
| 1085 |
/>
|
| 1086 |
</>
|
| 1087 |
)}
|
| 1088 |
+
{/* oversized invisible hit-target: tooltip +
|
| 1089 |
+
lineage hover. Keyboard parity (audit S3):
|
| 1090 |
+
focusable, focus mirrors hover so the lineage
|
| 1091 |
+
highlight is reachable without a pointer; the
|
| 1092 |
+
title doubles as the accessible name. */}
|
| 1093 |
<circle
|
| 1094 |
cx={pos.x}
|
| 1095 |
cy={pos.y}
|
| 1096 |
r={Math.max(9, rad + RING_PAD + 2.5)}
|
| 1097 |
fill="transparent"
|
| 1098 |
+
tabIndex={0}
|
| 1099 |
+
role="img"
|
| 1100 |
+
aria-label={nodeTitle(rec)}
|
| 1101 |
+
style={{ pointerEvents: "auto", outline: "none" }}
|
| 1102 |
onMouseEnter={() => enter(rec.run_id)}
|
| 1103 |
onMouseLeave={() => leave(rec.run_id)}
|
| 1104 |
+
onFocus={() => enter(rec.run_id)}
|
| 1105 |
+
onBlur={() => leave(rec.run_id)}
|
| 1106 |
>
|
| 1107 |
<title>{nodeTitle(rec)}</title>
|
| 1108 |
</circle>
|
|
@@ -11,7 +11,11 @@ import type { StepResult } from "../lib/api";
|
|
| 11 |
*
|
| 12 |
* Two visual variants:
|
| 13 |
* * `tile` — compact 9px text + tight padding for the canvas tile
|
| 14 |
-
* (QNode's result strip).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
* * `card` — the global `.chip` pill used in the right pane card
|
| 16 |
* (ResultsPane's step header).
|
| 17 |
*
|
|
|
|
| 11 |
*
|
| 12 |
* Two visual variants:
|
| 13 |
* * `tile` — compact 9px text + tight padding for the canvas tile
|
| 14 |
+
* (QNode's result strip). 9px is a DELIBERATE exception to the
|
| 15 |
+
* app's 10px type floor (audit S3: documented, not drift): the
|
| 16 |
+
* chips are single-word statuses whose meaning the border color
|
| 17 |
+
* already carries, and at 10px they collide with the tile's
|
| 18 |
+
* metric text at the default canvas zoom.
|
| 19 |
* * `card` — the global `.chip` pill used in the right pane card
|
| 20 |
* (ResultsPane's step header).
|
| 21 |
*
|
|
@@ -390,6 +390,10 @@ export function SignatureCard({ step }: { step: StepResult }) {
|
|
| 390 |
// largest |op delta| in THIS step (op counts are only
|
| 391 |
// comparable within a step, unlike the channel strip)
|
| 392 |
const pct = (Math.abs(d) / opMax) * 50;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
return (
|
| 394 |
<div
|
| 395 |
key={op}
|
|
@@ -406,8 +410,8 @@ export function SignatureCard({ step }: { step: StepResult }) {
|
|
| 406 |
d < 0 ? "bg-ok/80" : "bg-warn/80"
|
| 407 |
}`}
|
| 408 |
style={{
|
| 409 |
-
left: d < 0 ? `${50 -
|
| 410 |
-
width: `${
|
| 411 |
}}
|
| 412 |
/>
|
| 413 |
</div>
|
|
|
|
| 390 |
// largest |op delta| in THIS step (op counts are only
|
| 391 |
// comparable within a step, unlike the channel strip)
|
| 392 |
const pct = (Math.abs(d) / opMax) * 50;
|
| 393 |
+
// Width floor BEFORE the side offset (audit S3): floors
|
| 394 |
+
// applied at render time pushed a tiny negative bar across
|
| 395 |
+
// the centerline onto the positive side.
|
| 396 |
+
const wPct = Math.max(pct, 2);
|
| 397 |
return (
|
| 398 |
<div
|
| 399 |
key={op}
|
|
|
|
| 410 |
d < 0 ? "bg-ok/80" : "bg-warn/80"
|
| 411 |
}`}
|
| 412 |
style={{
|
| 413 |
+
left: d < 0 ? `${50 - wPct}%` : "50%",
|
| 414 |
+
width: `${wPct}%`,
|
| 415 |
}}
|
| 416 |
/>
|
| 417 |
</div>
|
|
@@ -58,7 +58,10 @@ export function StepBody({ step }: { step: StepResult }) {
|
|
| 58 |
/** QuBound — predicted error bound in [0, 1] + lay explanation. */
|
| 59 |
function QuBoundCard({ s }: { s: Record<string, unknown> }) {
|
| 60 |
const raw = s["predicted_error_bound"];
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
const source = String(s["source"] ?? "");
|
| 63 |
|
| 64 |
return (
|
|
@@ -125,7 +128,13 @@ function QuCADCard({ s }: { s: Record<string, unknown> }) {
|
|
| 125 |
<Stat label="removed" value={`${removed}`} sub={`${pct.toFixed(0)}%`} />
|
| 126 |
<Stat
|
| 127 |
label="final loss"
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
/>
|
| 130 |
</div>
|
| 131 |
)}
|
|
@@ -228,8 +237,15 @@ function QshotCard({ s }: { s: Record<string, unknown> }) {
|
|
| 228 |
/>
|
| 229 |
<Stat
|
| 230 |
label="predicted fidelity"
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
/>
|
| 234 |
<Stat label="method" value={methodLabel} />
|
| 235 |
</div>
|
|
@@ -437,14 +453,22 @@ function UncertaintyBlock({
|
|
| 437 |
shotsRequested?: number;
|
| 438 |
}) {
|
| 439 |
const [lo, hi] = ci;
|
| 440 |
-
const
|
|
|
|
| 441 |
const maxCount = entries.length > 0 ? entries[0][1] : 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
const ppTarget =
|
| 443 |
precisionTarget != null ? (precisionTarget * 100).toFixed(0) : null;
|
| 444 |
return (
|
| 445 |
<div className="panel-alt p-2 space-y-2">
|
| 446 |
<div className="flex items-center justify-between text-[10px] text-mute">
|
| 447 |
-
<span title={GLOSSARY.ci}>
|
| 448 |
95% interval: {(lo * 100).toFixed(1)}–{(hi * 100).toFixed(1)}% ·{" "}
|
| 449 |
{successes}/{shots} measurements hit the ideal outcome
|
| 450 |
</span>
|
|
@@ -562,6 +586,15 @@ function UncertaintyBlock({
|
|
| 562 |
<span className="font-mono text-mute w-8 text-right">{count}</span>
|
| 563 |
</div>
|
| 564 |
))}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
</div>
|
| 566 |
)}
|
| 567 |
</div>
|
|
@@ -597,7 +630,16 @@ function ReplicateStrip({ currentPoint }: { currentPoint: number }) {
|
|
| 597 |
);
|
| 598 |
setPoints(
|
| 599 |
rs
|
| 600 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
.map((r) => r.headline_value as number),
|
| 602 |
);
|
| 603 |
// Wave J: pool the archived replicates' binomial counts —
|
|
@@ -638,14 +680,26 @@ function ReplicateStrip({ currentPoint }: { currentPoint: number }) {
|
|
| 638 |
{(max * 100).toFixed(1)}%
|
| 639 |
</div>
|
| 640 |
<div className="relative h-4 rounded bg-surfaceAlt" aria-hidden>
|
| 641 |
-
{points.map((p, i) =>
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 649 |
</div>
|
| 650 |
{pooled && (
|
| 651 |
<div
|
|
|
|
| 58 |
/** QuBound — predicted error bound in [0, 1] + lay explanation. */
|
| 59 |
function QuBoundCard({ s }: { s: Record<string, unknown> }) {
|
| 60 |
const raw = s["predicted_error_bound"];
|
| 61 |
+
// Number.isFinite: a NaN payload must render as the absent state,
|
| 62 |
+
// not a "NaN" tile with a confident explanation under it (audit S3).
|
| 63 |
+
const value =
|
| 64 |
+
typeof raw === "number" && Number.isFinite(raw) ? raw : undefined;
|
| 65 |
const source = String(s["source"] ?? "");
|
| 66 |
|
| 67 |
return (
|
|
|
|
| 128 |
<Stat label="removed" value={`${removed}`} sub={`${pct.toFixed(0)}%`} />
|
| 129 |
<Stat
|
| 130 |
label="final loss"
|
| 131 |
+
// "—", not "NaN": a missing/broken payload is an absent
|
| 132 |
+
// value, not a number (audit S3).
|
| 133 |
+
value={
|
| 134 |
+
Number.isFinite(numOr(s["final_loss"], NaN))
|
| 135 |
+
? numOr(s["final_loss"], NaN).toFixed(4)
|
| 136 |
+
: "—"
|
| 137 |
+
}
|
| 138 |
/>
|
| 139 |
</div>
|
| 140 |
)}
|
|
|
|
| 237 |
/>
|
| 238 |
<Stat
|
| 239 |
label="predicted fidelity"
|
| 240 |
+
// House convention: fidelities read as percentages
|
| 241 |
+
// everywhere else (cards, board, funnels) — a bare 0-1
|
| 242 |
+
// 4-decimal here made the same quantity look like a
|
| 243 |
+
// different one (audit S3). The α-formula line and pilot
|
| 244 |
+
// table below keep the author's raw-unit notation.
|
| 245 |
+
value={Number.isFinite(fid) ? `${(fid * 100).toFixed(2)}%` : "—"}
|
| 246 |
+
sub={
|
| 247 |
+
Number.isFinite(std) ? `± ${(std * 100).toFixed(2)}pp` : undefined
|
| 248 |
+
}
|
| 249 |
/>
|
| 250 |
<Stat label="method" value={methodLabel} />
|
| 251 |
</div>
|
|
|
|
| 453 |
shotsRequested?: number;
|
| 454 |
}) {
|
| 455 |
const [lo, hi] = ci;
|
| 456 |
+
const allEntries = Object.entries(countsTop).sort((a, b) => b[1] - a[1]);
|
| 457 |
+
const entries = allEntries.slice(0, 6);
|
| 458 |
const maxCount = entries.length > 0 ? entries[0][1] : 1;
|
| 459 |
+
// Honest truncation (audit S3): the histogram shows the top 6
|
| 460 |
+
// outcomes; say what it hides. counts_top may itself be a server-
|
| 461 |
+
// side top-N, so the shot arithmetic (not the entry count) is the
|
| 462 |
+
// reliable signal.
|
| 463 |
+
const hiddenOutcomes = allEntries.length - entries.length;
|
| 464 |
+
const shownShots = entries.reduce((a, [, c]) => a + c, 0);
|
| 465 |
+
const hiddenShots = Math.max(0, shots - shownShots);
|
| 466 |
const ppTarget =
|
| 467 |
precisionTarget != null ? (precisionTarget * 100).toFixed(0) : null;
|
| 468 |
return (
|
| 469 |
<div className="panel-alt p-2 space-y-2">
|
| 470 |
<div className="flex items-center justify-between text-[10px] text-mute">
|
| 471 |
+
<span title={GLOSSARY.ci} className="tabular-nums">
|
| 472 |
95% interval: {(lo * 100).toFixed(1)}–{(hi * 100).toFixed(1)}% ·{" "}
|
| 473 |
{successes}/{shots} measurements hit the ideal outcome
|
| 474 |
</span>
|
|
|
|
| 586 |
<span className="font-mono text-mute w-8 text-right">{count}</span>
|
| 587 |
</div>
|
| 588 |
))}
|
| 589 |
+
{hiddenShots > 0 && (
|
| 590 |
+
<div className="text-[10px] text-mute/70">
|
| 591 |
+
{hiddenOutcomes > 0
|
| 592 |
+
? `+${hiddenOutcomes} more outcome${hiddenOutcomes === 1 ? "" : "s"} · `
|
| 593 |
+
: ""}
|
| 594 |
+
{hiddenShots} shot{hiddenShots === 1 ? "" : "s"} in outcomes
|
| 595 |
+
not listed
|
| 596 |
+
</div>
|
| 597 |
+
)}
|
| 598 |
</div>
|
| 599 |
)}
|
| 600 |
</div>
|
|
|
|
| 630 |
);
|
| 631 |
setPoints(
|
| 632 |
rs
|
| 633 |
+
// r.ok too (audit S3): a run whose LATER step failed still
|
| 634 |
+
// carries a fidelity headline, but the pooled interval
|
| 635 |
+
// below already excludes it — a dot indistinguishable from
|
| 636 |
+
// trusted evidence would contradict the pool it sits on.
|
| 637 |
+
.filter(
|
| 638 |
+
(r) =>
|
| 639 |
+
r.ok &&
|
| 640 |
+
r.headline_label === "fidelity" &&
|
| 641 |
+
r.headline_value != null,
|
| 642 |
+
)
|
| 643 |
.map((r) => r.headline_value as number),
|
| 644 |
);
|
| 645 |
// Wave J: pool the archived replicates' binomial counts —
|
|
|
|
| 680 |
{(max * 100).toFixed(1)}%
|
| 681 |
</div>
|
| 682 |
<div className="relative h-4 rounded bg-surfaceAlt" aria-hidden>
|
| 683 |
+
{points.map((p, i) => {
|
| 684 |
+
// Highlight THE newest dot when it matches the displayed run
|
| 685 |
+
// (epsilon, not ===: float identity is luck, and two
|
| 686 |
+
// coincidentally-equal older runs must not both light up —
|
| 687 |
+
// audit S3).
|
| 688 |
+
const isCurrent =
|
| 689 |
+
i === points.length - 1 && Math.abs(p - currentPoint) < 1e-6;
|
| 690 |
+
return (
|
| 691 |
+
<div
|
| 692 |
+
key={i}
|
| 693 |
+
className={`absolute top-1 w-1 h-2 rounded-sm ${isCurrent ? "bg-accent" : "bg-accent/40"}`}
|
| 694 |
+
// clamp: 0%/100% dots sit AT the scale edge instead of
|
| 695 |
+
// overhanging it (audit S3, same rule as the interval bar).
|
| 696 |
+
style={{
|
| 697 |
+
left: `clamp(0px, calc(${p * 100}% - 2px), calc(100% - 4px))`,
|
| 698 |
+
}}
|
| 699 |
+
title={`${(p * 100).toFixed(2)}%`}
|
| 700 |
+
/>
|
| 701 |
+
);
|
| 702 |
+
})}
|
| 703 |
</div>
|
| 704 |
{pooled && (
|
| 705 |
<div
|
|
@@ -136,9 +136,12 @@ export function OpBar({
|
|
| 136 |
*
|
| 137 |
* Defensive about input shape: accepts any numeric array (negatives are
|
| 138 |
* fine — the y-axis floor is `Math.min(...data, 0)`), returns null for
|
| 139 |
-
* fewer than 2 points, and
|
| 140 |
-
*
|
| 141 |
-
*
|
|
|
|
|
|
|
|
|
|
| 142 |
export function Sparkline({
|
| 143 |
data,
|
| 144 |
height = 32,
|
|
@@ -149,9 +152,9 @@ export function Sparkline({
|
|
| 149 |
if (data.length < 2) return null;
|
| 150 |
const w = 200;
|
| 151 |
const h = height;
|
| 152 |
-
const max = Math.max(...data
|
| 153 |
const min = Math.min(...data, 0);
|
| 154 |
-
const range =
|
| 155 |
const pts = data
|
| 156 |
.map((v, i) => {
|
| 157 |
const x = (i / (data.length - 1)) * (w - 4) + 2;
|
|
@@ -200,7 +203,7 @@ export function KvRow({ k, v }: { k: string; v: unknown }) {
|
|
| 200 |
<div className="flex justify-between items-center gap-2 text-[11px]">
|
| 201 |
<span className="text-mute">{k}</span>
|
| 202 |
<span className="font-mono text-ink truncate max-w-[60%] text-right">
|
| 203 |
-
[{v.slice(0, 6).map(
|
| 204 |
{v.length > 6 ? ", …" : ""}]
|
| 205 |
</span>
|
| 206 |
</div>
|
|
@@ -214,7 +217,7 @@ export function KvRow({ k, v }: { k: string; v: unknown }) {
|
|
| 214 |
{Object.entries(v as Record<string, unknown>).map(([kk, vv]) => (
|
| 215 |
<div key={kk} className="flex gap-2">
|
| 216 |
<span className="text-mute">{kk}</span>
|
| 217 |
-
<span>{
|
| 218 |
</div>
|
| 219 |
))}
|
| 220 |
</div>
|
|
@@ -231,9 +234,25 @@ export function KvRow({ k, v }: { k: string; v: unknown }) {
|
|
| 231 |
);
|
| 232 |
}
|
| 233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
/** Human-friendly number formatting. Ints stay integer; tiny floats go
|
| 235 |
-
* scientific; everything else gets 4 decimals.
|
| 236 |
-
export
|
|
|
|
| 237 |
if (typeof v === "number") {
|
| 238 |
if (!Number.isFinite(v)) return String(v);
|
| 239 |
if (Math.abs(v) < 1e-3 && v !== 0) return v.toExponential(3);
|
|
|
|
| 136 |
*
|
| 137 |
* Defensive about input shape: accepts any numeric array (negatives are
|
| 138 |
* fine — the y-axis floor is `Math.min(...data, 0)`), returns null for
|
| 139 |
+
* fewer than 2 points, and falls back to a range of 1 ONLY for a flat
|
| 140 |
+
* trace (divide-by-zero guard). Audit S3: the old max(range, 1) /
|
| 141 |
+
* max(...data, 1) clamps flattened every sub-unit series — a QuCAD
|
| 142 |
+
* loss trace living in [0.28, 0.34] rendered as a flat line. In
|
| 143 |
+
* practice the call sites pass strictly non-negative values (QuCAD
|
| 144 |
+
* loss trace, Qshot pilot fidelities). */
|
| 145 |
export function Sparkline({
|
| 146 |
data,
|
| 147 |
height = 32,
|
|
|
|
| 152 |
if (data.length < 2) return null;
|
| 153 |
const w = 200;
|
| 154 |
const h = height;
|
| 155 |
+
const max = Math.max(...data);
|
| 156 |
const min = Math.min(...data, 0);
|
| 157 |
+
const range = max - min || 1;
|
| 158 |
const pts = data
|
| 159 |
.map((v, i) => {
|
| 160 |
const x = (i / (data.length - 1)) * (w - 4) + 2;
|
|
|
|
| 203 |
<div className="flex justify-between items-center gap-2 text-[11px]">
|
| 204 |
<span className="text-mute">{k}</span>
|
| 205 |
<span className="font-mono text-ink truncate max-w-[60%] text-right">
|
| 206 |
+
[{v.slice(0, 6).map((x) => fmtCell(x)).join(", ")}
|
| 207 |
{v.length > 6 ? ", …" : ""}]
|
| 208 |
</span>
|
| 209 |
</div>
|
|
|
|
| 217 |
{Object.entries(v as Record<string, unknown>).map(([kk, vv]) => (
|
| 218 |
<div key={kk} className="flex gap-2">
|
| 219 |
<span className="text-mute">{kk}</span>
|
| 220 |
+
<span>{fmtCell(vv)}</span>
|
| 221 |
</div>
|
| 222 |
))}
|
| 223 |
</div>
|
|
|
|
| 234 |
);
|
| 235 |
}
|
| 236 |
|
| 237 |
+
/** One nested value, stringified without ever printing
|
| 238 |
+
* "[object Object]" (audit S3): objects/arrays inside KvRow payloads
|
| 239 |
+
* JSON-stringify (truncated), everything else goes through fmt. */
|
| 240 |
+
function fmtCell(v: unknown): string {
|
| 241 |
+
if (typeof v === "object" && v !== null) {
|
| 242 |
+
try {
|
| 243 |
+
const j = JSON.stringify(v);
|
| 244 |
+
return j.length > 48 ? j.slice(0, 45) + "…" : j;
|
| 245 |
+
} catch {
|
| 246 |
+
return "…";
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
return fmt(v);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
/** Human-friendly number formatting. Ints stay integer; tiny floats go
|
| 253 |
+
* scientific; everything else gets 4 decimals. (Module-local since
|
| 254 |
+
* audit S3 — the export was dead; headlineMetric has its own fmt.) */
|
| 255 |
+
function fmt(v: unknown): string {
|
| 256 |
if (typeof v === "number") {
|
| 257 |
if (!Number.isFinite(v)) return String(v);
|
| 258 |
if (Math.abs(v) < 1e-3 && v !== 0) return v.toExponential(3);
|
|
@@ -6,7 +6,13 @@
|
|
| 6 |
// (RunHistory) and the MultiverseBoard import from here so the mapping
|
| 7 |
// can never drift between the two.
|
| 8 |
|
| 9 |
-
/** Stable pastel per config hash so replicate groups pop visually.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
export function hashHue(hash: string): number {
|
| 11 |
let h = 0;
|
| 12 |
for (let i = 0; i < hash.length; i++) h = (h * 31 + hash.charCodeAt(i)) >>> 0;
|
|
|
|
| 6 |
// (RunHistory) and the MultiverseBoard import from here so the mapping
|
| 7 |
// can never drift between the two.
|
| 8 |
|
| 9 |
+
/** Stable pastel per config hash so replicate groups pop visually.
|
| 10 |
+
*
|
| 11 |
+
* Collision disclosure (audit S3): 360 hue buckets ⇒ by the birthday
|
| 12 |
+
* bound, ~50% chance of two configurations sharing a hue once ~23
|
| 13 |
+
* are archived (and nearby hues blur earlier than that). Acceptable
|
| 14 |
+
* because hue is a RECOGNITION aid, never an identity: every surface
|
| 15 |
+
* that colors by hue also prints the #hash chip or tooltip. */
|
| 16 |
export function hashHue(hash: string): number {
|
| 17 |
let h = 0;
|
| 18 |
for (let i = 0; i < hash.length; i++) h = (h * 31 + hash.charCodeAt(i)) >>> 0;
|
|
@@ -191,8 +191,13 @@ export interface DatedEvidence extends Evidence {
|
|
| 191 |
* inference over accumulated counts must not pool it twice (the
|
| 192 |
* bundled demo archive contains exactly this case: bell-512 run
|
| 193 |
* 7e401b5270b9 replays f0cb7403bbae, seed 815033775, 247/512 twice).
|
| 194 |
-
*
|
| 195 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
* surface applies this rule — difference funnel, theater archive
|
| 197 |
* band, multiverse pooled band/line, fidelity-card replicate strip,
|
| 198 |
* lineage certainty funnel — and their labels say "exact replays
|
|
@@ -200,13 +205,14 @@ export interface DatedEvidence extends Evidence {
|
|
| 200 |
* docs/EVIDENCE_WORKBENCH.md). */
|
| 201 |
export function dedupeDraws<T extends DatedEvidence>(runs: T[]): T[] {
|
| 202 |
const sorted = [...runs].sort((a, b) => a.created_at - b.created_at);
|
| 203 |
-
const seen = new Set<
|
| 204 |
const out: T[] = [];
|
| 205 |
for (const r of sorted) {
|
| 206 |
if (r.shots <= 0) continue;
|
| 207 |
if (r.root_seed != null) {
|
| 208 |
-
|
| 209 |
-
seen.
|
|
|
|
| 210 |
}
|
| 211 |
out.push(r);
|
| 212 |
}
|
|
|
|
| 191 |
* inference over accumulated counts must not pool it twice (the
|
| 192 |
* bundled demo archive contains exactly this case: bell-512 run
|
| 193 |
* 7e401b5270b9 replays f0cb7403bbae, seed 815033775, 247/512 twice).
|
| 194 |
+
* The dedupe key is (root_seed, shots, successes) — audit S3,
|
| 195 |
+
* approved: the replay guarantee only holds when the WHOLE draw
|
| 196 |
+
* repeats, and the same seed with a different stopping point (an
|
| 197 |
+
* early-stopped replay, a changed shot budget) executed different
|
| 198 |
+
* measurements — that is new evidence, not a recording of the old
|
| 199 |
+
* draw. Runs with unknown seeds are never deduped — there is no
|
| 200 |
+
* proof they repeat a draw. Since the 2026-07-10 audit wave, EVERY pooling
|
| 201 |
* surface applies this rule — difference funnel, theater archive
|
| 202 |
* band, multiverse pooled band/line, fidelity-card replicate strip,
|
| 203 |
* lineage certainty funnel — and their labels say "exact replays
|
|
|
|
| 205 |
* docs/EVIDENCE_WORKBENCH.md). */
|
| 206 |
export function dedupeDraws<T extends DatedEvidence>(runs: T[]): T[] {
|
| 207 |
const sorted = [...runs].sort((a, b) => a.created_at - b.created_at);
|
| 208 |
+
const seen = new Set<string>();
|
| 209 |
const out: T[] = [];
|
| 210 |
for (const r of sorted) {
|
| 211 |
if (r.shots <= 0) continue;
|
| 212 |
if (r.root_seed != null) {
|
| 213 |
+
const key = `${r.root_seed}|${r.shots}|${r.successes}`;
|
| 214 |
+
if (seen.has(key)) continue;
|
| 215 |
+
seen.add(key);
|
| 216 |
}
|
| 217 |
out.push(r);
|
| 218 |
}
|