@zsailer/jupyter-server-side-documents-conformance 0.0.0-stage → 0.0.3

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.
@@ -0,0 +1,241 @@
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
+ // The editing history of the notebook is bigger than the size the server is willing to keep a record of. The server then keeps no record, does not pretend to, and the notebook works as it always does.
6
+ test(
7
+ ...story(
8
+ {
9
+ "id": "S12",
10
+ "group": "lineage",
11
+ "title": "A notebook too big for the server to keep a history record of",
12
+ "requires": [
13
+ "historyRecord",
14
+ "releaseRoom"
15
+ ],
16
+ "appliesIf": [
17
+ "persisted_lineage"
18
+ ]
19
+ },
20
+ async s => {
21
+ await s.notebook(["c0", "c1", "c2"]);
22
+ const tab = s.tab("tab");
23
+
24
+ await s.step(1, "Server", "loads the notebook: its history is over the size limit, so it keeps no record", async () => {
25
+ // nothing for a test to do: the storyboard states what is so
26
+ });
27
+ await s.step(2, "Your tab", "opens the notebook", async () => {
28
+ await tab.open();
29
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
30
+ });
31
+ await s.step(3, "Your tab", "loses its connection", async () => {
32
+ await tab.goOffline();
33
+ });
34
+ await s.step(4, "Server", "lets go of the notebook, then builds it again from the file; still no record", async () => {
35
+ await s.releaseRoom();
36
+ });
37
+ await s.step(5, "Your tab", "reconnects", async () => {
38
+ await tab.goOnline();
39
+ });
40
+
41
+ await s.ends([
42
+ { label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
43
+ ]);
44
+ }
45
+ )
46
+ );
47
+
48
+ // The server finds a history record that was written by another version: an older release of the library that holds the history, a newer one, another format, or another major version of the notebook library. It uses what it can read, ignores what it cannot, and never crashes.
49
+ test(
50
+ ...story(
51
+ {
52
+ "id": "S13",
53
+ "group": "lineage",
54
+ "title": "A history record written by another version of the software",
55
+ "requires": [
56
+ "historyRecord",
57
+ "releaseRoom"
58
+ ],
59
+ "appliesIf": [
60
+ "persisted_lineage"
61
+ ]
62
+ },
63
+ async s => {
64
+ await s.notebook(["c0", "c1", "c2"]);
65
+ const tab = s.tab("tab");
66
+
67
+ await s.step(1, "Your tab", "opens the notebook", async () => {
68
+ await tab.open();
69
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
70
+ });
71
+ await s.step(2, "History record", "the server keeps a record of the notebook's history", async () => {
72
+ // the server keeps a record of the notebook's history
73
+ });
74
+ await s.step(3, "Your tab", "loses its connection", async () => {
75
+ await tab.goOffline();
76
+ });
77
+ await s.step(4, "Server", "lets go of the notebook", async () => {
78
+ await s.releaseRoom();
79
+ });
80
+ await s.step(5, "History record", "the record is rewritten, as if by another version: five separate cases", async () => {
81
+ // the record is rewritten, as if by another version: five separate cases
82
+ });
83
+ await s.step(6, "Server", "builds the notebook again from the file; it uses the record only if it can read it", async () => {
84
+ // nothing for a test to do: the storyboard states what is so
85
+ });
86
+ await s.step(7, "Your tab", "reconnects", async () => {
87
+ await tab.goOnline();
88
+ });
89
+
90
+ await s.ends([
91
+ { label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
92
+ ]);
93
+ }
94
+ )
95
+ );
96
+
97
+ // A notebook whose top-level metadata is empty is restored from the server's record like any other. The server must not mistake the defaults it fills in for a change made to the file.
98
+ test(
99
+ ...story(
100
+ {
101
+ "id": "S14",
102
+ "group": "lineage",
103
+ "title": "A notebook with empty metadata is restored without needless work",
104
+ "requires": [
105
+ "historyRecord",
106
+ "releaseRoom"
107
+ ],
108
+ "appliesIf": [
109
+ "persisted_lineage"
110
+ ]
111
+ },
112
+ async s => {
113
+ await s.notebook(["c0", "c1", "c2"]);
114
+ const tab = s.tab("tab");
115
+
116
+ await s.step(1, "Your tab", "opens the notebook", async () => {
117
+ await tab.open();
118
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
119
+ });
120
+ await s.step(2, "History record", "the server keeps a record of the notebook's history", async () => {
121
+ // the server keeps a record of the notebook's history
122
+ });
123
+ await s.step(3, "Your tab", "loses its connection", async () => {
124
+ await tab.goOffline();
125
+ });
126
+ await s.step(4, "Server", "builds the notebook again from its record and compares it with the file: nothing differs, so nothing is flagged as changed", async () => {
127
+ await s.releaseRoom();
128
+ });
129
+ await s.step(5, "Your tab", "reconnects: the tab and the server already agree", async () => {
130
+ await tab.goOnline();
131
+ });
132
+
133
+ await s.ends([
134
+ { label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
135
+ ]);
136
+ }
137
+ )
138
+ );
139
+
140
+ // A tab syncs with a server that keeps no history record. Later the server starts keeping one (for instance after an upgrade, or when history records are turned on). The notebook is built again from the file with a new history, and the tab, which holds the old one, must not assume that the two are the same history.
141
+ test(
142
+ ...story(
143
+ {
144
+ "id": "T1",
145
+ "group": "lineage",
146
+ "title": "The server starts keeping a history record after a tab met one that kept none",
147
+ "requires": [
148
+ "historyRecord",
149
+ "releaseRoom"
150
+ ],
151
+ "appliesIf": [
152
+ "persisted_lineage"
153
+ ]
154
+ },
155
+ async s => {
156
+ await s.notebook(["c0", "c1", "c2"]);
157
+ const tab = s.tab("tab");
158
+
159
+ await s.step(1, "Server", "keeps no history record", async () => {
160
+ // nothing for a test to do: the storyboard states what is so
161
+ });
162
+ await s.step(2, "Your tab", "opens the notebook", async () => {
163
+ await tab.open();
164
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
165
+ });
166
+ await s.step(3, "Your tab", "loses its connection", async () => {
167
+ await tab.goOffline();
168
+ });
169
+ await s.step(4, "Server", "now keeps a history record: builds the notebook from the file with a new history", async () => {
170
+ await s.releaseRoom();
171
+ });
172
+ await s.step(5, "History record", "the new record", async () => {
173
+ // the new record
174
+ });
175
+ await s.step(6, "Your tab", "reconnects: it cannot tell that this history continues its own, so it takes the server's copy", async () => {
176
+ await tab.goOnline();
177
+ });
178
+
179
+ await s.ends([
180
+ { label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
181
+ ]);
182
+ }
183
+ )
184
+ );
185
+
186
+ // A tab types and the server is shut down while the update is still waiting in its queue. The server applies the waiting update and saves it, and when the notebook is built again it holds the edit.
187
+ test(
188
+ ...story(
189
+ {
190
+ "id": "X5",
191
+ "group": "lineage",
192
+ "title": "An update waiting when the server shuts down is kept in the record",
193
+ "requires": [
194
+ "historyRecord",
195
+ "releaseRoom"
196
+ ],
197
+ "appliesIf": [
198
+ "persisted_lineage"
199
+ ]
200
+ },
201
+ async s => {
202
+ await s.notebook(["c0", "c1", "c2"]);
203
+ const tab = s.tab("tab");
204
+
205
+ await s.step(1, "Your tab", "opens the notebook", async () => {
206
+ await tab.open();
207
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
208
+ });
209
+ await s.step(2, "Your tab", "types “+QUEUED” into c0; the update is on its way to the server", async () => {
210
+ await tab.type(0, " +QUEUED");
211
+ await s.settle(tab);
212
+ await s.expectTab(tab, ["c0 +QUEUED", "c1", "c2"]);
213
+ });
214
+ await s.step(3, "Your tab", "loses its connection as the server shuts down", async () => {
215
+ await tab.goOffline();
216
+ });
217
+ await s.step(4, "Server", "is shut down while the update is still waiting in its queue", async () => {
218
+ await s.releaseRoom();
219
+ });
220
+ await s.step(5, "Server", "applies the waiting update and saves it", async () => {
221
+ // nothing for a test to do: the storyboard states what is so
222
+ });
223
+ await s.step(6, "History record", "holds the edit", async () => {
224
+ // holds the edit
225
+ });
226
+ await s.step(7, "File on disk", "holds the edit", async () => {
227
+ // nothing for a test to do: the storyboard states what is so
228
+ });
229
+ await s.step(8, "Server", "builds the notebook again: it holds the edit", async () => {
230
+ // nothing for a test to do: the storyboard states what is so
231
+ });
232
+ await s.step(9, "Your tab", "reconnects: the tab already agrees with the server", async () => {
233
+ await tab.goOnline();
234
+ });
235
+
236
+ await s.ends([
237
+ { label: "As the story ends", ends: { tab: ["c0 +QUEUED", "c1", "c2"], server: ["c0 +QUEUED", "c1", "c2"], file: ["c0 +QUEUED", "c1", "c2"] } },
238
+ ]);
239
+ }
240
+ )
241
+ );
@@ -0,0 +1,258 @@
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
+ // An older notebook (written before cell ids existed) has an output in each cell. The server gives its cells new ids every time it loads it, and keeps the outputs in a separate output store. The server lets go of the notebook, builds it again and saves.
6
+ test(
7
+ ...story(
8
+ {
9
+ "id": "O1",
10
+ "group": "outputs",
11
+ "title": "Outputs survive a rebuild, in a notebook without cell ids",
12
+ "requires": [
13
+ "historyRecord",
14
+ "releaseRoom"
15
+ ]
16
+ },
17
+ async s => {
18
+ await s.notebook(["c0", "c1", "c2"]);
19
+
20
+ await s.step(1, "Server", "loads the notebook; the cells have no ids, so it gives them ids", async () => {
21
+ // nothing for a test to do: the storyboard states what is so
22
+ });
23
+ await s.step(2, "Output store", "is filled from the outputs in the file", async () => {
24
+ // is filled from the outputs in the file
25
+ });
26
+ await s.step(3, "Server", "lets go of the notebook; nothing is unsaved, so nothing is written", async () => {
27
+ await s.releaseRoom();
28
+ });
29
+ await s.step(4, "Server", "builds the notebook again from the file; the cells get new ids", async () => {
30
+ // nothing for a test to do: the storyboard states what is so
31
+ });
32
+ await s.step(5, "Output store", "is filled again, under the new ids", async () => {
33
+ // is filled again, under the new ids
34
+ });
35
+ await s.step(6, "File on disk", "the server saves the notebook", async () => {
36
+ // nothing for a test to do: the storyboard states what is so
37
+ });
38
+
39
+ await s.ends([
40
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
41
+ ]);
42
+ }
43
+ )
44
+ );
45
+
46
+ // The same story with a recent notebook, whose cells have ids that stay the same from one load to the next.
47
+ test(
48
+ ...story(
49
+ {
50
+ "id": "O2",
51
+ "group": "outputs",
52
+ "title": "Control: outputs survive a rebuild, in a notebook with cell ids",
53
+ "requires": [
54
+ "historyRecord",
55
+ "releaseRoom"
56
+ ]
57
+ },
58
+ async s => {
59
+ await s.notebook(["c0", "c1", "c2"]);
60
+
61
+ await s.step(1, "Server", "loads the notebook", async () => {
62
+ // nothing for a test to do: the storyboard states what is so
63
+ });
64
+ await s.step(2, "Output store", "is filled from the outputs in the file", async () => {
65
+ // is filled from the outputs in the file
66
+ });
67
+ await s.step(3, "Server", "lets go of the notebook; nothing is unsaved, so nothing is written", async () => {
68
+ await s.releaseRoom();
69
+ });
70
+ await s.step(4, "Server", "builds the notebook again from the file", async () => {
71
+ // nothing for a test to do: the storyboard states what is so
72
+ });
73
+ await s.step(5, "Output store", "is filled again", async () => {
74
+ // is filled again
75
+ });
76
+ await s.step(6, "File on disk", "the server saves the notebook", async () => {
77
+ // nothing for a test to do: the storyboard states what is so
78
+ });
79
+
80
+ await s.ends([
81
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
82
+ ]);
83
+ }
84
+ )
85
+ );
86
+
87
+ // Like the first story, but the output store (a runtime directory) is wiped between the moment the server lets go of the notebook and the moment it builds it again. The outputs in the file are all that is left.
88
+ test(
89
+ ...story(
90
+ {
91
+ "id": "O3",
92
+ "group": "outputs",
93
+ "title": "Outputs survive a wiped output store, in a notebook without cell ids",
94
+ "requires": [
95
+ "historyRecord",
96
+ "releaseRoom"
97
+ ]
98
+ },
99
+ async s => {
100
+ await s.notebook(["c0", "c1", "c2"]);
101
+
102
+ await s.step(1, "Server", "loads the notebook; the cells have no ids, so it gives them ids", async () => {
103
+ // nothing for a test to do: the storyboard states what is so
104
+ });
105
+ await s.step(2, "Output store", "is filled from the outputs in the file", async () => {
106
+ // is filled from the outputs in the file
107
+ });
108
+ await s.step(3, "Server", "lets go of the notebook; nothing is unsaved, so nothing is written", async () => {
109
+ await s.releaseRoom();
110
+ });
111
+ await s.step(4, "Output store", "is wiped: the runtime directory is gone", async () => {
112
+ // is wiped: the runtime directory is gone
113
+ });
114
+ await s.step(5, "Server", "builds the notebook again from the file; the cells get new ids", async () => {
115
+ // nothing for a test to do: the storyboard states what is so
116
+ });
117
+ await s.step(6, "Output store", "is filled again from the file", async () => {
118
+ // is filled again from the file
119
+ });
120
+ await s.step(7, "File on disk", "the server saves the notebook", async () => {
121
+ // nothing for a test to do: the storyboard states what is so
122
+ });
123
+
124
+ await s.ends([
125
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
126
+ ]);
127
+ }
128
+ )
129
+ );
130
+
131
+ // The same story as the previous one, with a recent notebook whose cells have stable ids.
132
+ test(
133
+ ...story(
134
+ {
135
+ "id": "O4",
136
+ "group": "outputs",
137
+ "title": "Outputs survive a wiped output store, in a notebook with cell ids",
138
+ "requires": [
139
+ "historyRecord",
140
+ "releaseRoom"
141
+ ]
142
+ },
143
+ async s => {
144
+ await s.notebook(["c0", "c1", "c2"]);
145
+
146
+ await s.step(1, "Server", "loads the notebook", async () => {
147
+ // nothing for a test to do: the storyboard states what is so
148
+ });
149
+ await s.step(2, "Output store", "is filled from the outputs in the file", async () => {
150
+ // is filled from the outputs in the file
151
+ });
152
+ await s.step(3, "Server", "lets go of the notebook; nothing is unsaved, so nothing is written", async () => {
153
+ await s.releaseRoom();
154
+ });
155
+ await s.step(4, "Output store", "is wiped: the runtime directory is gone", async () => {
156
+ // is wiped: the runtime directory is gone
157
+ });
158
+ await s.step(5, "Server", "builds the notebook again from the file", async () => {
159
+ // nothing for a test to do: the storyboard states what is so
160
+ });
161
+ await s.step(6, "Output store", "is filled again from the file", async () => {
162
+ // is filled again from the file
163
+ });
164
+ await s.step(7, "File on disk", "the server saves the notebook", async () => {
165
+ // nothing for a test to do: the storyboard states what is so
166
+ });
167
+
168
+ await s.ends([
169
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
170
+ ]);
171
+ }
172
+ )
173
+ );
174
+
175
+ // In one mode the notebook file carries no outputs: they live only in the output store, and the open notebook links each cell to its output. The server saves, lets go of the notebook and builds it again.
176
+ test(
177
+ ...story(
178
+ {
179
+ "id": "O5",
180
+ "group": "outputs",
181
+ "title": "Outputs that live only in the store survive a rebuild",
182
+ "requires": [
183
+ "historyRecord",
184
+ "releaseRoom"
185
+ ]
186
+ },
187
+ async s => {
188
+ await s.notebook(["c0", "c1", "c2"]);
189
+
190
+ await s.step(1, "Server", "loads the notebook; the outputs move to the store, and each cell links to its output", async () => {
191
+ // nothing for a test to do: the storyboard states what is so
192
+ });
193
+ await s.step(2, "Output store", "holds the outputs", async () => {
194
+ // holds the outputs
195
+ });
196
+ await s.step(3, "File on disk", "the server saves: the file holds no outputs", async () => {
197
+ // nothing for a test to do: the storyboard states what is so
198
+ });
199
+ await s.step(4, "Server", "lets go of the notebook", async () => {
200
+ await s.releaseRoom();
201
+ });
202
+ await s.step(5, "Server", "builds the notebook again from the file; the store still has the outputs", async () => {
203
+ // nothing for a test to do: the storyboard states what is so
204
+ });
205
+ await s.step(6, "File on disk", "the server saves again", async () => {
206
+ // nothing for a test to do: the storyboard states what is so
207
+ });
208
+
209
+ await s.ends([
210
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
211
+ ]);
212
+ }
213
+ )
214
+ );
215
+
216
+ // Like the previous story, but the output store is wiped before the notebook is built again. The outputs are gone, since the store was their only home. What matters is that the rebuilt notebook is consistent: no cell links to an output that is not there.
217
+ test(
218
+ ...story(
219
+ {
220
+ "id": "O6",
221
+ "group": "outputs",
222
+ "title": "Outputs that live only in the store: the store is wiped",
223
+ "requires": [
224
+ "historyRecord",
225
+ "releaseRoom"
226
+ ]
227
+ },
228
+ async s => {
229
+ await s.notebook(["c0", "c1", "c2"]);
230
+
231
+ await s.step(1, "Server", "loads the notebook; the outputs move to the store, and each cell links to its output", async () => {
232
+ // nothing for a test to do: the storyboard states what is so
233
+ });
234
+ await s.step(2, "Output store", "holds the outputs", async () => {
235
+ // holds the outputs
236
+ });
237
+ await s.step(3, "File on disk", "the server saves: the file holds no outputs", async () => {
238
+ await s.expectFile(["c0", "c1", "c2"]);
239
+ });
240
+ await s.step(4, "Server", "lets go of the notebook", async () => {
241
+ await s.releaseRoom();
242
+ });
243
+ await s.step(5, "Output store", "is wiped: the runtime directory is gone", async () => {
244
+ // is wiped: the runtime directory is gone
245
+ });
246
+ await s.step(6, "Server", "builds the notebook again from the file; there is nothing in the store to refer to", async () => {
247
+ // nothing for a test to do: the storyboard states what is so
248
+ });
249
+ await s.step(7, "File on disk", "the server saves again", async () => {
250
+ // nothing for a test to do: the storyboard states what is so
251
+ });
252
+
253
+ await s.ends([
254
+ { label: "As the story ends", ends: { file: ["c0", "c1", "c2"] } },
255
+ ]);
256
+ }
257
+ )
258
+ );