@marimo-team/islands 0.25.3-dev458 → 0.25.3-dev460
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.
- package/dist/{ErrorBoundary-CwkGSYmm.js → ErrorBoundary-D2YXxE_x.js} +1 -1
- package/dist/{chat-ui-6d75EmD5.js → chat-ui-wWHUzOrx.js} +3 -3
- package/dist/{code-visibility-Xv_t4WwT.js → code-visibility-BPWgfZVa.js} +2 -2
- package/dist/{common-BlMwQJMs.js → common-_2RH91nQ.js} +3 -3
- package/dist/{data-grid-overlay-editor-Bd8kunYq.js → data-grid-overlay-editor-yh1wqygW.js} +1 -1
- package/dist/{error-entries-Y2oBe6wK.js → error-entries-3nytC8-z.js} +527 -504
- package/dist/{feedback-button-nET4jF-9.js → feedback-button-Ctc_u2JY.js} +3 -3
- package/dist/{glide-data-editor-DzQRP0yA.js → glide-data-editor-DJikF-sp.js} +3 -3
- package/dist/{globals-IFL15lCt.js → globals-D8_0qvIC.js} +1 -1
- package/dist/{html-to-image-BMB3OKAk.js → html-to-image-C3Nb90uM.js} +1 -1
- package/dist/main.js +8493 -8478
- package/dist/{number-overlay-editor-BtYxGlC3.js → number-overlay-editor-BUXorcPD.js} +1 -1
- package/dist/{process-output-lVSjjNuD.js → process-output-BiLaCBoX.js} +2 -2
- package/dist/{reveal-component-BtbTYMke.js → reveal-component-B54ZJYk8.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +54 -52
- package/src/components/editor/__tests__/output-persistence.test.tsx +1 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +5 -8
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +7 -5
- package/src/components/editor/stdin-blocking-alert.tsx +1 -1
- package/src/core/cells/__tests__/clear-outputs.test.ts +8 -9
- package/src/core/cells/__tests__/runs.test.ts +18 -18
- package/src/core/cells/__tests__/session.test.ts +13 -11
- package/src/core/cells/execution-console.ts +6 -8
- package/src/core/cells/runs.ts +10 -10
- package/src/core/cells/session.ts +7 -5
- package/src/core/cells/utils.ts +1 -1
- package/src/core/errors/__tests__/error-entries.test.ts +1 -1
- package/src/core/executions/__tests__/atoms.test.ts +12 -5
- package/src/core/executions/__tests__/freshness.test.ts +53 -37
- package/src/core/executions/__tests__/hooks.test.tsx +8 -9
- package/src/core/executions/__tests__/interrupt.test.ts +12 -5
- package/src/core/executions/__tests__/output-lifecycle.test.ts +39 -38
- package/src/core/executions/__tests__/output.test.ts +62 -72
- package/src/core/executions/__tests__/run.test.ts +1 -4
- package/src/core/executions/__tests__/select.test.ts +44 -30
- package/src/core/executions/atoms.ts +2 -1
- package/src/core/executions/freshness.ts +7 -5
- package/src/core/executions/output.ts +8 -6
- package/src/core/executions/select.ts +23 -18
- package/src/core/islands/__tests__/bridge.test.ts +2 -10
- package/src/core/notebook/replica/__tests__/executions.test.ts +20 -11
- package/src/core/notebook/replica/__tests__/results.test.ts +42 -33
- package/src/core/notebook/replica/execution-state.ts +35 -0
- package/src/core/notebook/replica/index.ts +6 -0
- package/src/core/notebook/replica/replica.ts +1 -1
- package/src/core/notebook/replica/resources/executions.ts +9 -8
- package/src/core/notebook/replica/resources/results.ts +6 -5
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +20 -22
- package/src/core/session/useNotebookSession.tsx +11 -4
- package/src/core/static/virtual-file-tracker.ts +3 -2
- package/src/core/transports/__tests__/static.test.ts +13 -8
- package/src/core/wasm/__tests__/bridge.test.ts +7 -16
- package/src/core/wasm/bridge.ts +6 -5
- package/src/stories/cell.stories.tsx +24 -19
|
@@ -35,8 +35,24 @@ function cell(
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
const NO_VALUE: Protocol.Outcome = { kind: "value", display: null };
|
|
39
|
+
|
|
40
|
+
/** A completed state that read `depends_on`. */
|
|
41
|
+
function completed(
|
|
42
|
+
depends_on: Protocol.ExecutionCompleted["depends_on"] = {},
|
|
43
|
+
outcome: Protocol.Outcome = NO_VALUE,
|
|
44
|
+
): Protocol.ExecutionCompleted {
|
|
45
|
+
return {
|
|
46
|
+
status: "completed",
|
|
47
|
+
started_at: T0,
|
|
48
|
+
completed_at: T1,
|
|
49
|
+
outcome,
|
|
50
|
+
depends_on,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
38
54
|
function record(
|
|
39
|
-
|
|
55
|
+
fields: Partial<Protocol.Execution> & {
|
|
40
56
|
id: string;
|
|
41
57
|
cell_id: string;
|
|
42
58
|
code_fingerprint: string;
|
|
@@ -46,12 +62,8 @@ function record(
|
|
|
46
62
|
run_id: "run-1",
|
|
47
63
|
runtime_id: "r1",
|
|
48
64
|
caused_by: null,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
outcome: { kind: "value", display: null },
|
|
52
|
-
started_at: T0,
|
|
53
|
-
completed_at: T1,
|
|
54
|
-
...overrides,
|
|
65
|
+
state: completed(),
|
|
66
|
+
...fields,
|
|
55
67
|
};
|
|
56
68
|
}
|
|
57
69
|
|
|
@@ -129,7 +141,7 @@ const e13 = record({
|
|
|
129
141
|
id: "e13",
|
|
130
142
|
cell_id: "k7f2",
|
|
131
143
|
code_fingerprint: K7F2_FINGERPRINT,
|
|
132
|
-
|
|
144
|
+
state: completed({ x: { execution: "e12", update: 0 } }),
|
|
133
145
|
});
|
|
134
146
|
|
|
135
147
|
describe("cellFreshness", () => {
|
|
@@ -205,7 +217,7 @@ describe("cellFreshness", () => {
|
|
|
205
217
|
id: "e15",
|
|
206
218
|
cell_id: "m",
|
|
207
219
|
code_fingerprint: "aaaa111122223333",
|
|
208
|
-
|
|
220
|
+
state: completed({ y: { execution: "e13", update: 0 } }),
|
|
209
221
|
});
|
|
210
222
|
const state = inputs({
|
|
211
223
|
cells: [c3, k7f2, m],
|
|
@@ -247,10 +259,7 @@ describe("cellFreshness", () => {
|
|
|
247
259
|
id: "e14",
|
|
248
260
|
cell_id: "c3",
|
|
249
261
|
code_fingerprint: C3_FINGERPRINT,
|
|
250
|
-
status: "queued",
|
|
251
|
-
outcome: null,
|
|
252
|
-
started_at: null,
|
|
253
|
-
completed_at: null,
|
|
262
|
+
state: { status: "queued" },
|
|
254
263
|
});
|
|
255
264
|
const state = inputs({
|
|
256
265
|
cells: [c3, k7f2],
|
|
@@ -274,7 +283,7 @@ describe("cellFreshness", () => {
|
|
|
274
283
|
id: "e20",
|
|
275
284
|
cell_id: "k7f2",
|
|
276
285
|
code_fingerprint: K7F2_FINGERPRINT,
|
|
277
|
-
|
|
286
|
+
state: completed({ y: null }),
|
|
278
287
|
});
|
|
279
288
|
const unbound = inputs({
|
|
280
289
|
cells: [c3, k7f2],
|
|
@@ -300,10 +309,10 @@ describe("cellFreshness", () => {
|
|
|
300
309
|
id: "e21",
|
|
301
310
|
cell_id: "k7f2",
|
|
302
311
|
code_fingerprint: "stale",
|
|
303
|
-
|
|
312
|
+
state: completed({
|
|
304
313
|
x: { execution: "e12", update: 0 },
|
|
305
314
|
z: { execution: "e30", update: 0 },
|
|
306
|
-
},
|
|
315
|
+
}),
|
|
307
316
|
});
|
|
308
317
|
const state = inputs({
|
|
309
318
|
cells: [c3, k7f2],
|
|
@@ -323,13 +332,15 @@ describe("cellFreshness", () => {
|
|
|
323
332
|
id: "e22",
|
|
324
333
|
cell_id: "k7f2",
|
|
325
334
|
code_fingerprint: K7F2_FINGERPRINT,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
335
|
+
state: completed(
|
|
336
|
+
{ x: { execution: "e12", update: 0 } },
|
|
337
|
+
{
|
|
338
|
+
kind: "skipped",
|
|
339
|
+
reason: "upstream-failed",
|
|
340
|
+
message: "",
|
|
341
|
+
related: [],
|
|
342
|
+
},
|
|
343
|
+
),
|
|
333
344
|
});
|
|
334
345
|
const state = inputs({
|
|
335
346
|
cells: [c3, k7f2],
|
|
@@ -364,18 +375,25 @@ describe("cellFreshness", () => {
|
|
|
364
375
|
cell_id: "k7f2",
|
|
365
376
|
runtime_id: "r2",
|
|
366
377
|
code_fingerprint: K7F2_FINGERPRINT,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
378
|
+
state: {
|
|
379
|
+
...completed({ x: null }),
|
|
380
|
+
started_at: "2026-10-01T09:21:00Z",
|
|
381
|
+
completed_at: "2026-10-01T09:21:01Z",
|
|
382
|
+
},
|
|
370
383
|
});
|
|
371
384
|
const binder = record({
|
|
372
385
|
id: "binder-r3",
|
|
373
386
|
cell_id: "c3",
|
|
374
387
|
runtime_id: "r3",
|
|
375
388
|
code_fingerprint: C3_FINGERPRINT,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
389
|
+
state:
|
|
390
|
+
status === "completed"
|
|
391
|
+
? {
|
|
392
|
+
...completed(),
|
|
393
|
+
started_at: "2026-10-01T09:22:00Z",
|
|
394
|
+
completed_at: "2026-10-01T09:22:01Z",
|
|
395
|
+
}
|
|
396
|
+
: { status, started_at: "2026-10-01T09:22:00Z", value: null },
|
|
379
397
|
});
|
|
380
398
|
const state = inputs({
|
|
381
399
|
cells: [c3, k7f2],
|
|
@@ -399,7 +417,7 @@ describe("cellFreshness", () => {
|
|
|
399
417
|
cell_id: "k7f2",
|
|
400
418
|
runtime_id: "r2",
|
|
401
419
|
code_fingerprint: K7F2_FINGERPRINT,
|
|
402
|
-
|
|
420
|
+
state: completed({ x: null }),
|
|
403
421
|
});
|
|
404
422
|
const retained = inputs({
|
|
405
423
|
cells: [c3, k7f2],
|
|
@@ -436,10 +454,10 @@ describe("cellFreshness", () => {
|
|
|
436
454
|
id: "e14",
|
|
437
455
|
cell_id: "c3",
|
|
438
456
|
code_fingerprint: "ffff000011112222",
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
457
|
+
state:
|
|
458
|
+
status === "running"
|
|
459
|
+
? { status, started_at: T0, value: null }
|
|
460
|
+
: { status },
|
|
443
461
|
});
|
|
444
462
|
const state = inputs({
|
|
445
463
|
cells: [c3],
|
|
@@ -460,9 +478,7 @@ describe("cellFreshness", () => {
|
|
|
460
478
|
id: "e14",
|
|
461
479
|
cell_id: "c3",
|
|
462
480
|
code_fingerprint: "ffff000011112222",
|
|
463
|
-
status: "running",
|
|
464
|
-
outcome: null,
|
|
465
|
-
completed_at: null,
|
|
481
|
+
state: { status: "running", started_at: T0, value: null },
|
|
466
482
|
});
|
|
467
483
|
const covered = inputs({
|
|
468
484
|
cells: [edited, k7f2],
|
|
@@ -24,7 +24,7 @@ const C2 = cellId("c2");
|
|
|
24
24
|
|
|
25
25
|
/** A completed execution of `id` whose source matches the fixture document. */
|
|
26
26
|
function ran(id: string) {
|
|
27
|
-
return MockExecutions.completed(id,
|
|
27
|
+
return { ...MockExecutions.completed(id), code_fingerprint: `${id}-hash` };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function setup(records: ReturnType<typeof ran>[]) {
|
|
@@ -153,14 +153,13 @@ describe("input-change warnings", () => {
|
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
describe("useCellOutput", () => {
|
|
156
|
-
const shown = (id: string) =>
|
|
157
|
-
MockExecutions.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
156
|
+
const shown = (id: string) => ({
|
|
157
|
+
...MockExecutions.shown(id, {
|
|
158
|
+
mimetype: "text/plain",
|
|
159
|
+
data: `${id} value`,
|
|
160
|
+
}),
|
|
161
|
+
code_fingerprint: `${id}-hash`,
|
|
162
|
+
});
|
|
164
163
|
|
|
165
164
|
it("reads the result's value and hides it once cleared, until a newer result", () => {
|
|
166
165
|
const { store, replica, wrapper } = setup([shown(C1)]);
|
|
@@ -21,7 +21,7 @@ vi.mock("@/components/ui/use-toast", () => ({
|
|
|
21
21
|
|
|
22
22
|
function run(
|
|
23
23
|
id: string,
|
|
24
|
-
status: Protocol.
|
|
24
|
+
status: Protocol.RunState["status"] = "running",
|
|
25
25
|
runtimeId = "r1",
|
|
26
26
|
): Protocol.Run {
|
|
27
27
|
return {
|
|
@@ -29,10 +29,17 @@ function run(
|
|
|
29
29
|
notebook_id: "n1",
|
|
30
30
|
runtime_id: runtimeId,
|
|
31
31
|
origin: { kind: "code", code: "pass" },
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
state:
|
|
33
|
+
status === "completed"
|
|
34
|
+
? {
|
|
35
|
+
status,
|
|
36
|
+
started_at: MockExecutions.T0,
|
|
37
|
+
completed_at: MockExecutions.T1,
|
|
38
|
+
outcome: "succeeded",
|
|
39
|
+
}
|
|
40
|
+
: status === "running"
|
|
41
|
+
? { status, started_at: MockExecutions.T0 }
|
|
42
|
+
: { status },
|
|
36
43
|
};
|
|
37
44
|
}
|
|
38
45
|
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import { scratchOutputView } from "../output";
|
|
28
28
|
|
|
29
29
|
const C1 = cellId("c1");
|
|
30
|
-
const value = (data: string): Protocol.
|
|
30
|
+
const value = (data: string): Protocol.ValueOutcome => ({
|
|
31
31
|
kind: "value",
|
|
32
32
|
display: { mimetype: "text/plain", data },
|
|
33
33
|
});
|
|
@@ -105,17 +105,14 @@ describe("output lifetime", () => {
|
|
|
105
105
|
vi.useRealTimers();
|
|
106
106
|
});
|
|
107
107
|
const { store, snapshot, message, reconnect } = await setup();
|
|
108
|
-
const result = MockExecutions.completed(C1,
|
|
108
|
+
const result = MockExecutions.completed(C1, value("A"));
|
|
109
109
|
snapshot([result]);
|
|
110
110
|
const run: Protocol.Run = {
|
|
111
111
|
id: "missed",
|
|
112
112
|
notebook_id: "n1",
|
|
113
113
|
runtime_id: "r1",
|
|
114
114
|
origin: { kind: "cells", cell_ids: [C1] },
|
|
115
|
-
status: "queued",
|
|
116
|
-
outcome: null,
|
|
117
|
-
started_at: null,
|
|
118
|
-
completed_at: null,
|
|
115
|
+
state: { status: "queued" },
|
|
119
116
|
};
|
|
120
117
|
const pending = requestRun(store, [C1])!;
|
|
121
118
|
acceptRun(store, pending, run);
|
|
@@ -151,15 +148,19 @@ describe("output lifetime", () => {
|
|
|
151
148
|
|
|
152
149
|
it("keeps a changed display visible after its execution retires", async () => {
|
|
153
150
|
const { store, replica, emit, remove, snapshot } = await setup();
|
|
154
|
-
const result = MockExecutions.completed(C1,
|
|
151
|
+
const result = MockExecutions.completed(C1, value("A"));
|
|
155
152
|
snapshot([result]);
|
|
156
153
|
clearCellOutputs(store, [C1]);
|
|
157
154
|
expect(store.get(cellOutputAtom(C1))).toBeNull();
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
const shown = (data: string) => ({
|
|
157
|
+
...MockExecutions.completed(C1, value(data)),
|
|
158
|
+
id: result.id,
|
|
159
|
+
});
|
|
160
|
+
emit(shown("B"));
|
|
161
|
+
emit(shown("A"));
|
|
161
162
|
// No reader needs to observe the intermediate display for it to count.
|
|
162
|
-
snapshot([
|
|
163
|
+
snapshot([shown("A")]);
|
|
163
164
|
remove(result);
|
|
164
165
|
const running = MockExecutions.running(C1);
|
|
165
166
|
emit(running);
|
|
@@ -175,15 +176,13 @@ describe("output lifetime", () => {
|
|
|
175
176
|
const { store, emit, remove, snapshot } = await setup();
|
|
176
177
|
const running = MockExecutions.running(C1);
|
|
177
178
|
snapshot([running]);
|
|
178
|
-
emit({ ...running,
|
|
179
|
+
emit({ ...MockExecutions.running(C1, value("A")), id: running.id });
|
|
179
180
|
clearCellOutputs(store, [C1]);
|
|
180
181
|
expect(store.get(cellOutputAtom(C1))).toBeNull();
|
|
181
182
|
|
|
182
183
|
const completed = {
|
|
183
|
-
...
|
|
184
|
-
|
|
185
|
-
completed_at: MockExecutions.T1,
|
|
186
|
-
outcome: value("A"),
|
|
184
|
+
...MockExecutions.completed(C1, value("A")),
|
|
185
|
+
id: running.id,
|
|
187
186
|
};
|
|
188
187
|
emit(completed);
|
|
189
188
|
expect(store.get(cellOutputAtom(C1))).toBeNull();
|
|
@@ -191,15 +190,12 @@ describe("output lifetime", () => {
|
|
|
191
190
|
const next = MockExecutions.running(C1);
|
|
192
191
|
emit(next);
|
|
193
192
|
expect(store.get(cellOutputAtom(C1))).toBeNull();
|
|
194
|
-
emit({ ...
|
|
193
|
+
emit({ ...MockExecutions.running(C1, value("A")), id: next.id });
|
|
195
194
|
expect(store.get(cellOutputAtom(C1))?.data).toBe("A");
|
|
196
195
|
});
|
|
197
196
|
it("keeps the scratch display after its execution expires", async () => {
|
|
198
197
|
const { store, replica, emit, remove, snapshot } = await setup();
|
|
199
|
-
const scratch = MockExecutions.completed("scratch"
|
|
200
|
-
cell_id: null,
|
|
201
|
-
outcome: value("scratch result"),
|
|
202
|
-
});
|
|
198
|
+
const scratch = MockExecutions.completed(null, value("scratch result"));
|
|
203
199
|
snapshot([scratch]);
|
|
204
200
|
const before = scratchOutputView(store.get(replica.executionsAtom));
|
|
205
201
|
expect(before?.data).toBe("scratch result");
|
|
@@ -213,24 +209,32 @@ describe("output lifetime", () => {
|
|
|
213
209
|
before,
|
|
214
210
|
);
|
|
215
211
|
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
started_at
|
|
220
|
-
|
|
212
|
+
const started_at = "2026-10-01T09:22:00Z";
|
|
213
|
+
const next = MockExecutions.execution(null, {
|
|
214
|
+
status: "running",
|
|
215
|
+
started_at,
|
|
216
|
+
value: null,
|
|
217
|
+
});
|
|
221
218
|
emit(next);
|
|
222
219
|
expect(scratchOutputView(store.get(replica.executionsAtom))).toEqual(
|
|
223
220
|
before,
|
|
224
221
|
);
|
|
225
|
-
emit({
|
|
222
|
+
emit({
|
|
223
|
+
...next,
|
|
224
|
+
state: { status: "running", started_at, value: value("next") },
|
|
225
|
+
});
|
|
226
226
|
expect(scratchOutputView(store.get(replica.executionsAtom))?.data).toBe(
|
|
227
227
|
"next",
|
|
228
228
|
);
|
|
229
229
|
emit({
|
|
230
230
|
...next,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
state: {
|
|
232
|
+
status: "completed",
|
|
233
|
+
started_at,
|
|
234
|
+
completed_at: "2026-10-01T09:22:01Z",
|
|
235
|
+
outcome: value("next"),
|
|
236
|
+
depends_on: {},
|
|
237
|
+
},
|
|
234
238
|
});
|
|
235
239
|
remove(next);
|
|
236
240
|
expect(scratchOutputView(store.get(replica.executionsAtom))?.data).toBe(
|
|
@@ -242,16 +246,13 @@ describe("output lifetime", () => {
|
|
|
242
246
|
|
|
243
247
|
it("keeps scratch output cleared when an empty execution expires", async () => {
|
|
244
248
|
const { store, replica, emit, remove, snapshot } = await setup();
|
|
245
|
-
snapshot([
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}),
|
|
250
|
-
]);
|
|
251
|
-
const cleared = MockExecutions.completed("scratch", {
|
|
252
|
-
cell_id: null,
|
|
253
|
-
outcome: { kind: "value", display: null },
|
|
249
|
+
snapshot([MockExecutions.completed(null, value("old"))]);
|
|
250
|
+
const cleared = MockExecutions.execution(null, {
|
|
251
|
+
status: "completed",
|
|
252
|
+
started_at: MockExecutions.T0,
|
|
254
253
|
completed_at: "2026-10-01T09:22:00Z",
|
|
254
|
+
outcome: { kind: "value", display: null },
|
|
255
|
+
depends_on: {},
|
|
255
256
|
});
|
|
256
257
|
emit(cleared);
|
|
257
258
|
expect(scratchOutputView(store.get(replica.executionsAtom))).toBeNull();
|
|
@@ -45,11 +45,7 @@ function inputs(
|
|
|
45
45
|
describe("cellOutputView", () => {
|
|
46
46
|
it("shows a value outcome's display as an output", () => {
|
|
47
47
|
const view = cellOutputView(
|
|
48
|
-
inputs([
|
|
49
|
-
MockExecutions.completed(C1, {
|
|
50
|
-
outcome: { kind: "value", display: HTML },
|
|
51
|
-
}),
|
|
52
|
-
]),
|
|
48
|
+
inputs([MockExecutions.completed(C1, { kind: "value", display: HTML })]),
|
|
53
49
|
C1,
|
|
54
50
|
);
|
|
55
51
|
expect(view).toMatchObject({
|
|
@@ -70,13 +66,11 @@ describe("cellOutputView", () => {
|
|
|
70
66
|
const view = cellOutputView(
|
|
71
67
|
inputs([
|
|
72
68
|
MockExecutions.completed(C1, {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}),
|
|
79
|
-
},
|
|
69
|
+
kind: "error",
|
|
70
|
+
error: hostError({
|
|
71
|
+
traceback: { mimetype: "text/plain", data: "Traceback..." },
|
|
72
|
+
related: [{ cell_id: C2, range: null, message: "Raised it" }],
|
|
73
|
+
}),
|
|
80
74
|
}),
|
|
81
75
|
]),
|
|
82
76
|
C1,
|
|
@@ -106,15 +100,13 @@ describe("cellOutputView", () => {
|
|
|
106
100
|
const stopped = cellOutputView(
|
|
107
101
|
inputs([
|
|
108
102
|
MockExecutions.completed(C1, {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
],
|
|
117
|
-
},
|
|
103
|
+
kind: "skipped",
|
|
104
|
+
reason: "upstream-stopped",
|
|
105
|
+
message: "An ancestor stopped",
|
|
106
|
+
related: [
|
|
107
|
+
{ cell_id: C2, range: null, message: "stopped" },
|
|
108
|
+
{ cell_id: C1, range: null, message: "did not run" },
|
|
109
|
+
],
|
|
118
110
|
}),
|
|
119
111
|
]),
|
|
120
112
|
C1,
|
|
@@ -130,12 +122,10 @@ describe("cellOutputView", () => {
|
|
|
130
122
|
|
|
131
123
|
it("takes down a did-not-run notice once the cell runs", () => {
|
|
132
124
|
const skipped = MockExecutions.completed(C1, {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
related: [{ cell_id: C2, range: null, message: "stopped" }],
|
|
138
|
-
},
|
|
125
|
+
kind: "skipped",
|
|
126
|
+
reason: "upstream-stopped",
|
|
127
|
+
message: "An ancestor stopped",
|
|
128
|
+
related: [{ cell_id: C2, range: null, message: "stopped" }],
|
|
139
129
|
});
|
|
140
130
|
expect(
|
|
141
131
|
cellOutputView(inputs([skipped, MockExecutions.queued(C1)]), C1),
|
|
@@ -147,7 +137,8 @@ describe("cellOutputView", () => {
|
|
|
147
137
|
|
|
148
138
|
it("prefers the running execution's value so far over the retained result", () => {
|
|
149
139
|
const previous = MockExecutions.completed(C1, {
|
|
150
|
-
|
|
140
|
+
kind: "value",
|
|
141
|
+
display: HTML,
|
|
151
142
|
});
|
|
152
143
|
const running = MockExecutions.running(C1);
|
|
153
144
|
const silent = inputs([previous, running]);
|
|
@@ -156,18 +147,21 @@ describe("cellOutputView", () => {
|
|
|
156
147
|
const showing = inputs([
|
|
157
148
|
previous,
|
|
158
149
|
{
|
|
159
|
-
...running,
|
|
160
|
-
outcome: {
|
|
150
|
+
...MockExecutions.running(C1, {
|
|
161
151
|
kind: "value",
|
|
162
152
|
display: { mimetype: "text/plain", data: "so far" },
|
|
163
|
-
},
|
|
153
|
+
}),
|
|
154
|
+
id: running.id,
|
|
164
155
|
},
|
|
165
156
|
]);
|
|
166
157
|
expect(cellOutputView(showing, C1)?.data).toBe("so far");
|
|
167
158
|
|
|
168
159
|
const clearedWhileRunning = inputs([
|
|
169
160
|
previous,
|
|
170
|
-
{
|
|
161
|
+
{
|
|
162
|
+
...MockExecutions.running(C1, { kind: "value", display: null }),
|
|
163
|
+
id: running.id,
|
|
164
|
+
},
|
|
171
165
|
]);
|
|
172
166
|
expect(cellOutputView(clearedWhileRunning, C1)).toBeNull();
|
|
173
167
|
});
|
|
@@ -177,16 +171,14 @@ describe("cellOutputView", () => {
|
|
|
177
171
|
const prevented = cellOutputView(
|
|
178
172
|
inputs([
|
|
179
173
|
MockExecutions.completed(C1, {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
],
|
|
189
|
-
},
|
|
174
|
+
kind: "skipped",
|
|
175
|
+
reason: "upstream-failed",
|
|
176
|
+
message: "An ancestor failed to resolve `x`",
|
|
177
|
+
related: [
|
|
178
|
+
{ cell_id: C2, range: null, message: "could not resolve" },
|
|
179
|
+
{ cell_id: C3, range: null, message: "expected to define it" },
|
|
180
|
+
{ cell_id: C1, range: null, message: "did not run" },
|
|
181
|
+
],
|
|
190
182
|
}),
|
|
191
183
|
]),
|
|
192
184
|
C1,
|
|
@@ -202,7 +194,7 @@ describe("cellOutputView", () => {
|
|
|
202
194
|
});
|
|
203
195
|
|
|
204
196
|
it("carries the source that ran while the confirmed cell still has it", () => {
|
|
205
|
-
const ran = MockExecutions.failed(C1, {},
|
|
197
|
+
const ran = { ...MockExecutions.failed(C1, {}), code_fingerprint: "ran" };
|
|
206
198
|
const same = new Map([
|
|
207
199
|
[C1, cell(C1, "1 / 0", { code_fingerprint: "ran" })],
|
|
208
200
|
]);
|
|
@@ -227,27 +219,31 @@ describe("cellOutputView", () => {
|
|
|
227
219
|
|
|
228
220
|
it("hides a cleared result until a newer one lands", () => {
|
|
229
221
|
const first = MockExecutions.completed(C1, {
|
|
230
|
-
|
|
222
|
+
kind: "value",
|
|
223
|
+
display: HTML,
|
|
231
224
|
});
|
|
232
225
|
const cleared = new Map([[C1, { execution: first.id, version: 0 }]]);
|
|
233
226
|
expect(cellOutputView(inputs([first], cleared), C1)).toBeNull();
|
|
234
227
|
|
|
235
228
|
const second = MockExecutions.completed(C1, {
|
|
236
|
-
|
|
229
|
+
kind: "value",
|
|
230
|
+
display: HTML,
|
|
237
231
|
});
|
|
238
232
|
expect(cellOutputView(inputs([second], cleared), C1)).not.toBeNull();
|
|
239
233
|
});
|
|
240
234
|
|
|
241
235
|
it("keeps a cleared running display hidden when it completes", () => {
|
|
242
|
-
const running = MockExecutions.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
outcome: { kind: "value", display: HTML },
|
|
236
|
+
const running = MockExecutions.running(C1, {
|
|
237
|
+
kind: "value",
|
|
238
|
+
display: HTML,
|
|
246
239
|
});
|
|
247
240
|
const cleared = new Map([[C1, { execution: running.id, version: 0 }]]);
|
|
248
241
|
expect(cellOutputView(inputs([running], cleared), C1)).toBeNull();
|
|
249
242
|
|
|
250
|
-
const finished = {
|
|
243
|
+
const finished = {
|
|
244
|
+
...MockExecutions.completed(C1, { kind: "value", display: HTML }),
|
|
245
|
+
id: running.id,
|
|
246
|
+
};
|
|
251
247
|
expect(cellOutputView(inputs([finished], cleared), C1)).toBeNull();
|
|
252
248
|
});
|
|
253
249
|
});
|
|
@@ -302,47 +298,41 @@ describe("cellError", () => {
|
|
|
302
298
|
|
|
303
299
|
describe("scratchOutputView", () => {
|
|
304
300
|
it("shows the latest scratch execution's outcome, or its value so far", () => {
|
|
305
|
-
const done = MockExecutions.
|
|
306
|
-
cell_id: null,
|
|
307
|
-
outcome: { kind: "value", display: HTML },
|
|
308
|
-
});
|
|
301
|
+
const done = MockExecutions.shown(null, HTML);
|
|
309
302
|
expect(scratchOutputView(inputs([done]).executions)?.data).toBe("<b>1</b>");
|
|
310
303
|
|
|
311
|
-
const running = {
|
|
312
|
-
|
|
313
|
-
cell_id: null,
|
|
304
|
+
const running = MockExecutions.execution(null, {
|
|
305
|
+
status: "running",
|
|
314
306
|
started_at: MockExecutions.T1,
|
|
315
|
-
|
|
316
|
-
kind: "value"
|
|
307
|
+
value: {
|
|
308
|
+
kind: "value",
|
|
317
309
|
display: { mimetype: "text/plain", data: "so far" },
|
|
318
310
|
},
|
|
319
|
-
};
|
|
311
|
+
});
|
|
320
312
|
expect(scratchOutputView(inputs([done, running]).executions)?.data).toBe(
|
|
321
313
|
"so far",
|
|
322
314
|
);
|
|
323
315
|
});
|
|
324
316
|
|
|
325
317
|
it("keeps the previous output until a newer run has one to show", () => {
|
|
326
|
-
const done = MockExecutions.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
});
|
|
330
|
-
const silent = {
|
|
331
|
-
...MockExecutions.running("scratch-2"),
|
|
332
|
-
cell_id: null,
|
|
318
|
+
const done = MockExecutions.shown(null, HTML);
|
|
319
|
+
const silent = MockExecutions.execution(null, {
|
|
320
|
+
status: "running",
|
|
333
321
|
started_at: LATER,
|
|
334
|
-
|
|
322
|
+
value: null,
|
|
323
|
+
});
|
|
335
324
|
expect(scratchOutputView(inputs([done, silent]).executions)?.data).toBe(
|
|
336
325
|
"<b>1</b>",
|
|
337
326
|
);
|
|
338
327
|
|
|
339
328
|
// Interrupted before it started, so it has no start time to order by.
|
|
340
|
-
const interrupted = {
|
|
341
|
-
|
|
342
|
-
cell_id: null,
|
|
329
|
+
const interrupted = MockExecutions.execution(null, {
|
|
330
|
+
status: "completed",
|
|
343
331
|
started_at: null,
|
|
344
332
|
completed_at: LATER,
|
|
345
|
-
|
|
333
|
+
outcome: { kind: "interrupted" },
|
|
334
|
+
depends_on: {},
|
|
335
|
+
});
|
|
346
336
|
expect(
|
|
347
337
|
scratchOutputView(inputs([done, interrupted]).executions)?.data,
|
|
348
338
|
).toEqual([{ type: "interruption" }]);
|
|
@@ -40,10 +40,7 @@ function accepted(cells: Protocol.CellId[]): Protocol.Run {
|
|
|
40
40
|
notebook_id: "n1",
|
|
41
41
|
runtime_id: "r1",
|
|
42
42
|
origin: { kind: "cells", cell_ids: cells },
|
|
43
|
-
status: "queued",
|
|
44
|
-
outcome: null,
|
|
45
|
-
started_at: null,
|
|
46
|
-
completed_at: null,
|
|
43
|
+
state: { status: "queued" },
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
46
|
|