@marimo-team/islands 0.25.3-dev463 → 0.25.3-dev465

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{ErrorBoundary-LEY4eR-u.js → ErrorBoundary-Bitt9N44.js} +1 -1
  2. package/dist/{chat-ui-Ow2U38zW.js → chat-ui-BJSYaekC.js} +3 -3
  3. package/dist/{code-visibility-B6vd-MS9.js → code-visibility-CK8BfIsO.js} +3 -3
  4. package/dist/{common-CmFmwC3k.js → common-C-TqeXix.js} +4 -4
  5. package/dist/{data-grid-overlay-editor-DLAyzP8s.js → data-grid-overlay-editor-CilodNKx.js} +1 -1
  6. package/dist/{error-entries-DEV4YOvI.js → error-entries-CNH4hNt-.js} +272 -261
  7. package/dist/{feedback-button-ln7KZEYq.js → feedback-button-B_nA4iPT.js} +3 -3
  8. package/dist/{glide-data-editor-DwVqbx2W.js → glide-data-editor-BQ0Ykfzt.js} +3 -3
  9. package/dist/{globals-DqKjaSau.js → globals-BkrP88Os.js} +1 -1
  10. package/dist/{html-to-image-BdgBPfgg.js → html-to-image-BBX2UucV.js} +1 -1
  11. package/dist/main.js +4556 -4544
  12. package/dist/{number-overlay-editor-D9vaIlf5.js → number-overlay-editor-C9lu04cw.js} +1 -1
  13. package/dist/{process-output-C_EHwiTn.js → process-output-DatAq1xF.js} +2 -2
  14. package/dist/{reveal-component-BrnL8w_N.js → reveal-component-BvH2Wxyh.js} +2 -2
  15. package/package.json +1 -1
  16. package/src/__mocks__/executions.ts +6 -6
  17. package/src/components/dependency-graph/minimap-content.tsx +1 -1
  18. package/src/components/editor/cell/__tests__/useRunCells.test.tsx +1 -1
  19. package/src/components/editor/notebook-cell.tsx +6 -6
  20. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +3 -3
  21. package/src/components/slides/slide-cell-view.tsx +2 -2
  22. package/src/core/ai/context/providers/__tests__/error.test.ts +0 -4
  23. package/src/core/cells/__tests__/cell.test.ts +8 -8
  24. package/src/core/cells/__tests__/runs.test.ts +1 -1
  25. package/src/core/cells/__tests__/session.test.ts +2 -2
  26. package/src/core/cells/__tests__/utils.test.ts +2 -2
  27. package/src/core/cells/cell.ts +2 -2
  28. package/src/core/cells/runs.ts +10 -2
  29. package/src/core/cells/session.ts +1 -1
  30. package/src/core/cells/utils.ts +2 -2
  31. package/src/core/executions/__tests__/atoms.test.ts +1 -1
  32. package/src/core/executions/__tests__/input.test.ts +1 -1
  33. package/src/core/executions/__tests__/interrupt.test.ts +3 -7
  34. package/src/core/executions/__tests__/output.test.ts +26 -5
  35. package/src/core/executions/__tests__/run.test.ts +35 -24
  36. package/src/core/executions/__tests__/select.test.ts +4 -4
  37. package/src/core/executions/atoms.ts +15 -6
  38. package/src/core/executions/output.ts +16 -4
  39. package/src/core/notebook/replica/__tests__/executions.test.ts +57 -3
  40. package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
  41. package/src/core/notebook/replica/__tests__/runtime.test.ts +9 -10
  42. package/src/core/notebook/replica/resources/executions.ts +27 -0
  43. package/src/core/notebook/replica/resources/runtime.ts +1 -1
  44. package/src/core/runtime/__tests__/adapter.test.ts +1 -1
  45. package/src/core/runtime/adapter.ts +1 -1
  46. package/src/core/session/useNotebookSession.tsx +1 -1
  47. package/src/core/wasm/__tests__/bridge.test.ts +4 -6
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { a as n } from "./glide-data-editor-DwVqbx2W.js";
3
+ import { a as n } from "./glide-data-editor-BQ0Ykfzt.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -1,6 +1,6 @@
1
- import { T as e } from "./html-to-image-BdgBPfgg.js";
1
+ import { T as e } from "./html-to-image-BBX2UucV.js";
2
2
  import { h as t } from "./tooltip-CiJ919pg.js";
3
- import { Tt as n, wt as r } from "./error-entries-DEV4YOvI.js";
3
+ import { Tt as n, wt as r } from "./error-entries-CNH4hNt-.js";
4
4
  import { r as i } from "./assertNever-DOTNJ2Y4.js";
5
5
  var a = t("file", [["path", {
6
6
  d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
@@ -3,14 +3,14 @@ import { g as t, h as n, i as r, m as i, t as a } from "./button-qQhINE7z.js";
3
3
  import { t as o } from "./react-Bgs_wQh3.js";
4
4
  import { t as s } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { h as c, t as l } from "./tooltip-CiJ919pg.js";
6
- import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-CmFmwC3k.js";
6
+ import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-C-TqeXix.js";
7
7
  import { M as w } from "./select-PQHWLm64.js";
8
8
  import { X as T } from "./dropdown-menu-B12Nf3Zf.js";
9
9
  import { t as E } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Rt as D, Vt as O, f as k, i as ee } from "./use-restore-focus-BLj45Ibw.js";
11
11
  import { t as A } from "./useEvent-BoN7U38T.js";
12
12
  import { o as te } from "./static-state-CWXd6dYX.js";
13
- import { n as ne, t as re } from "./code-visibility-B6vd-MS9.js";
13
+ import { n as ne, t as re } from "./code-visibility-CK8BfIsO.js";
14
14
  /* empty css */
15
15
  var j = c("sticky-note", [["path", {
16
16
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev463",
3
+ "version": "0.25.3-dev465",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -33,6 +33,7 @@ const T1 = "2026-10-01T09:20:12.500Z";
33
33
 
34
34
  let sequence = 0;
35
35
 
36
+ const READY: Protocol.RuntimeState = { status: "ready" };
36
37
  const SUCCEEDED: Protocol.Outcome = { kind: "succeeded" };
37
38
 
38
39
  /** An execution, or the output it set, as the stream delivers them. */
@@ -180,7 +181,7 @@ export const MockExecutions = {
180
181
  error: Partial<Protocol.Error> = {},
181
182
  ): Protocol.Execution {
182
183
  return completed(cellId, {
183
- kind: "error",
184
+ kind: "failed",
184
185
  error: {
185
186
  kind: "exception",
186
187
  message: "boom",
@@ -200,7 +201,7 @@ export const MockExecutions = {
200
201
  },
201
202
 
202
203
  interrupted(cellId: string | null): Protocol.Execution {
203
- return completed(cellId, { kind: "interrupted" });
204
+ return completed(cellId, { kind: "cancelled" });
204
205
  },
205
206
 
206
207
  skipped(cellId: string): Protocol.Execution {
@@ -231,14 +232,13 @@ export const MockExecutions = {
231
232
  };
232
233
  },
233
234
 
234
- runtime(status: Protocol.RuntimeStatus): Protocol.Runtime {
235
+ runtime(state: Protocol.RuntimeState = READY): Protocol.Runtime {
235
236
  return {
236
237
  id: "r1",
237
238
  notebook_id: "n1",
238
- status,
239
- message: null,
240
239
  marimo_version: null,
241
- started_at: T0,
240
+ created_at: T0,
241
+ state,
242
242
  };
243
243
  },
244
244
 
@@ -33,7 +33,7 @@ const MinimapCell: React.FC<MinimapCellProps> = (props) => {
33
33
  id: props.cellId,
34
34
  graph: graphs[props.cellId],
35
35
  code: useCellData(props.cellId).code,
36
- hasError: useCellExecution(props.cellId).outcome === "error",
36
+ hasError: useCellExecution(props.cellId).outcome === "failed",
37
37
  };
38
38
 
39
39
  let selectedCell: undefined | { id: CellId; graph: CellGraph };
@@ -66,7 +66,7 @@ describe("useRunStaleCells", () => {
66
66
  const replica = MockExecutions.seed(
67
67
  store,
68
68
  records,
69
- MockExecutions.runtime("running"),
69
+ MockExecutions.runtime(),
70
70
  document,
71
71
  );
72
72
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -327,8 +327,8 @@ const ReadonlyCellComponent = forwardRef(
327
327
  const cellData = useCellData(cellId);
328
328
  const output = useCellOutput(cellId);
329
329
  const { execution, freshness } = useCellPresentation(cellId);
330
- const errored = execution.outcome === "error";
331
- const interrupted = execution.outcome === "interrupted";
330
+ const errored = execution.outcome === "failed";
331
+ const interrupted = execution.outcome === "cancelled";
332
332
  const stopped = execution.outcome === "skipped";
333
333
 
334
334
  const className = clsx("marimo-cell", "hover-actions-parent z-10", {
@@ -392,8 +392,8 @@ const EditableCellComponent = ({
392
392
  const output = useCellOutput(cellId);
393
393
  const outline = useCellOutline(cellId);
394
394
  const { execution, freshness } = useCellPresentation(cellId);
395
- const errored = execution.outcome === "error";
396
- const interrupted = execution.outcome === "interrupted";
395
+ const errored = execution.outcome === "failed";
396
+ const interrupted = execution.outcome === "cancelled";
397
397
  const stopped = execution.outcome === "skipped";
398
398
  const cellActionDropdownRef = useRef<CellActionsDropdownHandle>(null);
399
399
  // DOM node where the editorView will be mounted
@@ -859,7 +859,7 @@ const CellRightSideActions = memo(
859
859
  <CellStatusComponent
860
860
  status={execution.status}
861
861
  freshness={freshness}
862
- interrupted={execution.outcome === "interrupted"}
862
+ interrupted={execution.outcome === "cancelled"}
863
863
  editing={true}
864
864
  disabled={disabled}
865
865
  elapsedTime={execution.duration}
@@ -1038,7 +1038,7 @@ const SetupCellComponent = ({
1038
1038
  const cellRuntime = useCellRuntime(cellId);
1039
1039
  const output = useCellOutput(cellId);
1040
1040
  const { execution, freshness } = useCellPresentation(cellId);
1041
- const errored = execution.outcome === "error";
1041
+ const errored = execution.outcome === "failed";
1042
1042
  const stopped = execution.outcome === "skipped";
1043
1043
  const cellActionDropdownRef = useRef<CellActionsDropdownHandle>(null);
1044
1044
  // DOM node where the editorView will be mounted
@@ -133,7 +133,7 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
133
133
  if (cells.length === 0 && !invisible) {
134
134
  // Until the host reports the runtime running, show loading state.
135
135
  // A static notebook has no runtime to wait for.
136
- if (runtimeStatus !== "running" && !isStaticNotebook()) {
136
+ if (runtimeStatus !== "ready" && !isStaticNotebook()) {
137
137
  return (
138
138
  <div className="flex-1 flex flex-col items-center justify-center py-8">
139
139
  <Loader2Icon className="w-8 h-8 animate-spin text-muted-foreground" />
@@ -328,7 +328,7 @@ const VerticalCell = memo(
328
328
  const cellRef = useRef<HTMLDivElement>(null);
329
329
  const output = useCellOutput(cellId);
330
330
  const { execution, freshness } = useCellPresentation(cellId);
331
- const errored = execution.outcome === "error";
331
+ const errored = execution.outcome === "failed";
332
332
  const stopped = execution.outcome === "skipped";
333
333
 
334
334
  const outputStale = outputIsStale(execution, freshness, false);
@@ -402,7 +402,7 @@ const VerticalCell = memo(
402
402
  // instead of hiding them
403
403
  const hidden = shouldHidePublishedCell({
404
404
  errored,
405
- interrupted: execution.outcome === "interrupted",
405
+ interrupted: execution.outcome === "cancelled",
406
406
  stopped,
407
407
  output,
408
408
  showErrorTracebacks,
@@ -62,8 +62,8 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
62
62
  const cellOutputPosition = userConfig.display.cell_output;
63
63
  const hasOutput = cell.output != null;
64
64
  const { execution, freshness } = useCellPresentation(cell.id);
65
- const errored = execution.outcome === "error";
66
- const interrupted = execution.outcome === "interrupted";
65
+ const errored = execution.outcome === "failed";
66
+ const interrupted = execution.outcome === "cancelled";
67
67
  const stopped = execution.outcome === "skipped";
68
68
 
69
69
  const uninstantiated = isUninstantiated(execution);
@@ -341,10 +341,6 @@ describe("ErrorContextProvider", () => {
341
341
  error: { kind: "invalid-syntax", message: "Syntax error" },
342
342
  expected: "Syntax error",
343
343
  },
344
- {
345
- error: { kind: "interrupted", message: "" },
346
- expected: "This cell was interrupted and needs to be re-run",
347
- },
348
344
  {
349
345
  error: { kind: "internal", message: "Unknown error" },
350
346
  expected: "Unknown error",
@@ -46,9 +46,9 @@ describe("outputIsStale", () => {
46
46
  });
47
47
 
48
48
  it("should return false if the cell is interrupted", () => {
49
- expect(
50
- outputIsStale(view({ outcome: "interrupted" }), CURRENT, false),
51
- ).toBe(false);
49
+ expect(outputIsStale(view({ outcome: "cancelled" }), CURRENT, false)).toBe(
50
+ false,
51
+ );
52
52
  });
53
53
 
54
54
  it("should return false if the cell is idle and not edited", () => {
@@ -64,7 +64,7 @@ describe("outputIsStale", () => {
64
64
  });
65
65
 
66
66
  it("should return true if the cell is interrupted and edited since", () => {
67
- expect(outputIsStale(view({ outcome: "interrupted" }), EDITED, true)).toBe(
67
+ expect(outputIsStale(view({ outcome: "cancelled" }), EDITED, true)).toBe(
68
68
  true,
69
69
  );
70
70
  });
@@ -94,14 +94,14 @@ describe("consoleOutputIsStale", () => {
94
94
  });
95
95
 
96
96
  it("is not stale after an interruption", () => {
97
- expect(consoleOutputIsStale(view({ outcome: "interrupted" }), EDITED)).toBe(
97
+ expect(consoleOutputIsStale(view({ outcome: "cancelled" }), EDITED)).toBe(
98
98
  false,
99
99
  );
100
100
  });
101
101
 
102
102
  it("should return false if the cell is interrupted but has stale inputs", () => {
103
- expect(
104
- outputIsStale(view({ outcome: "interrupted" }), REPLACED, false),
105
- ).toBe(false);
103
+ expect(outputIsStale(view({ outcome: "cancelled" }), REPLACED, false)).toBe(
104
+ false,
105
+ );
106
106
  });
107
107
  });
@@ -42,7 +42,7 @@ describe("execution traces", () => {
42
42
  started_at,
43
43
  completed_at: "1970-01-01T00:01:42Z",
44
44
  status: "completed",
45
- outcome: { kind: "interrupted" },
45
+ outcome: { kind: "cancelled" },
46
46
  } satisfies Execution["state"];
47
47
  const runId = "r1" as RunId;
48
48
  const running = observe(observe(initialState()), {
@@ -171,7 +171,7 @@ describe("readExport", () => {
171
171
  expect(result.snapshot.results?.[0]?.execution.state).toHaveProperty(
172
172
  "outcome",
173
173
  {
174
- kind: "error",
174
+ kind: "failed",
175
175
  error: expect.objectContaining({
176
176
  kind: "exception",
177
177
  name: "ValueError",
@@ -325,7 +325,7 @@ describe("readExport", () => {
325
325
  expect(result.snapshot?.results[0]?.execution.state).toHaveProperty(
326
326
  "outcome",
327
327
  {
328
- kind: "error",
328
+ kind: "failed",
329
329
  error: expect.objectContaining({
330
330
  kind: "exception",
331
331
  name: "ValueError",
@@ -204,10 +204,10 @@ describe("isUninstantiated", () => {
204
204
 
205
205
  it("should return false if the cell ended without a value", () => {
206
206
  expect(
207
- isUninstantiated({ status: "idle", outcome: "error", live: true }),
207
+ isUninstantiated({ status: "idle", outcome: "failed", live: true }),
208
208
  ).toBe(false);
209
209
  expect(
210
- isUninstantiated({ status: "idle", outcome: "interrupted", live: true }),
210
+ isUninstantiated({ status: "idle", outcome: "cancelled", live: true }),
211
211
  ).toBe(false);
212
212
  expect(
213
213
  isUninstantiated({ status: "idle", outcome: "skipped", live: true }),
@@ -32,7 +32,7 @@ export function outputIsStale(
32
32
  return true;
33
33
  }
34
34
  // An interrupted run's partial output stands as the record of that run.
35
- if (outcome === "interrupted") {
35
+ if (outcome === "cancelled") {
36
36
  return false;
37
37
  }
38
38
  return freshness.inputsChanged;
@@ -46,7 +46,7 @@ export function consoleOutputIsStale(
46
46
  freshness: CellFreshness,
47
47
  ): boolean {
48
48
  const { status, outcome } = execution;
49
- if (outcome === "interrupted") {
49
+ if (outcome === "cancelled") {
50
50
  return false;
51
51
  }
52
52
  if (outputIsLoading(status)) {
@@ -46,8 +46,16 @@ function traceStatus(record: Execution): CellRun["status"] {
46
46
  if (record.state.status !== "completed") {
47
47
  return record.state.status;
48
48
  }
49
- const outcome = record.state.outcome.kind;
50
- return outcome === "succeeded" ? "success" : outcome;
49
+ switch (record.state.outcome.kind) {
50
+ case "succeeded":
51
+ return "success";
52
+ case "failed":
53
+ return "error";
54
+ case "cancelled":
55
+ return "interrupted";
56
+ case "skipped":
57
+ return "skipped";
58
+ }
51
59
  }
52
60
 
53
61
  const {
@@ -226,7 +226,7 @@ function resultRecord(
226
226
  } else if (primary.type === "error") {
227
227
  const traceback = normalizeTraceback(primary.traceback);
228
228
  outcome = {
229
- kind: "error",
229
+ kind: "failed",
230
230
  error: {
231
231
  kind: "exception",
232
232
  name: primary.ename,
@@ -84,7 +84,7 @@ export function getDescendantsStatus(
84
84
  const stale = descendants.some(
85
85
  (id) => freshness(id).sourceChanged || freshness(id).inputsChanged,
86
86
  );
87
- const errored = views.some((view) => view.outcome === "error");
87
+ const errored = views.some((view) => view.outcome === "failed");
88
88
  const runningOrQueued = views.some(
89
89
  (view) => view.status === "running" || view.status === "queued",
90
90
  );
@@ -112,7 +112,7 @@ export function cellRunReason(
112
112
  if (freshness.sourceChanged) {
113
113
  return "source";
114
114
  }
115
- if (execution.outcome === "interrupted") {
115
+ if (execution.outcome === "cancelled") {
116
116
  return "interrupted";
117
117
  }
118
118
  return freshness.inputsChanged && !cell.config.disabled && !execution.blocked
@@ -42,7 +42,7 @@ function run(
42
42
  status,
43
43
  started_at: null,
44
44
  completed_at: "2026-10-01T09:20:02Z",
45
- outcome: "succeeded",
45
+ outcome: { kind: "succeeded" },
46
46
  }
47
47
  : status === "running"
48
48
  ? { status, started_at: "2026-10-01T09:20:01Z" }
@@ -36,7 +36,7 @@ describe("replyInput", () => {
36
36
  const replica = MockExecutions.seed(
37
37
  store,
38
38
  [],
39
- MockExecutions.runtime("running"),
39
+ MockExecutions.runtime(),
40
40
  documentOf(),
41
41
  );
42
42
  store.set(replica.backendAtom, fakeBackend({ input }));
@@ -35,7 +35,7 @@ function run(
35
35
  status,
36
36
  started_at: MockExecutions.T0,
37
37
  completed_at: MockExecutions.T1,
38
- outcome: "succeeded",
38
+ outcome: { kind: "succeeded" },
39
39
  }
40
40
  : status === "running"
41
41
  ? { status, started_at: MockExecutions.T0 }
@@ -45,15 +45,11 @@ function run(
45
45
 
46
46
  function setup(runs: Protocol.Run[]) {
47
47
  const store = createStore();
48
- const replica = MockExecutions.seed(
49
- store,
50
- [],
51
- MockExecutions.runtime("running"),
52
- );
48
+ const replica = MockExecutions.seed(store, [], MockExecutions.runtime());
53
49
  const interrupt = vi.fn<FakeInterrupt>(async () => ({
54
50
  ok: true,
55
51
  status: 202,
56
- data: MockExecutions.runtime("running"),
52
+ data: MockExecutions.runtime(),
57
53
  }));
58
54
  store.set(replica.backendAtom, fakeBackend({ interrupt }));
59
55
  store.set(replica.executionsAtom, {
@@ -63,7 +63,7 @@ describe("cellOutputView", () => {
63
63
  const view = cellOutputView(
64
64
  inputs([
65
65
  MockExecutions.completed(C1, {
66
- kind: "error",
66
+ kind: "failed",
67
67
  error: hostError({
68
68
  traceback: { mimetype: "text/plain", data: "Traceback..." },
69
69
  related: [{ cell_id: C2, range: null, message: "Raised it" }],
@@ -242,9 +242,6 @@ describe("cellError", () => {
242
242
  expect(
243
243
  cellError(hostError({ kind: "internal", name: "abc", message: "oops" })),
244
244
  ).toEqual({ type: "unknown", msg: "oops", error_type: "abc" });
245
- expect(
246
- cellError(hostError({ kind: "interrupted", name: null, message: "" })),
247
- ).toEqual({ type: "interruption" });
248
245
  });
249
246
 
250
247
  it("shows any other kind as a diagnostic with the cells involved", () => {
@@ -305,11 +302,35 @@ describe("scratchOutputView", () => {
305
302
  status: "completed",
306
303
  started_at: null,
307
304
  completed_at: LATER,
308
- outcome: { kind: "interrupted" },
305
+ outcome: { kind: "cancelled" },
309
306
  depends_on: {},
310
307
  });
311
308
  expect(
312
309
  scratchOutputView(inputs([done, interrupted]).executions)?.data,
313
310
  ).toEqual([{ type: "interruption" }]);
314
311
  });
312
+
313
+ it("shows why a run failed when it has no execution to show", () => {
314
+ const done = MockExecutions.shown(null, HTML);
315
+ const { executions } = inputs([done]);
316
+ const failure = { message: "Kernel channel closed", completedAt: LATER };
317
+
318
+ // The run never reached the kernel, so only the run says what happened.
319
+ expect(
320
+ scratchOutputView({
321
+ ...executions,
322
+ scratchFailure: { ...failure, runId: "run-2" },
323
+ })?.data,
324
+ ).toEqual([
325
+ { type: "unknown", msg: "Kernel channel closed", error_type: null },
326
+ ]);
327
+
328
+ // Its own execution already shows the error.
329
+ expect(
330
+ scratchOutputView({
331
+ ...executions,
332
+ scratchFailure: { ...failure, runId: done[0].run_id! },
333
+ })?.data,
334
+ ).toBe("<b>1</b>");
335
+ });
315
336
  });
@@ -90,7 +90,7 @@ describe("runCells", () => {
90
90
  const replica = MockExecutions.seed(
91
91
  store,
92
92
  [],
93
- MockExecutions.runtime("running"),
93
+ MockExecutions.runtime(),
94
94
  documentOf(),
95
95
  );
96
96
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -125,7 +125,7 @@ describe("runCells", () => {
125
125
  const replica = MockExecutions.seed(
126
126
  store,
127
127
  [],
128
- MockExecutions.runtime("running"),
128
+ MockExecutions.runtime(),
129
129
  withCells(documentOf(), {
130
130
  c2: cell("c2", "y = 2", { config: { ...CONFIG, disabled: true } }),
131
131
  }),
@@ -146,7 +146,7 @@ describe("runCells", () => {
146
146
  const replica = MockExecutions.seed(
147
147
  store,
148
148
  [],
149
- MockExecutions.runtime("starting"),
149
+ MockExecutions.runtime({ status: "starting", message: null }),
150
150
  documentOf(),
151
151
  );
152
152
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -157,7 +157,7 @@ describe("runCells", () => {
157
157
  expect(status(C1)).toBe("queued");
158
158
  expect(run).not.toHaveBeenCalled();
159
159
 
160
- store.set(replica.runtimeAtom, MockExecutions.runtime("running"));
160
+ store.set(replica.runtimeAtom, MockExecutions.runtime());
161
161
  await pending;
162
162
  expect(run).toHaveBeenCalledOnce();
163
163
  });
@@ -173,7 +173,7 @@ describe("runCells", () => {
173
173
  expect(run).not.toHaveBeenCalled();
174
174
 
175
175
  // The real replica reports both at once, from one snapshot.
176
- store.set(replica.runtimeAtom, MockExecutions.runtime("running"));
176
+ store.set(replica.runtimeAtom, MockExecutions.runtime());
177
177
  store.set(replica.notebookAtom, MockExecutions.notebook());
178
178
  await pending;
179
179
 
@@ -196,24 +196,35 @@ describe("runCells", () => {
196
196
  );
197
197
  });
198
198
 
199
- it("withdraws the submission and reports when the runtime has failed", async () => {
200
- const replica = MockExecutions.seed(
201
- store,
202
- [],
203
- { ...MockExecutions.runtime("failed"), message: "The kernel exited" },
204
- documentOf(),
205
- );
206
- store.set(replica.backendAtom, fakeBackend({ run }));
207
- model();
199
+ it.each<[Protocol.RuntimeOutcome, string]>([
200
+ [{ kind: "failed", message: "The kernel exited" }, "The kernel exited"],
201
+ [{ kind: "failed", message: null }, "The runtime failed"],
202
+ [{ kind: "stopped" }, "The notebook has no runtime"],
203
+ ])(
204
+ "withdraws the submission and reports when the runtime ended %o",
205
+ async (outcome, description) => {
206
+ const replica = MockExecutions.seed(
207
+ store,
208
+ [],
209
+ MockExecutions.runtime({
210
+ status: "ended",
211
+ ended_at: "2026-10-01T09:30:00Z",
212
+ outcome,
213
+ }),
214
+ documentOf(),
215
+ );
216
+ store.set(replica.backendAtom, fakeBackend({ run }));
217
+ model();
208
218
 
209
- await runCells(store, [C1]);
219
+ await runCells(store, [C1]);
210
220
 
211
- expect(run).not.toHaveBeenCalled();
212
- expect(status(C1)).toBe("idle");
213
- expect(toast).toHaveBeenCalledWith(
214
- expect.objectContaining({ description: "The kernel exited" }),
215
- );
216
- });
221
+ expect(run).not.toHaveBeenCalled();
222
+ expect(status(C1)).toBe("idle");
223
+ expect(toast).toHaveBeenCalledWith(
224
+ expect.objectContaining({ description }),
225
+ );
226
+ },
227
+ );
217
228
 
218
229
  it("withdraws the submission and reports when the notebook has no runtime", async () => {
219
230
  const replica = MockExecutions.seed(store, [], null, documentOf());
@@ -233,7 +244,7 @@ describe("runCells", () => {
233
244
  const replica = MockExecutions.seed(
234
245
  store,
235
246
  [],
236
- MockExecutions.runtime("starting"),
247
+ MockExecutions.runtime({ status: "starting", message: null }),
237
248
  documentOf(),
238
249
  );
239
250
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -313,7 +324,7 @@ describe("runCells", () => {
313
324
  const replica = MockExecutions.seed(
314
325
  store,
315
326
  [],
316
- MockExecutions.runtime("running"),
327
+ MockExecutions.runtime(),
317
328
  documentOf(),
318
329
  );
319
330
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -335,7 +346,7 @@ describe("runCells", () => {
335
346
  const replica = MockExecutions.seed(
336
347
  store,
337
348
  [],
338
- MockExecutions.runtime("running"),
349
+ MockExecutions.runtime(),
339
350
  documentOf(),
340
351
  );
341
352
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -69,7 +69,7 @@ function run(
69
69
  status,
70
70
  started_at: null,
71
71
  completed_at: "2026-10-01T09:20:02Z",
72
- outcome: "succeeded",
72
+ outcome: { kind: "succeeded" },
73
73
  }
74
74
  : status === "running"
75
75
  ? { status, started_at: "2026-10-01T09:20:01Z" }
@@ -210,7 +210,7 @@ describe("cellExecutionView", () => {
210
210
  live: true,
211
211
  });
212
212
  const error = (kind: string): Protocol.Outcome => ({
213
- kind: "error",
213
+ kind: "failed",
214
214
  error: {
215
215
  kind,
216
216
  message: "",
@@ -222,7 +222,7 @@ describe("cellExecutionView", () => {
222
222
  related: [],
223
223
  },
224
224
  });
225
- expect(ended(error("exception")).outcome).toBe("error");
225
+ expect(ended(error("exception")).outcome).toBe("failed");
226
226
  const skipped: Protocol.Outcome = {
227
227
  kind: "skipped",
228
228
  reason: "ancestor-stopped",
@@ -230,7 +230,7 @@ describe("cellExecutionView", () => {
230
230
  related: [],
231
231
  };
232
232
  expect(ended(skipped).outcome).toBe("skipped");
233
- expect(ended({ kind: "interrupted" }).outcome).toBe("interrupted");
233
+ expect(ended({ kind: "cancelled" }).outcome).toBe("cancelled");
234
234
  });
235
235
 
236
236
  it("reads as queued from a request the stream has not shown a run for", () => {