File size: 2,141 Bytes
4ee621f 64aa288 4ee621f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | import type { StepResult } from "../lib/api";
/**
* The pair of contextual chips a step can carry beyond its status:
* * "cached" — served from the per-node prefix cache (pipeline
* prefix unchanged since the last run).
* * "live" — intentionally nondeterministic (e.g. sampled
* fidelity with N shots). The cache is bypassed for this step
* and everything downstream so the user gets a fresh shot draw
* each run.
*
* Two visual variants:
* * `tile` — compact 9px text + tight padding for the canvas tile
* (QNode's result strip). 9px is a DELIBERATE exception to the
* app's 10px type floor (audit S3: documented, not drift): the
* chips are single-word statuses whose meaning the border color
* already carries, and at 10px they collide with the tile's
* metric text at the default canvas zoom.
* * `card` — the global `.chip` pill used in the right pane card
* (ResultsPane's step header).
*
* cached and live are mutually exclusive in practice (a cache hit
* can't also be flagged nondeterministic, since we never write
* nondeterministic results into the cache), so we render at most one.
*/
export function RunStatusChips({
step,
variant,
}: {
step: StepResult;
variant: "tile" | "card";
}) {
const isTile = variant === "tile";
const cachedClass = isTile
? "text-[9px] px-1 py-0.5 rounded border border-accent/30 text-accent"
: "chip !border-accent/30 !text-accent text-[9px]";
const liveClass = isTile
? "text-[9px] px-1 py-0.5 rounded border border-warn/30 text-warn"
: "chip !border-warn/30 !text-warn text-[9px]";
if (step.from_step_cache) {
return (
<span
className={cachedClass}
title="Served from per-node cache (pipeline prefix unchanged)"
>
cached
</span>
);
}
if (step.nondeterministic) {
return (
<span
className={liveClass}
title="Result is intentionally fresh each run (e.g. sampled shots). The per-node cache is bypassed for this step and every downstream step."
>
live
</span>
);
}
return null;
}
|