@elaraai/e3-api-server 1.0.88 → 1.0.89

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 (44) hide show
  1. package/README.md +19 -2
  2. package/dist/src/beast2.d.ts +7 -1
  3. package/dist/src/beast2.d.ts.map +1 -1
  4. package/dist/src/beast2.js +8 -1
  5. package/dist/src/beast2.js.map +1 -1
  6. package/dist/src/conditional.d.ts +86 -0
  7. package/dist/src/conditional.d.ts.map +1 -0
  8. package/dist/src/conditional.js +97 -0
  9. package/dist/src/conditional.js.map +1 -0
  10. package/dist/src/handlers/dataflow.d.ts +15 -3
  11. package/dist/src/handlers/dataflow.d.ts.map +1 -1
  12. package/dist/src/handlers/dataflow.js +23 -5
  13. package/dist/src/handlers/dataflow.js.map +1 -1
  14. package/dist/src/handlers/dataflow.spec.js +64 -9
  15. package/dist/src/handlers/dataflow.spec.js.map +1 -1
  16. package/dist/src/handlers/tasks.d.ts +16 -2
  17. package/dist/src/handlers/tasks.d.ts.map +1 -1
  18. package/dist/src/handlers/tasks.js +20 -13
  19. package/dist/src/handlers/tasks.js.map +1 -1
  20. package/dist/src/handlers/tasks.spec.js +75 -3
  21. package/dist/src/handlers/tasks.spec.js.map +1 -1
  22. package/dist/src/handlers/workspaces.d.ts +25 -5
  23. package/dist/src/handlers/workspaces.d.ts.map +1 -1
  24. package/dist/src/handlers/workspaces.js +35 -33
  25. package/dist/src/handlers/workspaces.js.map +1 -1
  26. package/dist/src/handlers/workspaces.spec.js +121 -3
  27. package/dist/src/handlers/workspaces.spec.js.map +1 -1
  28. package/dist/src/index.d.ts +1 -0
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/index.js +3 -0
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/portable.d.ts +1 -0
  33. package/dist/src/portable.d.ts.map +1 -1
  34. package/dist/src/portable.js +3 -0
  35. package/dist/src/portable.js.map +1 -1
  36. package/dist/src/routes/executions.d.ts.map +1 -1
  37. package/dist/src/routes/executions.js +3 -2
  38. package/dist/src/routes/executions.js.map +1 -1
  39. package/dist/src/routes/workspaces.js +2 -2
  40. package/dist/src/routes/workspaces.js.map +1 -1
  41. package/dist/src/server.d.ts.map +1 -1
  42. package/dist/src/server.js +4 -3
  43. package/dist/src/server.js.map +1 -1
  44. package/package.json +4 -4
package/README.md CHANGED
@@ -304,7 +304,7 @@ All endpoints are prefixed with `/api/repos/:repo` where `:repo` is:
304
304
  | POST | `/api/repos/:repo/workspaces` | Create workspace |
305
305
  | POST | `/api/repos/:repo/workspaces/:ws/copy` | Copy the workspace to the one the body names (`to`), made or replaced whole: it becomes this workspace as it is now. Answers the target as the list gives it |
306
306
  | GET | `/api/repos/:repo/workspaces/:ws` | Get workspace info |
307
- | GET | `/api/repos/:repo/workspaces/:ws/status` | Get workspace status (datasets, tasks, summary). With `?path=` (repeated, each a dataset's keypath, `.inputs.x`), only those datasets and the tasks producing them, each as the whole status gives it: a path that names no dataset is left out, and one that is no keypath is refused 400 `bad_request` |
307
+ | GET | `/api/repos/:repo/workspaces/:ws/status` | Get workspace status (datasets, tasks, summary). With `?path=` (repeated, each a dataset's keypath, `.inputs.x`), only those datasets and the tasks producing them, each as the whole status gives it: a path that names no dataset is left out, and one that is no keypath is refused 400 `bad_request`. The answer carries an `ETag`; a request whose `If-None-Match` names it is answered `304 Not Modified` with no body, nothing of the workspace read but its revision |
308
308
  | POST | `/api/repos/:repo/workspaces/:ws/deploy` | Start deploying a package to the workspace, as a job: answers the job's id |
309
309
  | GET | `/api/repos/:repo/workspaces/:ws/deploy/:id` | Poll a deploy job: `processing` with how far it has got, what the deploy did for each record, index and input, or why it failed |
310
310
  | GET | `/api/repos/:repo/workspaces/:ws/lock` | What holds the workspace exclusively, and how far it says it has got; none when nothing does |
@@ -329,6 +329,23 @@ which `/lock` answers. A workspace deployed for the first time has no status
329
329
  until its deploy ends, so `/lock` is where another client, such as e3-ui's TUI,
330
330
  follows that deploy.
331
331
 
332
+ A status is answered conditionally. Its `ETag` names the workspace's status
333
+ revision, which moves with every write of one of its dataset refs, of its
334
+ record, of any run's record of the repository (a split task's unit changes
335
+ nothing a status answers, so its write leaves it), and with its lock: a poll
336
+ that sends the tag back as `If-None-Match` is answered `304 Not Modified`
337
+ while nothing has moved, which reads the revision and nothing else of the
338
+ workspace. The revision is read before the status is computed, so a tag is
339
+ never newer than the answer it names. Both answers are `Cache-Control:
340
+ no-store`: no cache between keeps a status, or answers a poll in the server's
341
+ place; with `--cors` the `ETag` is exposed, so a browser client reads it. The
342
+ tag does not name the runner's view of an execution recorded running, so a
343
+ client that must notice a runner gone asks unconditionally now and then:
344
+ e3-api-client's `workspaceStatusSince` asks conditionally, and
345
+ e3-ui-components' dataset cache asks unconditionally once its last full answer
346
+ is thirty seconds old, and after a fetch it made failed, a new watch or a
347
+ refresh.
348
+
332
349
  A copy writes refs only — within a repository every value is shared by its
333
350
  hash — so it costs what the workspace has of datasets, never what they weigh,
334
351
  and nothing the target holds needs to run again. A target that exists loses its
@@ -444,7 +461,7 @@ grant polls only a platform-free call, or one such a caller launched.
444
461
  | Method | Endpoint | Description |
445
462
  |--------|----------|-------------|
446
463
  | POST | `/api/repos/:repo/workspaces/:ws/dataflow` | Start a run of the dataflow (answers 202 once it has started) |
447
- | GET | `/api/repos/:repo/workspaces/:ws/dataflow` | Get workspace status (for polling) |
464
+ | GET | `/api/repos/:repo/workspaces/:ws/dataflow` | Get workspace status (for polling), with the `ETag` and `304 Not Modified` of `/workspaces/:ws/status` |
448
465
  | GET | `/api/repos/:repo/workspaces/:ws/dataflow/execution` | The latest run's state, its id (`runId`) and the sequence number of its last event (`lastSeq`), and its events past the poll's cursor (`since`, the `nextSeq` the poll before answered; at most `limit` of them, and never more than 1,000, the default: a `nextSeq` before `lastSeq` left some for the next poll), with the server's budget in use; while the run is in flight, the tasks and units waiting for room and each split task's progress, as the orchestrator running it answers them. A run asked to stop that has not yet stopped is `stopping` |
449
466
  | GET | `/api/repos/:repo/workspaces/:ws/dataflow/budget` | The budget a run gets: the server's cores and memory, and what its runners hold now (`none` from a host whose runners hold none) |
450
467
  | POST | `/api/repos/:repo/workspaces/:ws/dataflow/cancel` | Cancel the run in progress: this server answers once the run has ended; a host whose run's tasks run elsewhere may answer once the cancel is recorded, the poll answering the run `stopping` until it has stopped. e3-api-client's `dataflowCancel` follows the run until it has |
@@ -17,8 +17,14 @@ export declare function decodeBeast2<T extends EastType>(data: Uint8Array, type:
17
17
  * Send BEAST2 success response.
18
18
  *
19
19
  * Returns a web Response object that can be used by both Hono routes and Lambda handlers.
20
+ *
21
+ * @param type - The type of the answer's value
22
+ * @param value - The answer's value
23
+ * @param headers - Headers beside the body's, such as the `ETag` a
24
+ * conditional route names its answer by
25
+ * @returns The response
20
26
  */
21
- export declare function sendSuccess<T extends EastType>(type: T, value: ValueTypeOf<T>): Response;
27
+ export declare function sendSuccess<T extends EastType>(type: T, value: ValueTypeOf<T>, headers?: Record<string, string>): Response;
22
28
  /**
23
29
  * Send BEAST2 error response.
24
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"beast2.d.ts","sourceRoot":"","sources":["../../src/beast2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,QAAQ,EACjD,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,CAAC,GACN,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAUzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAC7C,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,CAAC,GACN,WAAW,CAAC,CAAC,CAAC,CAGhB;AAED;;;;GA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CAAC,CAAC,SAAS,QAAQ,EAC1C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,GACX,QAAQ,CAYV;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,QAAQ,EACtD,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,MAAM,EAAE,MAAM,GACb,QAAQ,CAYV"}
@@ -29,8 +29,14 @@ export function decodeBeast2(data, type) {
29
29
  * Send BEAST2 success response.
30
30
  *
31
31
  * Returns a web Response object that can be used by both Hono routes and Lambda handlers.
32
+ *
33
+ * @param type - The type of the answer's value
34
+ * @param value - The answer's value
35
+ * @param headers - Headers beside the body's, such as the `ETag` a
36
+ * conditional route names its answer by
37
+ * @returns The response
32
38
  */
33
- export function sendSuccess(type, value) {
39
+ export function sendSuccess(type, value, headers = {}) {
34
40
  const responseType = ResponseType(type);
35
41
  const encode = encodeBeast2For(responseType); // TODO should we use streaming encoder here?
36
42
  const body = encode(variant('success', value));
@@ -39,6 +45,7 @@ export function sendSuccess(type, value) {
39
45
  headers: {
40
46
  'Content-Type': BEAST2_CONTENT_TYPE,
41
47
  'Content-Length': String(body.byteLength),
48
+ ...headers,
42
49
  },
43
50
  });
44
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"beast2.js","sourceRoot":"","sources":["../../src/beast2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,CAAU,EACV,IAAO;IAEP,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,IAAI,WAAW,KAAK,mB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c,EAAE,mBAAmB;YACnC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC1C;KACF,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAO,EACP,KAAqB,EACrB,MAAc;IAEd,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,6CAA6C;IAC3F,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAqC,CAAC,CAAC;IAEnF,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;QACxB,MAAM;QACN,OAAO,EAAE;YACP,cAAc,EAAE,mBAAmB;YACnC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC1C;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Conditional answers: the `ETag` a status route names its answer by, which a
7
+ * client polling it sends back as `If-None-Match`, and the `304 Not Modified`
8
+ * that answers a request whose tag is still the answer's.
9
+ *
10
+ * @remarks
11
+ * A workspace's status is computed over its records: its dataset refs, its
12
+ * tasks' executions and its lock. Its revision ({@link workspaceStatusRevision})
13
+ * moves whenever any of them does, so a poll whose tag names the revision now
14
+ * is answered without the status being computed, or any record of the
15
+ * workspace read beyond the revision. The revision is read before the status
16
+ * is computed, so the tag an answer carries is never newer than its content:
17
+ * a change between the two moves the revision, and the next poll's tag
18
+ * mismatches. Every answer is `Cache-Control: no-store`
19
+ * ({@link conditionalHeaders}): the tag is for the server to compare, and
20
+ * no cache between keeps a status or answers a poll in the server's place.
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ import { type StorageBackend } from '@elaraai/e3-core/portable';
25
+ /**
26
+ * The entity tag of an answer computed over a revision: the revision, quoted,
27
+ * as `ETag` carries one.
28
+ *
29
+ * @param revision - What the answer is computed over, which moves whenever
30
+ * the answer might
31
+ * @returns The tag
32
+ */
33
+ export declare function etagOf(revision: string): string;
34
+ /**
35
+ * Whether an `If-None-Match` names an answer's tag: `*`, or one of the tags
36
+ * it lists, each a strong or a weak (`W/`) validator.
37
+ *
38
+ * @remarks
39
+ * The comparison is weak, as a conditional GET's is: a weak tag the client
40
+ * holds matches the tag the server computed over the same revision.
41
+ *
42
+ * @param ifNoneMatch - The request's `If-None-Match`, as sent
43
+ * @param etag - The answer's tag, as {@link etagOf} makes it
44
+ * @returns Whether the request holds the answer
45
+ */
46
+ export declare function etagMatches(ifNoneMatch: string, etag: string): boolean;
47
+ /**
48
+ * The headers a conditional answer carries: its `ETag`, and `Cache-Control:
49
+ * no-store`, so no cache between the client and the server keeps a
50
+ * workspace's status for whoever asks next, or answers a poll from what it
51
+ * kept rather than sending the tag on for the server to compare.
52
+ *
53
+ * @param etag - The answer's tag
54
+ * @returns The headers
55
+ */
56
+ export declare function conditionalHeaders(etag: string): Record<string, string>;
57
+ /**
58
+ * The `304 Not Modified` that answers a conditional GET whose tag is still
59
+ * the answer's: no body, and the headers of a conditional answer
60
+ * ({@link conditionalHeaders}), the tag among them.
61
+ *
62
+ * @param etag - The answer's tag
63
+ * @returns The response
64
+ */
65
+ export declare function sendNotModified(etag: string): Response;
66
+ /**
67
+ * The tag of a workspace's status now, and whether a request holds it.
68
+ *
69
+ * @remarks
70
+ * Read before the status is computed, so the tag is never newer than the
71
+ * answer it names.
72
+ *
73
+ * @param storage - Storage backend
74
+ * @param repoPath - Repository identifier
75
+ * @param workspace - Workspace name
76
+ * @param ifNoneMatch - The request's `If-None-Match`, when it sent one
77
+ * @returns The tag, and whether the request holds the answer, in which case
78
+ * the route answers {@link sendNotModified}, and otherwise the answer with
79
+ * {@link conditionalHeaders}
80
+ * @throws {WorkspaceNotFoundError} When there is no such workspace
81
+ */
82
+ export declare function workspaceStatusTag(storage: StorageBackend, repoPath: string, workspace: string, ifNoneMatch?: string): Promise<{
83
+ etag: string;
84
+ held: boolean;
85
+ }>;
86
+ //# sourceMappingURL=conditional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../src/conditional.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEzF;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAItE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAEtD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAG1C"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Conditional answers: the `ETag` a status route names its answer by, which a
7
+ * client polling it sends back as `If-None-Match`, and the `304 Not Modified`
8
+ * that answers a request whose tag is still the answer's.
9
+ *
10
+ * @remarks
11
+ * A workspace's status is computed over its records: its dataset refs, its
12
+ * tasks' executions and its lock. Its revision ({@link workspaceStatusRevision})
13
+ * moves whenever any of them does, so a poll whose tag names the revision now
14
+ * is answered without the status being computed, or any record of the
15
+ * workspace read beyond the revision. The revision is read before the status
16
+ * is computed, so the tag an answer carries is never newer than its content:
17
+ * a change between the two moves the revision, and the next poll's tag
18
+ * mismatches. Every answer is `Cache-Control: no-store`
19
+ * ({@link conditionalHeaders}): the tag is for the server to compare, and
20
+ * no cache between keeps a status or answers a poll in the server's place.
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ import { workspaceStatusRevision } from '@elaraai/e3-core/portable';
25
+ /**
26
+ * The entity tag of an answer computed over a revision: the revision, quoted,
27
+ * as `ETag` carries one.
28
+ *
29
+ * @param revision - What the answer is computed over, which moves whenever
30
+ * the answer might
31
+ * @returns The tag
32
+ */
33
+ export function etagOf(revision) {
34
+ return `"${revision}"`;
35
+ }
36
+ /**
37
+ * Whether an `If-None-Match` names an answer's tag: `*`, or one of the tags
38
+ * it lists, each a strong or a weak (`W/`) validator.
39
+ *
40
+ * @remarks
41
+ * The comparison is weak, as a conditional GET's is: a weak tag the client
42
+ * holds matches the tag the server computed over the same revision.
43
+ *
44
+ * @param ifNoneMatch - The request's `If-None-Match`, as sent
45
+ * @param etag - The answer's tag, as {@link etagOf} makes it
46
+ * @returns Whether the request holds the answer
47
+ */
48
+ export function etagMatches(ifNoneMatch, etag) {
49
+ const held = ifNoneMatch.trim();
50
+ if (held === '*')
51
+ return true;
52
+ return held.split(',').some((tag) => tag.trim().replace(/^W\//, '') === etag);
53
+ }
54
+ /**
55
+ * The headers a conditional answer carries: its `ETag`, and `Cache-Control:
56
+ * no-store`, so no cache between the client and the server keeps a
57
+ * workspace's status for whoever asks next, or answers a poll from what it
58
+ * kept rather than sending the tag on for the server to compare.
59
+ *
60
+ * @param etag - The answer's tag
61
+ * @returns The headers
62
+ */
63
+ export function conditionalHeaders(etag) {
64
+ return { ETag: etag, 'Cache-Control': 'no-store' };
65
+ }
66
+ /**
67
+ * The `304 Not Modified` that answers a conditional GET whose tag is still
68
+ * the answer's: no body, and the headers of a conditional answer
69
+ * ({@link conditionalHeaders}), the tag among them.
70
+ *
71
+ * @param etag - The answer's tag
72
+ * @returns The response
73
+ */
74
+ export function sendNotModified(etag) {
75
+ return new Response(null, { status: 304, headers: conditionalHeaders(etag) });
76
+ }
77
+ /**
78
+ * The tag of a workspace's status now, and whether a request holds it.
79
+ *
80
+ * @remarks
81
+ * Read before the status is computed, so the tag is never newer than the
82
+ * answer it names.
83
+ *
84
+ * @param storage - Storage backend
85
+ * @param repoPath - Repository identifier
86
+ * @param workspace - Workspace name
87
+ * @param ifNoneMatch - The request's `If-None-Match`, when it sent one
88
+ * @returns The tag, and whether the request holds the answer, in which case
89
+ * the route answers {@link sendNotModified}, and otherwise the answer with
90
+ * {@link conditionalHeaders}
91
+ * @throws {WorkspaceNotFoundError} When there is no such workspace
92
+ */
93
+ export async function workspaceStatusTag(storage, repoPath, workspace, ifNoneMatch) {
94
+ const etag = etagOf(await workspaceStatusRevision(storage, repoPath, workspace));
95
+ return { etag, held: ifNoneMatch !== undefined && etagMatches(ifNoneMatch, etag) };
96
+ }
97
+ //# sourceMappingURL=conditional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../src/conditional.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,uBAAuB,EAAuB,MAAM,2BAA2B,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,QAAgB;IACrC,OAAO,IAAI,QAAQ,GAAG,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,WAAmB,EAAE,IAAY;IAC3D,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAuB,EACvB,QAAgB,EAChB,SAAiB,EACjB,WAAoB;IAEpB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAAuB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IACjF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;AACrF,CAAC"}
@@ -61,16 +61,28 @@ export declare function startDataflow(storage: StorageBackend, orchestrator: Dat
61
61
  verbose?: boolean;
62
62
  }): Promise<Response>;
63
63
  /**
64
- * Get workspace status (for polling).
64
+ * Get workspace status (for polling), conditionally: the answer carries an
65
+ * `ETag` naming the workspace's status revision, and a poll whose
66
+ * `If-None-Match` names the revision now is answered `304 Not Modified`,
67
+ * with nothing of the workspace read but its revision.
68
+ *
69
+ * @remarks
70
+ * The revision is read before the status is computed, so the tag an answer
71
+ * carries is never newer than its content. The tag does not name the runner's
72
+ * view of an execution recorded running: a client that must notice a runner
73
+ * gone polls unconditionally now and then.
65
74
  *
66
75
  * @param storage - Storage backend
67
76
  * @param runner - The runner the repository's tasks run on, which says
68
77
  * whether an execution recorded running can still finish
69
78
  * @param repoPath - The repository's path
70
79
  * @param workspace - The workspace
71
- * @returns The response: the status, or the error
80
+ * @param ifNoneMatch - The poll's `If-None-Match`, when it sent one: the tag
81
+ * of the answer it holds
82
+ * @returns The response: the status, with its `ETag`; `304 Not Modified`
83
+ * when the poll holds it — each `Cache-Control: no-store`; or the error
72
84
  */
73
- export declare function getDataflowStatus(storage: StorageBackend, runner: TaskRunner, repoPath: string, workspace: string): Promise<Response>;
85
+ export declare function getDataflowStatus(storage: StorageBackend, runner: TaskRunner, repoPath: string, workspace: string, ifNoneMatch?: string): Promise<Response>;
74
86
  /**
75
87
  * Get dependency graph.
76
88
  */
@@ -1 +1 @@
1
- {"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../src/handlers/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA+FvH;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;2CACuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAmDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,oBAAoB,EAClC,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO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;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,mBAAmB,EAC/B,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAenB"}
@@ -6,6 +6,7 @@ import { IntegerType, NullType, OptionType, lessFor, some, none, variant } from
6
6
  import { DATAFLOW_POLL_EVENTS_MAX } from '@elaraai/e3-types';
7
7
  import { dataflowGetGraph, workspaceStatus, workspaceGetTaskHash, executionFindCurrent, executionReadLog, checkName, ExecutionNotFoundError, WorkspaceLockError, coreEventToApiEvent, summaryToApiStatus, } from '@elaraai/e3-core/portable';
8
8
  import { sendSuccess, sendError, sendSuccessWithStatus } from '../beast2.js';
9
+ import { conditionalHeaders, sendNotModified, workspaceStatusTag } from '../conditional.js';
9
10
  import { errorToVariant } from '../errors.js';
10
11
  import { sendLockRefusal, stoppingRunBefore } from '../stopping-run.js';
11
12
  import { WorkspaceStatusResultType, DataflowGraphType, TaskLogChunkType, DataflowExecutionStateType, DataflowBudgetType, } from '../types.js';
@@ -190,19 +191,34 @@ export async function startDataflow(storage, orchestrator, stateStore, repoPath,
190
191
  }
191
192
  }
192
193
  /**
193
- * Get workspace status (for polling).
194
+ * Get workspace status (for polling), conditionally: the answer carries an
195
+ * `ETag` naming the workspace's status revision, and a poll whose
196
+ * `If-None-Match` names the revision now is answered `304 Not Modified`,
197
+ * with nothing of the workspace read but its revision.
198
+ *
199
+ * @remarks
200
+ * The revision is read before the status is computed, so the tag an answer
201
+ * carries is never newer than its content. The tag does not name the runner's
202
+ * view of an execution recorded running: a client that must notice a runner
203
+ * gone polls unconditionally now and then.
194
204
  *
195
205
  * @param storage - Storage backend
196
206
  * @param runner - The runner the repository's tasks run on, which says
197
207
  * whether an execution recorded running can still finish
198
208
  * @param repoPath - The repository's path
199
209
  * @param workspace - The workspace
200
- * @returns The response: the status, or the error
210
+ * @param ifNoneMatch - The poll's `If-None-Match`, when it sent one: the tag
211
+ * of the answer it holds
212
+ * @returns The response: the status, with its `ETag`; `304 Not Modified`
213
+ * when the poll holds it — each `Cache-Control: no-store`; or the error
201
214
  */
202
- export async function getDataflowStatus(storage, runner, repoPath, workspace) {
215
+ export async function getDataflowStatus(storage, runner, repoPath, workspace, ifNoneMatch) {
203
216
  try {
217
+ const tag = await workspaceStatusTag(storage, repoPath, workspace, ifNoneMatch);
218
+ if (tag.held)
219
+ return sendNotModified(tag.etag);
204
220
  const result = await workspaceStatus(storage, runner, repoPath, workspace);
205
- return sendSuccess(WorkspaceStatusResultType, convertWorkspaceStatus(result));
221
+ return sendSuccess(WorkspaceStatusResultType, convertWorkspaceStatus(result), conditionalHeaders(tag.etag));
206
222
  }
207
223
  catch (err) {
208
224
  return sendError(WorkspaceStatusResultType, errorToVariant(err));
@@ -386,6 +402,8 @@ export async function getDataflowExecution(stateStore, orchestrator, repoPath, w
386
402
  // the next served. The run's events are read a page of `limit` at a time,
387
403
  // at most POLL_PAGES of them, so a poll reads what it serves and the events
388
404
  // between, and a run of events the API does not show is served over polls.
405
+ // Each page is read up to the summary's last event, so a run that goes on
406
+ // recording never has a page read past what the poll serves.
389
407
  let run;
390
408
  const apiEvents = [];
391
409
  let nextSeq = since;
@@ -393,7 +411,7 @@ export async function getDataflowExecution(stateStore, orchestrator, repoPath, w
393
411
  run = await stateStore.readLatestSummary(repoPath, workspace);
394
412
  if (run !== null && limit !== 0) {
395
413
  paging: for (let page = 0; page < POLL_PAGES && apiEvents.length < limit && seqBefore(nextSeq, run.lastSeq); page++) {
396
- const stored = await stateStore.getEventsSince(repoPath, workspace, run.id, Number(nextSeq), limit);
414
+ const stored = await stateStore.getEventsSince(repoPath, workspace, run.id, Number(nextSeq), limit, Number(run.lastSeq));
397
415
  if (stored.length === 0)
398
416
  break;
399
417
  for (const event of stored) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../../../src/handlers/dataflow.ts"],"names":[],"mappings":"AA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AAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
@@ -12,13 +12,13 @@
12
12
  import { describe, it } from 'node:test';
13
13
  import assert from 'node:assert/strict';
14
14
  import { Hono } from 'hono';
15
- import { NullType, OptionType, decodeBeast2For, encodeBeast2For, equalFor, none, printFor, some, variant } from '@elaraai/east';
16
- import { Budget, InMemoryStateStore, LocalOrchestrator, MockTaskRunner, stateToStatus, } from '@elaraai/e3-core';
15
+ import { IntegerType, NullType, OptionType, decodeBeast2For, encodeBeast2For, equalFor, none, printFor, some, toEastTypeValue, variant, } from '@elaraai/east';
16
+ import { Budget, InMemoryStateStore, LocalOrchestrator, MockTaskRunner, stateToStatus, storeDatasetBytes, } from '@elaraai/e3-core';
17
17
  import { InMemoryStorage } from '@elaraai/e3-core/test';
18
- import { BEAST2_CONTENT_TYPE, E3_RELEASE, dataflowForce } from '@elaraai/e3-types';
18
+ import { BEAST2_CONTENT_TYPE, E3_RELEASE, PackageObjectType, WorkspaceRecordType, dataflowForce } from '@elaraai/e3-types';
19
19
  import { createExecutionRoutes } from '../routes/executions.js';
20
20
  import { createServer } from '../server.js';
21
- import { DataflowBudgetType, DataflowExecutionStateType, DataflowRequestType, ResponseType } from '../types.js';
21
+ import { DataflowBudgetType, DataflowExecutionStateType, DataflowRequestType, ResponseType, WorkspaceStatusResultType } from '../types.js';
22
22
  /** A run's state, of no tasks, in workspace `main` of `test-repo`. */
23
23
  function runState(id, status) {
24
24
  return {
@@ -31,11 +31,12 @@ function runState(id, status) {
31
31
  /**
32
32
  * A state store that records the reads made of it, as a poll makes them: of
33
33
  * the whole state, of a run's summary, and of its events, with the most
34
- * events each read of them asks for.
34
+ * events each read of them asks for and the last event it reads up to.
35
35
  */
36
36
  function countingStore(inner) {
37
37
  const reads = [];
38
38
  const limits = [];
39
+ const lasts = [];
39
40
  const store = {
40
41
  create: (state) => inner.create(state),
41
42
  read: (repo, workspace, id) => {
@@ -54,15 +55,38 @@ function countingStore(inner) {
54
55
  updateTaskStatus: (repo, workspace, id, task, status, details) => inner.updateTaskStatus(repo, workspace, id, task, status, details),
55
56
  updateStatus: (repo, workspace, id, status, details) => inner.updateStatus(repo, workspace, id, status, details),
56
57
  recordEvent: (repo, workspace, id, event) => inner.recordEvent(repo, workspace, id, event),
57
- getEventsSince: (repo, workspace, id, since, limit) => {
58
+ getEventsSince: (repo, workspace, id, since, limit, lastSeq) => {
58
59
  reads.push('getEventsSince');
59
60
  limits.push(limit);
60
- return inner.getEventsSince(repo, workspace, id, since, limit);
61
+ lasts.push(lastSeq);
62
+ return inner.getEventsSince(repo, workspace, id, since, limit, lastSeq);
61
63
  },
62
64
  delete: (repo, workspace, id) => inner.delete(repo, workspace, id),
63
65
  readStored: (repo) => inner.readStored(repo),
64
66
  };
65
- return { store, reads, limits };
67
+ return { store, reads, limits, lasts };
68
+ }
69
+ /** A storage holding `main` in `test-repo`, with a package of one input,
70
+ * `inputs/x`, deployed to it. */
71
+ async function storageWithWorkspace() {
72
+ const storage = new InMemoryStorage();
73
+ await storage.repos.create('test-repo');
74
+ const x = await storeDatasetBytes(storage, 'test-repo', encodeBeast2For(IntegerType)(1n));
75
+ const structure = variant('struct', new Map([
76
+ ['inputs', variant('struct', new Map([['x', variant('value', { type: toEastTypeValue(IntegerType), writable: true })]]))],
77
+ ]));
78
+ const pkg = await storage.objects.write('test-repo', encodeBeast2For(PackageObjectType)({
79
+ tasks: new Map(),
80
+ data: { structure, refs: new Map([['inputs/x', variant('value', { hash: x, versions: new Map() })]]) },
81
+ functions: new Map(),
82
+ records: new Map(),
83
+ sources: new Map(),
84
+ }));
85
+ await storage.refs.workspaceWrite('test-repo', 'main', encodeBeast2For(WorkspaceRecordType)(some({
86
+ packageName: 'one', packageVersion: '1.0.0', packageHash: pkg, deployedAt: new Date(0), currentRunId: none,
87
+ })));
88
+ await storage.datasets.write('test-repo', 'main', 'inputs/x', variant('value', { hash: x, versions: new Map() }));
89
+ return storage;
66
90
  }
67
91
  describe('dataflow routes', () => {
68
92
  it('start, poll and cancel a run through the orchestrator and the state store their host gives', async () => {
@@ -244,7 +268,7 @@ describe('dataflow routes', () => {
244
268
  assert.deepEqual(await refused.json(), { error: { type: 'bad_request', message: 'since must be a non-negative integer, got "-1"' } });
245
269
  });
246
270
  it('poll a run of more events than a poll is served: at most 1,000, however many it asks for, with the run\'s id and its last event, which say what a poll left', async () => {
247
- const { store, limits } = countingStore(new InMemoryStateStore());
271
+ const { store, limits, lasts } = countingStore(new InMemoryStateStore());
248
272
  const at = new Date(0);
249
273
  await store.create({
250
274
  ...runState('run-1', 'completed'),
@@ -271,6 +295,37 @@ describe('dataflow routes', () => {
271
295
  assert.deepEqual(await poll('?since=1000'), { runId: 'run-1', served: 500, first: 't1001', nextSeq: 1500n, lastSeq: 1500n }, 'the rest, from the cursor it left');
272
296
  assert.deepEqual(await poll('?limit=0'), { runId: 'run-1', served: 0, first: null, nextSeq: 0n, lastSeq: 1500n }, 'a poll of no events sees where the run\'s events end');
273
297
  assert.deepEqual(limits, [1_000, 1_000, 1_000], 'each poll asks the store for no more events than it serves');
298
+ assert.deepEqual(lasts, [1_500, 1_500, 1_500], 'and for none past the last event its summary named');
299
+ });
300
+ it('answer the workspace\'s status with its ETag, and 304 to a poll holding it until something moves, each no-store', async () => {
301
+ const storage = await storageWithWorkspace();
302
+ const app = new Hono();
303
+ app.route('/api/repos/:repo/workspaces/:ws/dataflow', createExecutionRoutes(storage, () => 'test-repo', {
304
+ getRunner: () => new MockTaskRunner(),
305
+ getOrchestrator: () => new LocalOrchestrator(),
306
+ getStateStore: () => new InMemoryStateStore(),
307
+ }));
308
+ const decode = decodeBeast2For(ResponseType(WorkspaceStatusResultType));
309
+ const status = async (headers = {}) => {
310
+ const response = await app.request('/api/repos/r/workspaces/main/dataflow', { headers });
311
+ const body = new Uint8Array(await response.arrayBuffer());
312
+ return { code: response.status, etag: response.headers.get('etag'), cache: response.headers.get('cache-control'), body: body.length === 0 ? null : decode(body) };
313
+ };
314
+ const first = await status();
315
+ assert.equal(first.code, 200);
316
+ assert.match(first.etag ?? '', /^"[0-9a-f]{64}"$/);
317
+ assert.equal(first.cache, 'no-store');
318
+ assert.equal(first.body?.type, 'success');
319
+ const reads = [];
320
+ const readAll = storage.datasets.readAll.bind(storage.datasets);
321
+ storage.datasets.readAll = (repo, ws) => { reads.push('readAll'); return readAll(repo, ws); };
322
+ assert.deepEqual(await status({ 'If-None-Match': first.etag }), { code: 304, etag: first.etag, cache: 'no-store', body: null });
323
+ assert.deepEqual(reads, [], 'a 304 reads no ref');
324
+ const x = await storage.datasets.read('test-repo', 'main', 'inputs/x');
325
+ await storage.datasets.write('test-repo', 'main', 'inputs/x', x);
326
+ const moved = await status({ 'If-None-Match': first.etag });
327
+ assert.deepEqual([moved.code, moved.body?.type], [200, 'success']);
328
+ assert.notEqual(moved.etag, first.etag);
274
329
  });
275
330
  it('poll a run whose events the API mostly does not show: a page of the limit at a time, at most eight, and the rest over the polls after', async () => {
276
331
  const { store, limits } = countingStore(new InMemoryStateStore());