@zsailer/jupyter-server-side-documents-conformance 0.0.0-stage → 0.0.1
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/COVERAGE.md +56 -0
- package/README.md +139 -2
- package/adapters/generic.ts +17 -0
- package/adapters/http.ts +84 -0
- package/bin/args.mjs +202 -0
- package/bin/conformance.mjs +303 -0
- package/bin/picker.mjs +256 -0
- package/bin/welcome.mjs +95 -0
- package/known-gaps/README.md +12 -0
- package/known-gaps/jsd.json +1 -0
- package/package.json +25 -4
- package/playwright.config.ts +32 -0
- package/runtime/adapter.ts +60 -0
- package/runtime/cells.ts +99 -0
- package/runtime/network.ts +84 -0
- package/runtime/recording.ts +159 -0
- package/runtime/report.ts +135 -0
- package/runtime/reporter.ts +60 -0
- package/runtime/story.ts +482 -0
- package/runtime/tab.ts +364 -0
- package/runtime/types.ts +63 -0
- package/scripts/summarize.py +100 -0
- package/server/conformance_config.py +48 -0
- package/server/jsd_control.py +91 -0
- package/stories.json +981 -0
- package/tests/generated/ai.spec.ts +450 -0
- package/tests/generated/crash.spec.ts +267 -0
- package/tests/generated/edges.spec.ts +549 -0
- package/tests/generated/files.spec.ts +237 -0
- package/tests/generated/handshake.spec.ts +429 -0
- package/tests/generated/lineage.spec.ts +241 -0
- package/tests/generated/outputs.spec.ts +258 -0
- package/tests/generated/rebuild.spec.ts +446 -0
- package/tests/generated/residual.spec.ts +356 -0
- package/tests/generated/stop.spec.ts +168 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// GENERATED by compliance/generate.py from the storyboards. Do not edit: change the storyboard, or oracle.yaml, and generate again.
|
|
2
|
+
import { test } from '@jupyterlab/galata';
|
|
3
|
+
import { E, story } from '../../runtime/story';
|
|
4
|
+
|
|
5
|
+
// A tab adds a cell and types while it is online. The server dies before it saved anything, so the file is as it was when the notebook was opened. The tab, which still holds its edits, reconnects to a server that starts again from the file.
|
|
6
|
+
test(
|
|
7
|
+
...story(
|
|
8
|
+
{
|
|
9
|
+
"id": "S2",
|
|
10
|
+
"group": "crash",
|
|
11
|
+
"title": "The server dies before it saved; the tab holds newer edits",
|
|
12
|
+
"requires": [
|
|
13
|
+
"crashServer"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
async s => {
|
|
17
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
18
|
+
const tab = s.tab("tab");
|
|
19
|
+
|
|
20
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
21
|
+
await tab.open();
|
|
22
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
23
|
+
});
|
|
24
|
+
await s.step(2, "Your tab", "adds a cell “ONLINE CELL” and types “+TYPED” into c0; both reach the server", async () => {
|
|
25
|
+
await tab.type(0, " +TYPED");
|
|
26
|
+
await tab.addCell(3, "ONLINE CELL");
|
|
27
|
+
await s.settle(tab);
|
|
28
|
+
await s.expectTab(tab, ["c0 +TYPED", "c1", "c2", "ONLINE CELL"]);
|
|
29
|
+
});
|
|
30
|
+
await s.step(3, "Your tab", "loses its connection", async () => {
|
|
31
|
+
await tab.goOffline();
|
|
32
|
+
});
|
|
33
|
+
await s.step(4, "Server", "dies before it saved anything: the file still has the three cells", async () => {
|
|
34
|
+
await s.crashServer();
|
|
35
|
+
});
|
|
36
|
+
await s.step(5, "Server", "starts again from the file", async () => {
|
|
37
|
+
await s.restartServer();
|
|
38
|
+
});
|
|
39
|
+
await s.step(6, "Your tab", "reconnects and brings back what it holds", async () => {
|
|
40
|
+
await tab.goOnline();
|
|
41
|
+
});
|
|
42
|
+
await s.step(7, "File on disk", "autosave", async () => {
|
|
43
|
+
// nothing for a test to do: the storyboard states what is so
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
await s.ends([
|
|
47
|
+
{ label: "As the story ends", ends: { tab: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], server: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], file: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"] } },
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Code running on the server, such as an AI agent, edits the notebook directly. A connected tab sees the edit live. The server then dies before it saved it, and starts again from the file.
|
|
54
|
+
test(
|
|
55
|
+
...story(
|
|
56
|
+
{
|
|
57
|
+
"id": "S3",
|
|
58
|
+
"group": "crash",
|
|
59
|
+
"title": "An edit made on the server itself survives a crash",
|
|
60
|
+
"requires": [
|
|
61
|
+
"crashServer"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
async s => {
|
|
65
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
66
|
+
const tab = s.tab("tab");
|
|
67
|
+
|
|
68
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
69
|
+
await tab.open();
|
|
70
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
71
|
+
});
|
|
72
|
+
await s.step(2, "Server", "code on the server (for example an AI agent) appends “+SERVER” to c0", async () => {
|
|
73
|
+
// nothing for a test to do: the storyboard states what is so
|
|
74
|
+
});
|
|
75
|
+
await s.step(3, "Your tab", "sees the edit live", async () => {
|
|
76
|
+
await s.expectTabEventually(tab, ["c0 +SERVER", "c1", "c2"]);
|
|
77
|
+
});
|
|
78
|
+
await s.step(4, "Your tab", "loses its connection", async () => {
|
|
79
|
+
await tab.goOffline();
|
|
80
|
+
});
|
|
81
|
+
await s.step(5, "Server", "dies before it saved: the file still has the old c0", async () => {
|
|
82
|
+
await s.crashServer();
|
|
83
|
+
});
|
|
84
|
+
await s.step(6, "Server", "starts again from the file", async () => {
|
|
85
|
+
await s.restartServer();
|
|
86
|
+
});
|
|
87
|
+
await s.step(7, "Your tab", "reconnects and brings the edit back", async () => {
|
|
88
|
+
await tab.goOnline();
|
|
89
|
+
});
|
|
90
|
+
await s.step(8, "File on disk", "autosave", async () => {
|
|
91
|
+
// nothing for a test to do: the storyboard states what is so
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
await s.ends([
|
|
95
|
+
{ label: "As the story ends", ends: { tab: ["c0 +SERVER", "c1", "c2"], server: ["c0 +SERVER", "c1", "c2"], file: ["c0 +SERVER", "c1", "c2"] } },
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// The second tab adds a cell online and the server relays it to the first tab. The server then dies before it saved the cell. Whichever tab reconnects first finds a server that never had the cell.
|
|
102
|
+
test(
|
|
103
|
+
...story(
|
|
104
|
+
{
|
|
105
|
+
"id": "Q1",
|
|
106
|
+
"group": "crash",
|
|
107
|
+
"title": "A cell held by two tabs is lost by the server in a crash",
|
|
108
|
+
"requires": [
|
|
109
|
+
"crashServer"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
async s => {
|
|
113
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
114
|
+
const tab = s.tab("tab");
|
|
115
|
+
const tab2 = s.tab("tab2");
|
|
116
|
+
|
|
117
|
+
await s.step(1, "First tab", "opens the notebook", async () => {
|
|
118
|
+
await tab.open();
|
|
119
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
120
|
+
});
|
|
121
|
+
await s.step(2, "Second tab", "opens the same notebook", async () => {
|
|
122
|
+
await tab2.open();
|
|
123
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
124
|
+
});
|
|
125
|
+
await s.step(3, "Second tab", "adds a cell “BOTH TABS HOLD THIS”", async () => {
|
|
126
|
+
await tab2.addCell(3, "BOTH TABS HOLD THIS");
|
|
127
|
+
await s.settle(tab2);
|
|
128
|
+
await s.expectTab(tab2, ["c0", "c1", "c2", "BOTH TABS HOLD THIS"]);
|
|
129
|
+
});
|
|
130
|
+
await s.step(4, "First tab", "receives it: both tabs now hold the cell", async () => {
|
|
131
|
+
await s.expectTabEventually(tab, ["c0", "c1", "c2", "BOTH TABS HOLD THIS"]);
|
|
132
|
+
});
|
|
133
|
+
await s.step(5, "First tab + Second tab", "the server dies: both tabs lose their connection", async () => {
|
|
134
|
+
await tab.goOffline();
|
|
135
|
+
await tab2.goOffline();
|
|
136
|
+
});
|
|
137
|
+
await s.step(6, "Server", "dies before it saved the new cell: the file still has the three cells", async () => {
|
|
138
|
+
await s.crashServer();
|
|
139
|
+
});
|
|
140
|
+
await s.step(7, "Server", "starts again from the file", async () => {
|
|
141
|
+
await s.restartServer();
|
|
142
|
+
});
|
|
143
|
+
await s.step(8, "First tab", "the first tab reconnects first", async () => {
|
|
144
|
+
await tab.goOnline();
|
|
145
|
+
});
|
|
146
|
+
await s.step(9, "Second tab", "the second tab reconnects", async () => {
|
|
147
|
+
await tab2.goOnline();
|
|
148
|
+
});
|
|
149
|
+
await s.step(10, "File on disk", "autosave", async () => {
|
|
150
|
+
// nothing for a test to do: the storyboard states what is so
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
await s.ends([
|
|
154
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "BOTH TABS HOLD THIS"], tab2: ["c0", "c1", "c2", "BOTH TABS HOLD THIS"], server: ["c0", "c1", "c2", "BOTH TABS HOLD THIS"], file: ["c0", "c1", "c2", "BOTH TABS HOLD THIS"] } },
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// A tab holds newer content than the file: it added a cell and typed, and the server saved that. Then the file is replaced by an older copy of the notebook (a restore from a backup, or a sync tool that put the old copy back), and the tab, which still holds the newer content, reconnects to a server that starts again from that file. Unlike the story of a server that dies before it saved, the older file is not an accident of timing: somebody put it there.
|
|
161
|
+
test(
|
|
162
|
+
...story(
|
|
163
|
+
{
|
|
164
|
+
"id": "P1",
|
|
165
|
+
"group": "crash",
|
|
166
|
+
"title": "The file is put back to an older copy",
|
|
167
|
+
"requires": [
|
|
168
|
+
"fileSystem",
|
|
169
|
+
"releaseRoom"
|
|
170
|
+
],
|
|
171
|
+
"needsAlignment": true
|
|
172
|
+
},
|
|
173
|
+
async s => {
|
|
174
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
175
|
+
const tab = s.tab("tab");
|
|
176
|
+
|
|
177
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
178
|
+
await tab.open();
|
|
179
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
180
|
+
});
|
|
181
|
+
await s.step(2, "Your tab", "adds a cell “ONLINE CELL” and types “+TYPED” into c0; both reach the server", async () => {
|
|
182
|
+
await tab.type(0, " +TYPED");
|
|
183
|
+
await tab.addCell(3, "ONLINE CELL");
|
|
184
|
+
await s.settle(tab);
|
|
185
|
+
await s.expectTab(tab, ["c0 +TYPED", "c1", "c2", "ONLINE CELL"]);
|
|
186
|
+
});
|
|
187
|
+
await s.step(3, "Your tab", "loses its connection", async () => {
|
|
188
|
+
await tab.goOffline();
|
|
189
|
+
});
|
|
190
|
+
await s.step(4, "Server", "lets go of the notebook, saving it", async () => {
|
|
191
|
+
await s.releaseRoom();
|
|
192
|
+
});
|
|
193
|
+
await s.step(5, "File on disk", "holds the newer notebook", async () => {
|
|
194
|
+
await s.expectFile(["c0 +TYPED", "c1", "c2", "ONLINE CELL"]);
|
|
195
|
+
});
|
|
196
|
+
await s.step(6, "File on disk", "an older copy of the file is put back (a restore from a backup)", async () => {
|
|
197
|
+
await s.writeFileOutside(["c0", "c1", "c2"]);
|
|
198
|
+
});
|
|
199
|
+
await s.step(7, "Server", "builds the notebook again from the file", async () => {
|
|
200
|
+
// nothing for a test to do: the storyboard states what is so
|
|
201
|
+
});
|
|
202
|
+
await s.step(8, "Your tab", "reconnects, still holding newer content", async () => {
|
|
203
|
+
await tab.goOnline();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
await s.ends([
|
|
207
|
+
{ label: "The file wins", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
208
|
+
{ label: "The newer content comes back", ends: { tab: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], server: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], file: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"] } },
|
|
209
|
+
]);
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
// A tab adds a cell and types. The server writes its record of the new state and dies before it writes the file, so the file still has the old content. When the server starts again it must notice the unfinished save and complete it, with no tab connected.
|
|
215
|
+
test(
|
|
216
|
+
...story(
|
|
217
|
+
{
|
|
218
|
+
"id": "S6",
|
|
219
|
+
"group": "crash",
|
|
220
|
+
"title": "The server dies in the middle of saving",
|
|
221
|
+
"requires": [
|
|
222
|
+
"crashServer",
|
|
223
|
+
"historyRecord"
|
|
224
|
+
],
|
|
225
|
+
"appliesIf": [
|
|
226
|
+
"persisted_lineage"
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
async s => {
|
|
230
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
231
|
+
const tab = s.tab("tab");
|
|
232
|
+
|
|
233
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
234
|
+
await tab.open();
|
|
235
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
236
|
+
});
|
|
237
|
+
await s.step(2, "Your tab", "adds a cell “ONLINE CELL” and types “+TYPED” into c0", async () => {
|
|
238
|
+
await tab.type(0, " +TYPED");
|
|
239
|
+
await tab.addCell(3, "ONLINE CELL");
|
|
240
|
+
await s.settle(tab);
|
|
241
|
+
await s.expectTab(tab, ["c0 +TYPED", "c1", "c2", "ONLINE CELL"]);
|
|
242
|
+
});
|
|
243
|
+
await s.step(3, "History record", "the server writes its record of the new state", async () => {
|
|
244
|
+
// the server writes its record of the new state
|
|
245
|
+
});
|
|
246
|
+
await s.step(4, "Your tab", "loses its connection", async () => {
|
|
247
|
+
await tab.goOffline();
|
|
248
|
+
});
|
|
249
|
+
await s.step(5, "Server", "dies before it writes the file: the file still has the old content", async () => {
|
|
250
|
+
await s.crashServer();
|
|
251
|
+
});
|
|
252
|
+
await s.step(6, "Server", "starts again, notices the unfinished save, takes the newer state and finishes the save; no tab is connected", async () => {
|
|
253
|
+
await s.restartServer();
|
|
254
|
+
});
|
|
255
|
+
await s.step(7, "File on disk", "now holds the new state", async () => {
|
|
256
|
+
// nothing for a test to do: the storyboard states what is so
|
|
257
|
+
});
|
|
258
|
+
await s.step(8, "Your tab", "later the tab reconnects: it already agrees with the server", async () => {
|
|
259
|
+
await tab.goOnline();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
await s.ends([
|
|
263
|
+
{ label: "As the story ends", ends: { tab: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], server: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"], file: ["c0 +TYPED", "c1", "c2", "ONLINE CELL"] } },
|
|
264
|
+
]);
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
);
|