@elaraai/e3-api-server 1.0.84 → 1.0.85

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 (153) hide show
  1. package/README.md +88 -11
  2. package/dist/src/errors.d.ts +15 -0
  3. package/dist/src/errors.d.ts.map +1 -1
  4. package/dist/src/errors.js +22 -1
  5. package/dist/src/errors.js.map +1 -1
  6. package/dist/src/handlers/dataflow.d.ts +89 -18
  7. package/dist/src/handlers/dataflow.d.ts.map +1 -1
  8. package/dist/src/handlers/dataflow.js +198 -123
  9. package/dist/src/handlers/dataflow.js.map +1 -1
  10. package/dist/src/handlers/dataflow.spec.js +257 -7
  11. package/dist/src/handlers/dataflow.spec.js.map +1 -1
  12. package/dist/src/handlers/datasets.d.ts +56 -15
  13. package/dist/src/handlers/datasets.d.ts.map +1 -1
  14. package/dist/src/handlers/datasets.js +200 -122
  15. package/dist/src/handlers/datasets.js.map +1 -1
  16. package/dist/src/handlers/datasets.spec.js +92 -2
  17. package/dist/src/handlers/datasets.spec.js.map +1 -1
  18. package/dist/src/handlers/functions.d.ts +11 -2
  19. package/dist/src/handlers/functions.d.ts.map +1 -1
  20. package/dist/src/handlers/functions.js +50 -20
  21. package/dist/src/handlers/functions.js.map +1 -1
  22. package/dist/src/handlers/functions.spec.js +12 -1
  23. package/dist/src/handlers/functions.spec.js.map +1 -1
  24. package/dist/src/handlers/index.d.ts +2 -2
  25. package/dist/src/handlers/index.d.ts.map +1 -1
  26. package/dist/src/handlers/index.js +2 -2
  27. package/dist/src/handlers/index.js.map +1 -1
  28. package/dist/src/handlers/packages.d.ts +1 -1
  29. package/dist/src/handlers/packages.d.ts.map +1 -1
  30. package/dist/src/handlers/packages.js +1 -1
  31. package/dist/src/handlers/packages.js.map +1 -1
  32. package/dist/src/handlers/records.d.ts +27 -7
  33. package/dist/src/handlers/records.d.ts.map +1 -1
  34. package/dist/src/handlers/records.js +36 -16
  35. package/dist/src/handlers/records.js.map +1 -1
  36. package/dist/src/handlers/records.spec.js +160 -26
  37. package/dist/src/handlers/records.spec.js.map +1 -1
  38. package/dist/src/handlers/repository.d.ts +9 -1
  39. package/dist/src/handlers/repository.d.ts.map +1 -1
  40. package/dist/src/handlers/repository.js +14 -5
  41. package/dist/src/handlers/repository.js.map +1 -1
  42. package/dist/src/handlers/tasks.d.ts +18 -6
  43. package/dist/src/handlers/tasks.d.ts.map +1 -1
  44. package/dist/src/handlers/tasks.js +31 -22
  45. package/dist/src/handlers/tasks.js.map +1 -1
  46. package/dist/src/handlers/tasks.spec.js +61 -12
  47. package/dist/src/handlers/tasks.spec.js.map +1 -1
  48. package/dist/src/handlers/workspaces.d.ts +11 -6
  49. package/dist/src/handlers/workspaces.d.ts.map +1 -1
  50. package/dist/src/handlers/workspaces.js +14 -8
  51. package/dist/src/handlers/workspaces.js.map +1 -1
  52. package/dist/src/handlers/workspaces.spec.js +24 -8
  53. package/dist/src/handlers/workspaces.spec.js.map +1 -1
  54. package/dist/src/identity.d.ts +22 -0
  55. package/dist/src/identity.d.ts.map +1 -0
  56. package/dist/src/identity.js +6 -0
  57. package/dist/src/identity.js.map +1 -0
  58. package/dist/src/index.d.ts +1 -0
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +3 -0
  61. package/dist/src/index.js.map +1 -1
  62. package/dist/src/local-dataflow.d.ts +14 -1
  63. package/dist/src/local-dataflow.d.ts.map +1 -1
  64. package/dist/src/local-dataflow.js +12 -7
  65. package/dist/src/local-dataflow.js.map +1 -1
  66. package/dist/src/middleware/auth.d.ts +1 -11
  67. package/dist/src/middleware/auth.d.ts.map +1 -1
  68. package/dist/src/middleware/auth.js.map +1 -1
  69. package/dist/src/middleware/repository.d.ts +1 -1
  70. package/dist/src/middleware/repository.d.ts.map +1 -1
  71. package/dist/src/middleware/repository.js +4 -10
  72. package/dist/src/middleware/repository.js.map +1 -1
  73. package/dist/src/middleware/repository.spec.js +7 -6
  74. package/dist/src/middleware/repository.spec.js.map +1 -1
  75. package/dist/src/portable.d.ts +47 -0
  76. package/dist/src/portable.d.ts.map +1 -0
  77. package/dist/src/portable.js +79 -0
  78. package/dist/src/portable.js.map +1 -0
  79. package/dist/src/portable.spec.d.ts +6 -0
  80. package/dist/src/portable.spec.d.ts.map +1 -0
  81. package/dist/src/portable.spec.js +325 -0
  82. package/dist/src/portable.spec.js.map +1 -0
  83. package/dist/src/routes/dataset-path.d.ts +28 -0
  84. package/dist/src/routes/dataset-path.d.ts.map +1 -0
  85. package/dist/src/routes/dataset-path.js +52 -0
  86. package/dist/src/routes/dataset-path.js.map +1 -0
  87. package/dist/src/routes/datasets.d.ts +7 -1
  88. package/dist/src/routes/datasets.d.ts.map +1 -1
  89. package/dist/src/routes/datasets.js +5 -11
  90. package/dist/src/routes/datasets.js.map +1 -1
  91. package/dist/src/routes/executions.d.ts +4 -2
  92. package/dist/src/routes/executions.d.ts.map +1 -1
  93. package/dist/src/routes/executions.js +31 -10
  94. package/dist/src/routes/executions.js.map +1 -1
  95. package/dist/src/routes/functions.d.ts +16 -8
  96. package/dist/src/routes/functions.d.ts.map +1 -1
  97. package/dist/src/routes/functions.js +21 -11
  98. package/dist/src/routes/functions.js.map +1 -1
  99. package/dist/src/routes/index.d.ts +4 -3
  100. package/dist/src/routes/index.d.ts.map +1 -1
  101. package/dist/src/routes/index.js +1 -0
  102. package/dist/src/routes/index.js.map +1 -1
  103. package/dist/src/routes/objects.d.ts +4 -2
  104. package/dist/src/routes/objects.d.ts.map +1 -1
  105. package/dist/src/routes/objects.js +5 -8
  106. package/dist/src/routes/objects.js.map +1 -1
  107. package/dist/src/routes/package-transfer.d.ts +1 -1
  108. package/dist/src/routes/package-transfer.d.ts.map +1 -1
  109. package/dist/src/routes/package-transfer.js +19 -22
  110. package/dist/src/routes/package-transfer.js.map +1 -1
  111. package/dist/src/routes/packages.d.ts +1 -1
  112. package/dist/src/routes/packages.d.ts.map +1 -1
  113. package/dist/src/routes/query.d.ts +53 -0
  114. package/dist/src/routes/query.d.ts.map +1 -0
  115. package/dist/src/routes/query.js +86 -0
  116. package/dist/src/routes/query.js.map +1 -0
  117. package/dist/src/routes/query.spec.d.ts +6 -0
  118. package/dist/src/routes/query.spec.d.ts.map +1 -0
  119. package/dist/src/routes/query.spec.js +49 -0
  120. package/dist/src/routes/query.spec.js.map +1 -0
  121. package/dist/src/routes/records.d.ts +32 -3
  122. package/dist/src/routes/records.d.ts.map +1 -1
  123. package/dist/src/routes/records.js +34 -7
  124. package/dist/src/routes/records.js.map +1 -1
  125. package/dist/src/routes/repositories.d.ts +1 -1
  126. package/dist/src/routes/repositories.d.ts.map +1 -1
  127. package/dist/src/routes/repository.d.ts +6 -1
  128. package/dist/src/routes/repository.d.ts.map +1 -1
  129. package/dist/src/routes/repository.js +5 -0
  130. package/dist/src/routes/repository.js.map +1 -1
  131. package/dist/src/routes/repository.spec.d.ts +6 -0
  132. package/dist/src/routes/repository.spec.d.ts.map +1 -0
  133. package/dist/src/routes/repository.spec.js +84 -0
  134. package/dist/src/routes/repository.spec.js.map +1 -0
  135. package/dist/src/routes/tasks.d.ts +1 -1
  136. package/dist/src/routes/tasks.d.ts.map +1 -1
  137. package/dist/src/routes/tasks.js +16 -4
  138. package/dist/src/routes/tasks.js.map +1 -1
  139. package/dist/src/routes/transfer.d.ts +1 -1
  140. package/dist/src/routes/transfer.d.ts.map +1 -1
  141. package/dist/src/routes/transfer.js +7 -27
  142. package/dist/src/routes/transfer.js.map +1 -1
  143. package/dist/src/routes/workspaces.d.ts +1 -1
  144. package/dist/src/routes/workspaces.d.ts.map +1 -1
  145. package/dist/src/routes/workspaces.js +34 -22
  146. package/dist/src/routes/workspaces.js.map +1 -1
  147. package/dist/src/server.js +1 -1
  148. package/dist/src/server.js.map +1 -1
  149. package/dist/src/types.d.ts +63 -5
  150. package/dist/src/types.d.ts.map +1 -1
  151. package/dist/src/types.js +7 -5
  152. package/dist/src/types.js.map +1 -1
  153. package/package.json +8 -4
@@ -5,18 +5,24 @@
5
5
  /**
6
6
  * Record route tests: the audit actor is derived from the verified identity
7
7
  * (a forged request actor is ignored) when auth is configured, honoured from
8
- * the request otherwise; and compaction is gated to an elevated role.
8
+ * the request otherwise; compaction is gated to an elevated role; and the
9
+ * routes keep to the host's limits — a mutation's run and a compaction's
10
+ * retries stop under its deadline, a history request that names no limit is
11
+ * answered with its page, and a limit no request could meet is refused when
12
+ * the routes are mounted.
9
13
  */
10
14
  import { describe, it, beforeEach } from 'node:test';
11
15
  import assert from 'node:assert/strict';
12
16
  import { Hono } from 'hono';
13
- import { IntegerType, encodeBeast2For, decodeBeast2For, toEastTypeValue, variant, some, none } from '@elaraai/east';
14
- import { MockTaskRunner, recordHistory } from '@elaraai/e3-core';
17
+ import { IntegerType, compareFor, encodeBeast2For, decodeBeast2For, equalFor, printFor, toEastTypeValue, variant, some, none } from '@elaraai/east';
18
+ import { MockTaskRunner, recordHistory, uuidv7 } from '@elaraai/e3-core';
15
19
  import { InMemoryStorage } from '@elaraai/e3-core/test';
16
20
  import { BEAST2_CONTENT_TYPE, PackageObjectType, RecordObjectType, MutationObjectType, RecordCommitType, WorkspaceRecordType, } from '@elaraai/e3-types';
17
21
  import { createWorkspaceRecordRoutes } from '../routes/records.js';
18
22
  import { effectiveBudgetMs } from './records.js';
19
- import { ResponseType, MutationResultType, MutationCallRequestType } from '../types.js';
23
+ // Through the handlers entry, as a host reaches it.
24
+ import { mutationResultOf } from './index.js';
25
+ import { ResponseType, MutationResultType, MutationCallRequestType, RecordHistoryResultType, } from '../types.js';
20
26
  describe('effectiveBudgetMs', () => {
21
27
  it('returns undefined when no budget is supplied (local default: no gateway, no cap)', () => {
22
28
  assert.equal(effectiveBudgetMs(undefined), undefined);
@@ -35,10 +41,6 @@ const REPO = 'test-repo';
35
41
  const WS = 'main';
36
42
  const encodeInt = encodeBeast2For(IntegerType);
37
43
  const encodeMutationCall = encodeBeast2For(MutationCallRequestType);
38
- async function decodeResponse(response, type) {
39
- const body = new Uint8Array(await response.arrayBuffer());
40
- return decodeBeast2For(ResponseType(type))(body);
41
- }
42
44
  /** Seed an InMemoryStorage with a deployed `counter` record + `increment` mutation. */
43
45
  async function seedDeployedRecord(storage) {
44
46
  await storage.repos.create(REPO);
@@ -77,15 +79,53 @@ async function seedDeployedRecord(storage) {
77
79
  })));
78
80
  await storage.datasets.write(REPO, WS, 'records/counter', variant('value', { hash: stateHash, versions: new Map([['.records.counter', genesisHash]]) }));
79
81
  }
80
- /** Mount the record routes, optionally injecting an authenticated identity. */
81
- function buildApp(storage, runner, identity) {
82
+ /** Mount the record routes under the host's options, optionally injecting an
83
+ * authenticated identity. */
84
+ function buildApp(storage, runner, identity, options = {}) {
82
85
  const app = new Hono();
83
86
  if (identity) {
84
87
  app.use('*', async (c, next) => { c.set('identity', identity); await next(); });
85
88
  }
86
- app.route('/api/repos/:repo/workspaces/:ws/records', createWorkspaceRecordRoutes(storage, () => REPO, () => runner));
89
+ app.route('/api/repos/:repo/workspaces/:ws/records', createWorkspaceRecordRoutes(storage, () => REPO, () => runner, options));
87
90
  return app;
88
91
  }
92
+ const decodeMutationAnswer = decodeBeast2For(ResponseType(MutationResultType));
93
+ const printMutationAnswer = printFor(ResponseType(MutationResultType));
94
+ const decodeHistoryAnswer = decodeBeast2For(ResponseType(RecordHistoryResultType));
95
+ const printHistoryAnswer = printFor(ResponseType(RecordHistoryResultType));
96
+ const mutationResultEqual = equalFor(MutationResultType);
97
+ const printMutationResult = printFor(MutationResultType);
98
+ const compareInt = compareFor(IntegerType);
99
+ const printInt = printFor(IntegerType);
100
+ /** A mutation route's answer as the client decodes it: its result, or its
101
+ * error. */
102
+ async function mutationAnswer(response) {
103
+ return decodeMutationAnswer(new Uint8Array(await response.arrayBuffer()));
104
+ }
105
+ /** A mutation route's result, as the client decodes it: the route must have
106
+ * answered one, not an error. */
107
+ async function mutationResult(response) {
108
+ const answer = await mutationAnswer(response);
109
+ if (answer.type !== 'success')
110
+ assert.fail(`the route answered ${printMutationAnswer(answer)}`);
111
+ return answer.value;
112
+ }
113
+ /** A history route's page, as the client decodes it. */
114
+ async function historyResult(response) {
115
+ const answer = decodeHistoryAnswer(new Uint8Array(await response.arrayBuffer()));
116
+ if (answer.type !== 'success')
117
+ assert.fail(`the route answered ${printHistoryAnswer(answer)}`);
118
+ return answer.value;
119
+ }
120
+ /** A runner whose every run ends only when it is aborted, as a program that
121
+ * outruns its limit does. */
122
+ class StalledRunner extends MockTaskRunner {
123
+ execute(_storage, _taskHash, _inputs, options) {
124
+ return new Promise((resolve) => {
125
+ options.signal.addEventListener('abort', () => resolve({ state: 'error', cached: false, cancelled: true, executionId: uuidv7() }), { once: true });
126
+ });
127
+ }
128
+ }
89
129
  function postMutate(app, actor, extraHeaders) {
90
130
  return Promise.resolve(app.request(`/api/repos/r/workspaces/${WS}/records/counter/mutations/increment`, {
91
131
  method: 'POST',
@@ -100,6 +140,9 @@ function postCompact(app) {
100
140
  body: new Uint8Array(),
101
141
  }));
102
142
  }
143
+ function getHistory(app, query = '') {
144
+ return Promise.resolve(app.request(`/api/repos/r/workspaces/${WS}/records/counter/history${query}`));
145
+ }
103
146
  describe('record routes', () => {
104
147
  let storage;
105
148
  let runner;
@@ -111,31 +154,27 @@ describe('record routes', () => {
111
154
  });
112
155
  it('threads the Idempotency-Key header through the route so a retry dedups (no double-apply)', async () => {
113
156
  const app = buildApp(storage, runner); // no auth
114
- const first = await decodeResponse(await postMutate(app, none, { 'Idempotency-Key': 'k1' }), MutationResultType);
115
- const second = await decodeResponse(await postMutate(app, none, { 'Idempotency-Key': 'k1' }), MutationResultType);
116
- assert.equal(first.value.outcome.type, 'committed');
117
- assert.equal(second.value.outcome.type, 'committed');
118
- assert.equal(second.value.outcome.value.commitHash, first.value.outcome.value.commitHash, 'the retry returns the original commit');
157
+ const first = await mutationResult(await postMutate(app, none, { 'Idempotency-Key': 'k1' }));
158
+ const second = await mutationResult(await postMutate(app, none, { 'Idempotency-Key': 'k1' }));
159
+ assert.equal(first.outcome.type, 'committed');
160
+ assert.ok(mutationResultEqual(second, first), `the retry returns the original commit, not ${printMutationResult(second)}`);
119
161
  // genesis + exactly one commit: the keyed retry did not append a duplicate.
120
162
  assert.equal((await recordHistory(storage, REPO, WS, 'counter')).length, 2);
121
163
  });
122
164
  it('without the header a normal mutation still commits', async () => {
123
165
  const app = buildApp(storage, runner);
124
- const result = await decodeResponse(await postMutate(app, none), MutationResultType);
125
- assert.equal(result.value.outcome.type, 'committed');
166
+ assert.equal((await mutationResult(await postMutate(app, none))).outcome.type, 'committed');
126
167
  assert.equal((await recordHistory(storage, REPO, WS, 'counter')).length, 2);
127
168
  });
128
169
  it('records the authenticated identity as the actor, ignoring a forged request actor', async () => {
129
170
  const app = buildApp(storage, runner, { sub: 'u1', email: 'alice@x.io', roles: [] });
130
- const result = await decodeResponse(await postMutate(app, some('cli:attacker')), MutationResultType);
131
- assert.equal(result.type, 'success');
132
- assert.equal(result.value.outcome.type, 'committed');
171
+ assert.equal((await mutationResult(await postMutate(app, some('cli:attacker')))).outcome.type, 'committed');
133
172
  const history = await recordHistory(storage, REPO, WS, 'counter');
134
173
  assert.equal(history[0].commit.actor, 'auth:alice@x.io'); // forged 'cli:attacker' ignored
135
174
  });
136
175
  it('honours the client-supplied actor when no auth is configured', async () => {
137
176
  const app = buildApp(storage, runner); // no identity
138
- assert.equal((await decodeResponse(await postMutate(app, some('cli:bob')), MutationResultType)).value.outcome.type, 'committed');
177
+ assert.equal((await mutationResult(await postMutate(app, some('cli:bob')))).outcome.type, 'committed');
139
178
  assert.equal((await recordHistory(storage, REPO, WS, 'counter'))[0].commit.actor, 'cli:bob');
140
179
  });
141
180
  it('falls back to "api" for an unauthenticated request with no actor', async () => {
@@ -143,11 +182,106 @@ describe('record routes', () => {
143
182
  assert.equal((await recordHistory(storage, REPO, WS, 'counter'))[0].commit.actor, 'api');
144
183
  });
145
184
  it('gates compaction behind an elevated role when authenticated', async () => {
146
- const denied = await decodeResponse(await postCompact(buildApp(storage, runner, { sub: 'u1', roles: ['member'] })), MutationResultType);
147
- assert.equal(denied.type, 'error');
185
+ const denied = await mutationAnswer(await postCompact(buildApp(storage, runner, { sub: 'u1', roles: ['member'] })));
186
+ if (denied.type !== 'error')
187
+ assert.fail(`the compaction answered ${printMutationAnswer(denied)}`);
148
188
  assert.equal(denied.value.type, 'permission_denied');
149
- const allowed = await decodeResponse(await postCompact(buildApp(storage, runner, { sub: 'u1', roles: ['admin'] })), MutationResultType);
150
- assert.notEqual(allowed.type === 'error' ? allowed.value.type : 'ok', 'permission_denied');
189
+ const allowed = await mutationResult(await postCompact(buildApp(storage, runner, { sub: 'u1', roles: ['admin'] })));
190
+ assert.equal(allowed.outcome.type, 'committed', 'an elevated role compacts');
191
+ });
192
+ it('stops a mutation\'s run under the host\'s deadline, answering timed_out rather than outlasting it', async () => {
193
+ // The run ends only when its limit aborts it. Under a 2.1 s deadline the
194
+ // route keeps 2 s for the commit and the answer, so the run's limit is
195
+ // what remains of the other 100 ms, not the request's 60 s default.
196
+ const app = buildApp(storage, new StalledRunner(), undefined, { syncDeadlineMs: 2_100 });
197
+ const { outcome } = await mutationResult(await postMutate(app, none));
198
+ if (outcome.type !== 'timed_out')
199
+ assert.fail(`the mutation answered ${printMutationResult({ outcome })}`);
200
+ assert.ok(compareInt(outcome.value.ms, 1n) >= 0 && compareInt(outcome.value.ms, 100n) <= 0, `the run's limit was the deadline's rest, ${printInt(outcome.value.ms)} ms`);
201
+ assert.equal((await recordHistory(storage, REPO, WS, 'counter')).length, 1, 'nothing was committed');
202
+ });
203
+ it('stops a contended compaction\'s retries under the host\'s deadline, answering conflict', async (t) => {
204
+ const genesis = await storage.datasets.read(REPO, WS, 'records/counter');
205
+ assert.ok(genesis && genesis.type === 'value');
206
+ const stateHash = genesis.value.hash;
207
+ // Every attempt loses its swap to a writer that commits between its read
208
+ // and its write, and takes a tenth of a second of a clock that moves only
209
+ // as the test moves it. Under a 2.2 s deadline the route keeps 2 s for the
210
+ // commit and the answer, so two attempts spend the rest, where the
211
+ // compaction's own 30 s window would take three hundred.
212
+ t.mock.timers.enable({ apis: ['Date'], now: Date.now() });
213
+ const datasets = storage.datasets;
214
+ const readVersioned = datasets.readVersioned.bind(datasets);
215
+ let attempts = 0;
216
+ datasets.readVersioned = async (repo, ws, path) => {
217
+ const read = await readVersioned(repo, ws, path);
218
+ attempts++;
219
+ t.mock.timers.tick(100);
220
+ await datasets.write(repo, ws, path, variant('value', {
221
+ hash: stateHash, versions: new Map([['.records.counter', attempts.toString(16).padEnd(64, '0')]]),
222
+ }));
223
+ return read;
224
+ };
225
+ let result;
226
+ try {
227
+ result = await mutationResult(await postCompact(buildApp(storage, runner, undefined, { syncDeadlineMs: 2_200 })));
228
+ }
229
+ finally {
230
+ datasets.readVersioned = readVersioned;
231
+ }
232
+ const conflicted = { outcome: variant('conflict', { attempts: 2n, detail: none }) };
233
+ assert.ok(mutationResultEqual(result, conflicted), `the compaction answered ${printMutationResult(result)}`);
234
+ assert.equal(attempts, 2, 'no attempt was made once the deadline was spent');
235
+ });
236
+ it('answers a history request that names no limit with the host\'s page, and one that names a limit with that', async () => {
237
+ const app = buildApp(storage, runner, undefined, { historyLimit: 2 });
238
+ // Each run's output is a stored state, which the next mutation reads.
239
+ runner.setDefaultResult({ state: 'success', cached: false, outputHash: await storage.objects.write(REPO, encodeInt(5n)) });
240
+ for (let i = 0; i < 3; i++) {
241
+ assert.equal((await mutationResult(await postMutate(app, none))).outcome.type, 'committed');
242
+ }
243
+ const all = (await recordHistory(storage, REPO, WS, 'counter')).map((entry) => entry.hash);
244
+ assert.equal(all.length, 4, '$init and three commits');
245
+ const page = await historyResult(await getHistory(app));
246
+ assert.deepEqual(page.commits.map((commit) => commit.hash), all.slice(0, 2), 'the newest page');
247
+ const asked = await historyResult(await getHistory(app, '?limit=3'));
248
+ assert.deepEqual(asked.commits.map((commit) => commit.hash), all.slice(0, 3), 'a request\'s own limit wins');
249
+ // The client pages on from the page's last commit's parent.
250
+ const last = page.commits.at(-1);
251
+ if (last.parent.type !== 'some')
252
+ assert.fail('the page ended at the root');
253
+ const next = await historyResult(await getHistory(app, `?from=${last.parent.value}`));
254
+ assert.deepEqual(next.commits.map((commit) => commit.hash), all.slice(2), 'the rest of the chain');
255
+ });
256
+ it('refuses a deadline or a history page no request could meet when the routes are mounted', () => {
257
+ for (const syncDeadlineMs of [0, -1, NaN]) {
258
+ assert.throws(() => createWorkspaceRecordRoutes(storage, () => REPO, () => runner, { syncDeadlineMs }), { name: 'RangeError', message: `syncDeadlineMs must be a positive number of milliseconds, got ${syncDeadlineMs}` });
259
+ }
260
+ for (const historyLimit of [0, 1.5, NaN]) {
261
+ assert.throws(() => createWorkspaceRecordRoutes(storage, () => REPO, () => runner, { historyLimit }), { name: 'RangeError', message: `historyLimit must be a positive whole number of commits, got ${historyLimit}` });
262
+ }
263
+ });
264
+ });
265
+ describe('mutationResultOf', () => {
266
+ it('answers every outcome as the mutation and compact routes answer it', () => {
267
+ // A host answers a record operation no route serves — a rollback through
268
+ // recordSystemCommit, say — with it, so a client reads the answer as it
269
+ // reads a mutation's.
270
+ const commitHash = 'a'.repeat(64);
271
+ const stateHash = 'b'.repeat(64);
272
+ const stale = 'update of "p-7", whose row no longer matches the patch';
273
+ const cases = [
274
+ [{ kind: 'committed', commitHash, stateHash }, { outcome: variant('committed', { commitHash, stateHash }) }],
275
+ [{ kind: 'invalid', message: 'record \'nope\' not found' }, { outcome: variant('invalid', { message: 'record \'nope\' not found' }) }],
276
+ [{ kind: 'failed', exitCode: 3, stderr: 'the tail' }, { outcome: variant('failed', { exitCode: 3n, stderr: 'the tail' }) }],
277
+ [{ kind: 'timed_out', ms: 50, stderr: 'slow reducer' }, { outcome: variant('timed_out', { ms: 50n, stderr: 'slow reducer' }) }],
278
+ [{ kind: 'conflict', attempts: 2 }, { outcome: variant('conflict', { attempts: 2n, detail: none }) }],
279
+ [{ kind: 'conflict', attempts: 1, detail: stale }, { outcome: variant('conflict', { attempts: 1n, detail: some(stale) }) }],
280
+ ];
281
+ for (const [outcome, expected] of cases) {
282
+ const result = mutationResultOf(outcome);
283
+ assert.ok(mutationResultEqual(result, expected), `${outcome.kind}: ${printMutationResult(result)}`);
284
+ }
151
285
  });
152
286
  });
153
287
  //# sourceMappingURL=records.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"records.spec.js","sourceRoot":"","sources":["../../../src/handlers/records.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAExF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,kFAAkF,EAAE,GAAG,EAAE;QAC1F,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,yEAAyE;QACzE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EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;SAC5H,CAAC;QACF,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,KAAK,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
5
  import { type GcRequest } from '@elaraai/e3-types';
6
- import type { RepoGcStore, StorageBackend } from '@elaraai/e3-core';
6
+ import type { RepoGcStore, StorageBackend } from '@elaraai/e3-core/portable';
7
7
  /**
8
8
  * The repositories a host keeps, by name.
9
9
  *
@@ -40,6 +40,14 @@ export declare function getStatus(storage: StorageBackend, repoPath: string): Pr
40
40
  * The repository's record: the release of e3 that last wrote it, and the store
41
41
  * upgrades it has had.
42
42
  *
43
+ * @remarks
44
+ * A read: it applies no upgrade the repository owes, and waits on no work
45
+ * running in it. Behind the repository gate it never finds one owed, since the
46
+ * gate has applied them or refused the request. Without the gate — a host
47
+ * that mounts the route bare, or calls this itself — a repository that owes
48
+ * upgrades is answered as the gate answers it: 503
49
+ * `repository_upgrade_pending`, with a `Retry-After`.
50
+ *
43
51
  * @param storage - Storage backend
44
52
  * @param repoPath - Repository identifier
45
53
  * @returns The response: the record, or the error
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,E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AAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAMjF;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkB/F;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmC/F;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAmBnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC,CAcnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CAYnB"}
@@ -2,12 +2,11 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
- import { randomUUID } from 'node:crypto';
6
5
  import { ArrayType, NullType, StringType, none, variant } from '@elaraai/east';
7
6
  import { RepositoryRecordType } from '@elaraai/e3-types';
8
- import { RepoAlreadyExistsError, RepoNotFoundError, packageList, repositoryOpen, workspaceList } from '@elaraai/e3-core';
7
+ import { RepoAlreadyExistsError, RepoNotFoundError, RepositoryUpgradePendingError, packageList, repositoryOpen, workspaceList, } from '@elaraai/e3-core/portable';
9
8
  import { sendSuccess, sendSuccessWithStatus, sendError } from '../beast2.js';
10
- import { errorToVariant } from '../errors.js';
9
+ import { errorToVariant, sendUpgradePending } from '../errors.js';
11
10
  import { RepositoryStatusType, GcStartResultType, GcStatusResultType, } from '../types.js';
12
11
  /**
13
12
  * The repositories a host keeps, by name.
@@ -118,15 +117,25 @@ export async function getStatus(storage, repoPath) {
118
117
  * The repository's record: the release of e3 that last wrote it, and the store
119
118
  * upgrades it has had.
120
119
  *
120
+ * @remarks
121
+ * A read: it applies no upgrade the repository owes, and waits on no work
122
+ * running in it. Behind the repository gate it never finds one owed, since the
123
+ * gate has applied them or refused the request. Without the gate — a host
124
+ * that mounts the route bare, or calls this itself — a repository that owes
125
+ * upgrades is answered as the gate answers it: 503
126
+ * `repository_upgrade_pending`, with a `Retry-After`.
127
+ *
121
128
  * @param storage - Storage backend
122
129
  * @param repoPath - Repository identifier
123
130
  * @returns The response: the record, or the error
124
131
  */
125
132
  export async function getRecord(storage, repoPath) {
126
133
  try {
127
- return sendSuccess(RepositoryRecordType, await repositoryOpen(storage, repoPath));
134
+ return sendSuccess(RepositoryRecordType, await repositoryOpen(storage, repoPath, { apply: false, waitMs: 0 }));
128
135
  }
129
136
  catch (err) {
137
+ if (err instanceof RepositoryUpgradePendingError)
138
+ return sendUpgradePending(err);
130
139
  return sendError(RepositoryRecordType, errorToVariant(err));
131
140
  }
132
141
  }
@@ -146,7 +155,7 @@ export async function getRecord(storage, repoPath) {
146
155
  */
147
156
  export async function startGc(repo, request, gcStore) {
148
157
  try {
149
- const executionId = randomUUID();
158
+ const executionId = globalThis.crypto.randomUUID();
150
159
  await gcStore.create(executionId, {
151
160
  repo,
152
161
  request,
@@ -1 +1 @@
1
- {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,E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xE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,SAAS,CAAC,iBAAiB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,IAAY,EACZ,WAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtC,OAAO,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAC,UAAU,EAAE;gBACvD,OAAO,EAAE,eAAe,IAAI,oBAAoB,WAAW,GAAG;aAC/D,CAAC,CAAC,CAAC;QACN,CAAC;QACD,OAAO,WAAW,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,SAAS,CAAC,kBAAkB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
- import type { StorageBackend } from '@elaraai/e3-core';
5
+ import type { StorageBackend } from '@elaraai/e3-core/portable';
6
6
  /**
7
7
  * List all tasks in a workspace.
8
8
  */
@@ -12,10 +12,22 @@ export declare function listTasks(storage: StorageBackend, repoPath: string, wor
12
12
  */
13
13
  export declare function getTask(storage: StorageBackend, repoPath: string, workspace: string, taskName: string): Promise<Response>;
14
14
  /**
15
- * List execution history for a task: the latest attempt per distinct
16
- * inputs hash, or — with `all` — every attempt (a forced re-run or a retry
17
- * after a failure adds one under the same inputs hash). A split task's units
18
- * are recorded under its hash too, and are left out: they are not its runs.
15
+ * List a page of a task's history: its runs, the latest first — every attempt,
16
+ * a forced re-run or a retry after a failure among them — those before the run
17
+ * `page.before` names when given, at most `page.limit` of them. A split task's
18
+ * units are recorded under its hash too, and are left out: they are not its
19
+ * runs. It reads the task's index of runs (`RefStore.executionListRuns`), so a
20
+ * page costs what it holds, however long the task has run.
21
+ *
22
+ * @param storage - Storage backend
23
+ * @param repoPath - The repository's path
24
+ * @param workspace - The workspace
25
+ * @param taskName - The task
26
+ * @param page - The run the page begins before, if any, and the most it holds
27
+ * @returns The page, or the error
19
28
  */
20
- export declare function listExecutions(storage: StorageBackend, repoPath: string, workspace: string, taskName: string, all?: boolean): Promise<Response>;
29
+ export declare function listExecutions(storage: StorageBackend, repoPath: string, workspace: string, taskName: string, page: {
30
+ before?: string;
31
+ limit: number;
32
+ }): Promise<Response>;
21
33
  //# sourceMappingURL=tasks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/handlers/tasks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAgGD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,GAAG,UAAQ,GACV,OAAO,CAAC,QAAQ,CAAC,CAqBnB"}
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/handlers/tasks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKhE;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AA2GD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC,OAAO,CAAC,QAAQ,CAAC,CASnB"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under BSL 1.1. See LICENSE for details.
4
4
  */
5
5
  import { ArrayType, none, some, variant } from '@elaraai/east';
6
- import { workspaceListTasks, workspaceGetTask, workspaceGetTaskHash, executionListForTask, executionGetLatest, executionListIds, executionGet, } from '@elaraai/e3-core';
6
+ import { workspaceListTasks, workspaceGetTask, workspaceGetTaskHash, } from '@elaraai/e3-core/portable';
7
7
  import { sendSuccess, sendError } from '../beast2.js';
8
8
  import { errorToVariant } from '../errors.js';
9
9
  import { TaskListItemType, TaskDetailsType, ExecutionListItemType } from '../types.js';
@@ -72,12 +72,14 @@ function calculateDuration(startedAt, completedAt) {
72
72
  return BigInt(Math.round(completedAt.getTime() - startedAt.getTime()));
73
73
  }
74
74
  /**
75
- * One execution as the history lists it.
75
+ * One execution as the history lists it: a cancelled or interrupted one with
76
+ * why it stopped.
76
77
  */
77
- function toExecutionListItem(inputsHash, status) {
78
+ function toExecutionListItem(inputsHash, executionId, status) {
78
79
  if (status.type === 'success') {
79
80
  return {
80
81
  inputsHash,
82
+ executionId,
81
83
  inputHashes: status.value.inputHashes,
82
84
  status: statusToApiStatus(status),
83
85
  startedAt: status.value.startedAt.toISOString(),
@@ -85,11 +87,13 @@ function toExecutionListItem(inputsHash, status) {
85
87
  duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
86
88
  exitCode: none,
87
89
  peakBytes: status.value.peakBytes,
90
+ reason: none,
88
91
  };
89
92
  }
90
93
  if (status.type === 'failed') {
91
94
  return {
92
95
  inputsHash,
96
+ executionId,
93
97
  inputHashes: status.value.inputHashes,
94
98
  status: statusToApiStatus(status),
95
99
  startedAt: status.value.startedAt.toISOString(),
@@ -97,11 +101,13 @@ function toExecutionListItem(inputsHash, status) {
97
101
  duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
98
102
  exitCode: some(status.value.exitCode),
99
103
  peakBytes: status.value.peakBytes,
104
+ reason: none,
100
105
  };
101
106
  }
102
107
  if (status.type === 'cancelled') {
103
108
  return {
104
109
  inputsHash,
110
+ executionId,
105
111
  inputHashes: status.value.inputHashes,
106
112
  status: statusToApiStatus(status),
107
113
  startedAt: status.value.startedAt.toISOString(),
@@ -109,13 +115,15 @@ function toExecutionListItem(inputsHash, status) {
109
115
  duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
110
116
  exitCode: none,
111
117
  peakBytes: none,
118
+ reason: some(status.value.reason),
112
119
  };
113
120
  }
114
121
  // An interruption's completedAt is when it was found, not when the runner
115
- // stopped, so it has no duration.
122
+ // stopped, so it has no duration, as an error has none.
116
123
  if (status.type === 'error' || status.type === 'interrupted') {
117
124
  return {
118
125
  inputsHash,
126
+ executionId,
119
127
  inputHashes: status.value.inputHashes,
120
128
  status: statusToApiStatus(status),
121
129
  startedAt: status.value.startedAt.toISOString(),
@@ -123,11 +131,13 @@ function toExecutionListItem(inputsHash, status) {
123
131
  duration: none,
124
132
  exitCode: none,
125
133
  peakBytes: none,
134
+ reason: status.type === 'interrupted' ? some(status.value.reason) : none,
126
135
  };
127
136
  }
128
137
  // running
129
138
  return {
130
139
  inputsHash,
140
+ executionId,
131
141
  inputHashes: status.value.inputHashes,
132
142
  status: statusToApiStatus(status),
133
143
  startedAt: status.value.startedAt.toISOString(),
@@ -135,30 +145,29 @@ function toExecutionListItem(inputsHash, status) {
135
145
  duration: none,
136
146
  exitCode: none,
137
147
  peakBytes: none,
148
+ reason: none,
138
149
  };
139
150
  }
140
151
  /**
141
- * List execution history for a task: the latest attempt per distinct
142
- * inputs hash, or — with `all` — every attempt (a forced re-run or a retry
143
- * after a failure adds one under the same inputs hash). A split task's units
144
- * are recorded under its hash too, and are left out: they are not its runs.
152
+ * List a page of a task's history: its runs, the latest first — every attempt,
153
+ * a forced re-run or a retry after a failure among them — those before the run
154
+ * `page.before` names when given, at most `page.limit` of them. A split task's
155
+ * units are recorded under its hash too, and are left out: they are not its
156
+ * runs. It reads the task's index of runs (`RefStore.executionListRuns`), so a
157
+ * page costs what it holds, however long the task has run.
158
+ *
159
+ * @param storage - Storage backend
160
+ * @param repoPath - The repository's path
161
+ * @param workspace - The workspace
162
+ * @param taskName - The task
163
+ * @param page - The run the page begins before, if any, and the most it holds
164
+ * @returns The page, or the error
145
165
  */
146
- export async function listExecutions(storage, repoPath, workspace, taskName, all = false) {
166
+ export async function listExecutions(storage, repoPath, workspace, taskName, page) {
147
167
  try {
148
168
  const taskHash = await workspaceGetTaskHash(storage, repoPath, workspace, taskName);
149
- const inputsHashes = await executionListForTask(storage, repoPath, taskHash);
150
- const result = [];
151
- for (const inputsHash of inputsHashes) {
152
- const statuses = all
153
- ? await Promise.all((await executionListIds(storage, repoPath, taskHash, inputsHash))
154
- .map(executionId => executionGet(storage, repoPath, taskHash, inputsHash, executionId)))
155
- : [await executionGetLatest(storage, repoPath, taskHash, inputsHash)];
156
- for (const status of statuses) {
157
- if (status && !status.value.unit)
158
- result.push(toExecutionListItem(inputsHash, status));
159
- }
160
- }
161
- return sendSuccess(ArrayType(ExecutionListItemType), result);
169
+ const runs = await storage.refs.executionListRuns(repoPath, taskHash, page);
170
+ return sendSuccess(ArrayType(ExecutionListItemType), runs.map(({ inputsHash, executionId, status }) => toExecutionListItem(inputsHash, executionId, status)));
162
171
  }
163
172
  catch (err) {
164
173
  return sendError(ArrayType(ExecutionListItemType), errorToVariant(err));