Keep a flow's runs when the flow goes
A run record is a record of what ran, so deleting a flow no longer sweeps its
history: `_forget_runs` is gone from the flow-delete path, and `DELETE /runs/{id}`
is the only thing that removes a run one at a time. The in-flight guard stays —
that is about work, not history.
`DELETE /runs?flow=` is the counterpart to the list's flow filter and what a
reseed needs, sharing the four statements with the single-run delete and
refusing the same way while a run of that flow is still going.
A run whose flow is gone reads as one: `useFlowInputs` reports the 404 rather
than an empty declaration set, so the run page says "flow deleted", explains it,
and disables Retry, which the route would refuse anyway.
This commit is contained in:
@@ -23,6 +23,7 @@ import { OpenInDashboard } from "./OpenInDashboard"
|
||||
import {
|
||||
CARD,
|
||||
downloadArtifact,
|
||||
FLOW_GONE,
|
||||
isLive,
|
||||
NO_CURVE,
|
||||
paramText,
|
||||
@@ -42,7 +43,7 @@ export function RunDetail({ id }: { id: string }) {
|
||||
const cancel = useCancelRun()
|
||||
const retry = useRetryRun()
|
||||
const names = useMetricNames(id)
|
||||
const declared = useFlowInputs(run?.flow)
|
||||
const { declared, gone } = useFlowInputs(run?.flow)
|
||||
const [metric, setMetric] = useState("")
|
||||
|
||||
if (isPending || !run) return <Skeleton className="h-96 w-full rounded-lg" />
|
||||
@@ -96,6 +97,14 @@ export function RunDetail({ id }: { id: string }) {
|
||||
ran the working copy
|
||||
</span>
|
||||
)}
|
||||
{gone && (
|
||||
<span
|
||||
className="rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs"
|
||||
data-testid="flow-gone"
|
||||
>
|
||||
flow deleted
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<OpenInDashboard flow={run.flow} ids={[run.id]} />
|
||||
@@ -115,7 +124,8 @@ export function RunDetail({ id }: { id: string }) {
|
||||
size="sm"
|
||||
className="h-8"
|
||||
onClick={() => retry.mutate(run.id)}
|
||||
disabled={retry.isPending}
|
||||
// There is no flow left to run it against; the route would 404.
|
||||
disabled={retry.isPending || gone}
|
||||
data-testid="retry-run"
|
||||
>
|
||||
<RotateCcw className="size-3.5" />
|
||||
@@ -126,6 +136,7 @@ export function RunDetail({ id }: { id: string }) {
|
||||
</header>
|
||||
|
||||
{reason && <p className="text-muted-foreground text-sm">{reason}</p>}
|
||||
{gone && <p className="text-muted-foreground text-sm">{FLOW_GONE}</p>}
|
||||
|
||||
<section className={cn(CARD, "grid gap-4 sm:grid-cols-2 lg:grid-cols-4")}>
|
||||
<Fact label="Submitted">{ago(String(run.created_at ?? ""))}</Fact>
|
||||
@@ -157,7 +168,9 @@ export function RunDetail({ id }: { id: string }) {
|
||||
<h2 className="font-medium text-sm">Inputs</h2>
|
||||
{fed.length === 0 ? (
|
||||
<p className="text-muted-foreground text-sm">
|
||||
This flow declares no inputs, so there was nothing to choose.
|
||||
{gone
|
||||
? "The run carried no parameters of its own, and its flow is gone, so what it took from the flow cannot be read back."
|
||||
: "This flow declares no inputs, so there was nothing to choose."}
|
||||
</p>
|
||||
) : (
|
||||
<dl className="grid gap-x-6 gap-y-1 sm:grid-cols-2 lg:grid-cols-3">
|
||||
|
||||
Reference in New Issue
Block a user