@elaraai/e3-api-tests 1.0.108 → 1.0.110

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 (36) hide show
  1. package/README.md +9 -1
  2. package/dist/src/cli.d.ts +41 -0
  3. package/dist/src/cli.d.ts.map +1 -1
  4. package/dist/src/cli.js +58 -0
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/src/fixtures.d.ts +76 -0
  7. package/dist/src/fixtures.d.ts.map +1 -1
  8. package/dist/src/fixtures.js +166 -0
  9. package/dist/src/fixtures.js.map +1 -1
  10. package/dist/src/index.d.ts +4 -2
  11. package/dist/src/index.d.ts.map +1 -1
  12. package/dist/src/index.js +8 -2
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/src/suites/calls.js +3 -3
  15. package/dist/src/suites/calls.js.map +1 -1
  16. package/dist/src/suites/cli.d.ts.map +1 -1
  17. package/dist/src/suites/cli.js +105 -13
  18. package/dist/src/suites/cli.js.map +1 -1
  19. package/dist/src/suites/function-drafts.d.ts +13 -0
  20. package/dist/src/suites/function-drafts.d.ts.map +1 -0
  21. package/dist/src/suites/function-drafts.js +502 -0
  22. package/dist/src/suites/function-drafts.js.map +1 -0
  23. package/dist/src/suites/functions.d.ts.map +1 -1
  24. package/dist/src/suites/functions.js +16 -15
  25. package/dist/src/suites/functions.js.map +1 -1
  26. package/dist/src/suites/index-inputs.d.ts +13 -0
  27. package/dist/src/suites/index-inputs.d.ts.map +1 -0
  28. package/dist/src/suites/index-inputs.js +247 -0
  29. package/dist/src/suites/index-inputs.js.map +1 -0
  30. package/dist/src/suites/records-series.d.ts.map +1 -1
  31. package/dist/src/suites/records-series.js +47 -28
  32. package/dist/src/suites/records-series.js.map +1 -1
  33. package/dist/src/suites/transfer.d.ts.map +1 -1
  34. package/dist/src/suites/transfer.js +46 -11
  35. package/dist/src/suites/transfer.js.map +1 -1
  36. package/package.json +10 -10
@@ -0,0 +1,247 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * An index of a record as an input of a task or a function
7
+ * (east-workspace#1617): `e3.index(record.indexes.<name>)`. Each case goes
8
+ * through the routes a page and a deployment call — a function described,
9
+ * called and polled, the sync route, a task read, a dataflow run, the
10
+ * workspace's status — against a real server and runner, and holds the index
11
+ * to what its record holds: the run of one index key, the record's state both
12
+ * are read at, the drafts a call lays over the record, and when a task runs
13
+ * again.
14
+ *
15
+ * No case leans on a timing: each reads what a call names it read, or what a
16
+ * run says it ran.
17
+ */
18
+ import { describe, it } from 'node:test';
19
+ import assert from 'node:assert/strict';
20
+ import { ArrayType, IntegerType, PatchType, SortedMap, StringType, compareFor, decodeBeast2For, diffFor, encodeBeast2For, equalFor, none, printFor, some, variant, } from '@elaraai/east';
21
+ import { datasetGet, datasetGetStatus, dataflowExecute, functionCall, taskGet, workspaceFunctionCallStatus, workspaceFunctionCallSync, workspaceFunctionDescribe, workspaceFunctionStart, workspaceRecordHistory, workspaceRecordMutate, workspaceStatus, } from '@elaraai/e3-api-client';
22
+ import { ExecuteResultType, FunctionInputType, TaskInputType } from '@elaraai/e3-types';
23
+ import { assertDataflowSucceeded, assertMutationCommitted, describeDataflowResult } from '../assertions.js';
24
+ import { templateWorkspace } from '../template.js';
25
+ import { createIndexInputsPackageZip, DraftJobsType } from '../fixtures.js';
26
+ const PKG = 'index-inputs-pkg';
27
+ const VERSION = '1.0.0';
28
+ const JOBS_PATH = [variant('field', 'records'), variant('field', 'jobs')];
29
+ const BACKLOG_PATH = [variant('field', 'records'), variant('field', 'backlog')];
30
+ const WATCHED_PATH = [variant('field', 'inputs'), variant('field', 'watched')];
31
+ const WATCHED_JOBS_PATH = [variant('field', 'tasks'), variant('field', 'watched_jobs'), variant('field', 'output')];
32
+ /** What a result names it read. */
33
+ const InputsType = ExecuteResultType.fields.inputs;
34
+ /** What a signature says a function reads of a workspace. */
35
+ const DeclaredType = ArrayType(FunctionInputType);
36
+ /** What a task's details say it reads. */
37
+ const TaskInputsType = ArrayType(TaskInputType);
38
+ const encodeString = encodeBeast2For(StringType);
39
+ const encodeJobsPatch = encodeBeast2For(PatchType(DraftJobsType));
40
+ const decodeInt = decodeBeast2For(IntegerType);
41
+ const sameInputs = equalFor(InputsType);
42
+ const printInputs = printFor(InputsType);
43
+ const printOutcome = printFor(ExecuteResultType.fields.outcome);
44
+ /** The jobs the fixture's record holds as deployed: j1 and j3 on P1, j2 on P2. */
45
+ const SAVED = new SortedMap([
46
+ ['j1', { press: 'P1', hours: 2n }],
47
+ ['j2', { press: 'P2', hours: 3n }],
48
+ ['j3', { press: 'P1', hours: 4n }],
49
+ ], compareFor(StringType));
50
+ /** A draft of the jobs' `move`: that job on that press. */
51
+ function moveDraft(key, press) {
52
+ return { record: 'jobs', mutation: 'move', args: [encodeString(key), encodeString(press)] };
53
+ }
54
+ /** A draft of the jobs' `patch`: j1's hours set, its press as it was. */
55
+ function hoursDraft(hours) {
56
+ const after = new SortedMap([...SAVED], compareFor(StringType));
57
+ after.set('j1', { press: 'P1', hours });
58
+ return { record: 'jobs', mutation: 'patch', args: [encodeJobsPatch(diffFor(DraftJobsType)(SAVED, after))] };
59
+ }
60
+ /** A call of a press, and the drafts it lays. */
61
+ function request(press, drafts = []) {
62
+ return { args: [variant('value', encodeString(press))], runner: none, limits: none, drafts };
63
+ }
64
+ /** A result's Integer, once it succeeded. */
65
+ function countOf(result) {
66
+ if (result.outcome.type !== 'success')
67
+ assert.fail(`expected success, got ${printOutcome(result.outcome)}\n${result.stderr}`);
68
+ return decodeInt(result.outcome.value.value);
69
+ }
70
+ /** The messages of a result refused before anything ran. */
71
+ function refusals(result) {
72
+ if (result.outcome.type !== 'invalid')
73
+ assert.fail(`expected invalid, got ${printOutcome(result.outcome)}\n${result.stderr}`);
74
+ return result.outcome.value.diagnostics.map((diagnostic) => diagnostic.message);
75
+ }
76
+ /** Asserts a result names exactly `expected` as what it read. */
77
+ function assertInputs(result, expected, what) {
78
+ assert.ok(sameInputs(result.inputs, expected), `${what}: inputs ${printInputs(result.inputs)}, expected ${printInputs(expected)}`);
79
+ }
80
+ /** A call started and polled to its end: its result. */
81
+ async function called(ctx, ws, fn, req, opts) {
82
+ const answer = await workspaceFunctionStart(ctx.config.baseUrl, ctx.repoName, ws, fn, req, opts);
83
+ let status = answer.status;
84
+ while (status.type === 'running') {
85
+ status = await workspaceFunctionCallStatus(ctx.config.baseUrl, ctx.repoName, ws, answer.id, opts, { waitMs: 20_000 });
86
+ }
87
+ if (status.type !== 'completed')
88
+ assert.fail(`expected completed, got ${status.type}`);
89
+ return status.value;
90
+ }
91
+ /** The hash the workspace holds a dataset at. */
92
+ async function hashOf(ctx, ws, path, opts) {
93
+ const status = await datasetGetStatus(ctx.config.baseUrl, ctx.repoName, ws, path, opts);
94
+ if (status.hash.type === 'none')
95
+ assert.fail(`${status.path} holds no value`);
96
+ return status.hash.value;
97
+ }
98
+ /** A Save of a draft: its mutation called, to be committed. */
99
+ async function save(ctx, ws, draft, opts) {
100
+ const result = await workspaceRecordMutate(ctx.config.baseUrl, ctx.repoName, ws, draft.record, draft.mutation, { args: draft.args, actor: none, limits: none }, opts);
101
+ assertMutationCommitted(result, `saving ${draft.record}.${draft.mutation}`);
102
+ }
103
+ /** How a run left a task: whether the cache served it. */
104
+ function ranOf(result, task) {
105
+ const ran = result.tasks.find(({ name }) => name === task);
106
+ if (ran === undefined)
107
+ assert.fail(`the run names no task ${task}:\n${describeDataflowResult(result)}`);
108
+ return { cached: ran.cached };
109
+ }
110
+ /**
111
+ * Register the tests of an index of a record as an input.
112
+ *
113
+ * @param setup - Factory that creates a fresh test context per test
114
+ */
115
+ export function indexInputTests(setup) {
116
+ describe('index inputs', { concurrency: false }, () => {
117
+ /** A copy of a workspace the fixture is deployed to, the test's own:
118
+ * `jobs` holds j1 and j3 on P1 and j2 on P2, `backlog` holds no state,
119
+ * and `watched` is P1. Deployed once for the suite. */
120
+ const withIndexes = templateWorkspace(setup, async (ctx, ws) => {
121
+ await ctx.importPackage(await createIndexInputsPackageZip(ctx.tempDir, PKG, VERSION));
122
+ await ctx.createWorkspace(ws);
123
+ await ctx.deployPackage(ws, `${PKG}@${VERSION}`);
124
+ });
125
+ /** The watched press's count, as the task last wrote it. */
126
+ async function watchedJobs(ctx, ws, opts) {
127
+ return decodeInt((await datasetGet(ctx.config.baseUrl, ctx.repoName, ws, WATCHED_JOBS_PATH, opts)).data);
128
+ }
129
+ /** The status of the task `watched_jobs`, as the workspace's status says it. */
130
+ async function watchedJobsStatus(ctx, ws, opts) {
131
+ const task = (await workspaceStatus(ctx.config.baseUrl, ctx.repoName, ws, opts)).tasks.find(({ name }) => name === 'watched_jobs');
132
+ if (task === undefined)
133
+ assert.fail('the workspace has no task watched_jobs');
134
+ return task.status.type;
135
+ }
136
+ it('a function\'s signature and a task\'s details name the record and the index each reads', async (t) => {
137
+ const { ctx, workspace: ws } = await withIndexes(t);
138
+ const opts = await ctx.opts();
139
+ const base = ctx.config.baseUrl;
140
+ const alone = await workspaceFunctionDescribe(base, ctx.repoName, ws, 'jobs_on_press', opts);
141
+ assert.ok(equalFor(DeclaredType)(alone.inputs, [{ path: JOBS_PATH, index: some('by_press') }]), `jobs_on_press reads ${printFor(DeclaredType)(alone.inputs)}`);
142
+ assert.deepEqual(alone.drafts, ['jobs'], 'and may be passed drafts of the record its index is over');
143
+ const beside = await workspaceFunctionDescribe(base, ctx.repoName, ws, 'hours_on_press', opts);
144
+ assert.ok(equalFor(DeclaredType)(beside.inputs, [{ path: JOBS_PATH, index: some('by_press') }, { path: JOBS_PATH, index: none }]), `hours_on_press reads ${printFor(DeclaredType)(beside.inputs)}`);
145
+ const task = await taskGet(base, ctx.repoName, ws, 'watched_jobs', opts);
146
+ assert.ok(equalFor(TaskInputsType)(task.inputs, [
147
+ { path: JOBS_PATH, index: some('by_press'), partition: none },
148
+ { path: WATCHED_PATH, index: none, partition: none },
149
+ ]), `watched_jobs reads ${printFor(TaskInputsType)(task.inputs)}`);
150
+ });
151
+ it('a call reads the run of an index key, and names the record, the index and the one state its inputs of the record were read at', async (t) => {
152
+ const { ctx, workspace: ws } = await withIndexes(t);
153
+ const opts = await ctx.opts();
154
+ const state = await hashOf(ctx, ws, JOBS_PATH, opts);
155
+ const onP1 = await called(ctx, ws, 'jobs_on_press', request('P1'), opts);
156
+ assert.equal(countOf(onP1), 2n, 'j1 and j3');
157
+ assertInputs(onP1, [{ path: JOBS_PATH, index: some('by_press'), hash: state }], 'a call that reads the index alone');
158
+ assert.equal(countOf(await called(ctx, ws, 'jobs_on_press', request('P2'), opts)), 1n, 'j2');
159
+ assert.equal(countOf(await called(ctx, ws, 'jobs_on_press', request('P9'), opts)), 0n, 'a press with no job');
160
+ // More of a row than the index carries, read from the record beside it by the entry's key
161
+ const hours = await workspaceFunctionCallSync(ctx.config.baseUrl, ctx.repoName, ws, 'hours_on_press', request('P1'), opts);
162
+ assert.equal(countOf(hours), 6n, 'j1\'s 2 hours and j3\'s 4');
163
+ assertInputs(hours, [
164
+ { path: JOBS_PATH, index: some('by_press'), hash: state },
165
+ { path: JOBS_PATH, index: none, hash: state },
166
+ ], 'the index and the record beside it are read at one state');
167
+ });
168
+ it('a call\'s drafts are read through the index, at the drafted state, and nothing is saved', async (t) => {
169
+ const { ctx, workspace: ws } = await withIndexes(t);
170
+ const opts = await ctx.opts();
171
+ const base = ctx.config.baseUrl;
172
+ const state = await hashOf(ctx, ws, JOBS_PATH, opts);
173
+ const commits = (await workspaceRecordHistory(base, ctx.repoName, ws, 'jobs', undefined, opts)).commits.length;
174
+ // j2 dragged onto P1, unsaved: the index holds it as it would after the Save
175
+ const drafted = await called(ctx, ws, 'jobs_on_press', request('P1', [moveDraft('j2', 'P1')]), opts);
176
+ assert.equal(countOf(drafted), 3n, 'j1, j3 and the job dragged on');
177
+ const [read] = drafted.inputs;
178
+ if (read === undefined || drafted.inputs.length !== 1)
179
+ assert.fail(`it names ${printInputs(drafted.inputs)} as read`);
180
+ assertInputs(drafted, [{ path: JOBS_PATH, index: some('by_press'), hash: read.hash }], 'the drafted call');
181
+ assert.notEqual(read.hash, state, 'the index is read at the drafted state, which the result names');
182
+ // The record beside the index holds the drafts too, at the same state
183
+ const hours = await called(ctx, ws, 'hours_on_press', request('P1', [moveDraft('j2', 'P1'), hoursDraft(10n)]), opts);
184
+ assert.equal(countOf(hours), 17n, 'j1\'s 10 hours as edited, j2\'s 3 and j3\'s 4');
185
+ assert.ok(hours.inputs.length === 2 && hours.inputs[0].hash === hours.inputs[1].hash && hours.inputs[0].hash !== state, `both inputs of the record name the one drafted state: ${printInputs(hours.inputs)}`);
186
+ assert.equal(await hashOf(ctx, ws, JOBS_PATH, opts), state, 'the record stands where it stood');
187
+ assert.equal((await workspaceRecordHistory(base, ctx.repoName, ws, 'jobs', undefined, opts)).commits.length, commits, 'and no commit joined its history');
188
+ assert.equal(countOf(await called(ctx, ws, 'jobs_on_press', request('P1'), opts)), 2n, 'a call with no draft reads it as saved');
189
+ // A Save of the same edit leaves the state the call read
190
+ await save(ctx, ws, moveDraft('j2', 'P1'), opts);
191
+ assert.equal(await hashOf(ctx, ws, JOBS_PATH, opts), read.hash, 'hash for hash');
192
+ });
193
+ it('a task runs over an index, is served by the cache when a write leaves the index as it was, and runs again when the index changes', async (t) => {
194
+ const { ctx, workspace: ws } = await withIndexes(t);
195
+ const opts = await ctx.opts();
196
+ const base = ctx.config.baseUrl;
197
+ const first = await dataflowExecute(base, ctx.repoName, ws, {}, opts);
198
+ assertDataflowSucceeded(first, 'the first run');
199
+ assert.deepEqual(ranOf(first, 'watched_jobs'), { cached: false });
200
+ assert.equal(await watchedJobs(ctx, ws, opts), 2n, 'j1 and j3 are on the watched press');
201
+ assert.equal(await watchedJobsStatus(ctx, ws, opts), 'up-to-date');
202
+ // j1's hours change: the record changes, and its index by press does not
203
+ const before = await hashOf(ctx, ws, JOBS_PATH, opts);
204
+ await save(ctx, ws, hoursDraft(10n), opts);
205
+ assert.notEqual(await hashOf(ctx, ws, JOBS_PATH, opts), before, 'the record changed');
206
+ assert.equal(await watchedJobsStatus(ctx, ws, opts), 'up-to-date', 'what the task read is as it was');
207
+ const again = await dataflowExecute(base, ctx.repoName, ws, {}, opts);
208
+ assertDataflowSucceeded(again, 'the run after the hours changed');
209
+ assert.equal(again.executed, 0n, `nothing ran again:\n${describeDataflowResult(again)}`);
210
+ assert.equal(await watchedJobs(ctx, ws, opts), 2n);
211
+ // j2 moves onto the watched press: the index changes
212
+ await save(ctx, ws, moveDraft('j2', 'P1'), opts);
213
+ assert.equal(await watchedJobsStatus(ctx, ws, opts), 'ready', 'the task is to run again');
214
+ const rerun = await dataflowExecute(base, ctx.repoName, ws, {}, opts);
215
+ assertDataflowSucceeded(rerun, 'the run after the job moved');
216
+ assert.deepEqual(ranOf(rerun, 'watched_jobs'), { cached: false });
217
+ assert.equal(await watchedJobs(ctx, ws, opts), 3n);
218
+ assert.equal(await watchedJobsStatus(ctx, ws, opts), 'up-to-date');
219
+ });
220
+ it('an index of a record with no state yet makes a call invalid and a task wait, as the record does', async (t) => {
221
+ const { ctx, workspace: ws } = await withIndexes(t);
222
+ const opts = await ctx.opts();
223
+ const base = ctx.config.baseUrl;
224
+ assert.equal((await datasetGetStatus(base, ctx.repoName, ws, BACKLOG_PATH, opts)).hash.type, 'none', 'the backlog holds no state');
225
+ const result = await called(ctx, ws, 'backlog_on_press', request('P1'), opts);
226
+ assert.deepEqual(refusals(result), [
227
+ 'The function\'s input .records.backlog is not assigned (ref type: unassigned): its first state is not yet committed, and nothing ran',
228
+ ]);
229
+ assertInputs(result, [], 'a call refused before anything ran');
230
+ const run = await dataflowExecute(base, ctx.repoName, ws, {}, opts);
231
+ assertDataflowSucceeded(run, 'the run goes on without the task that waits');
232
+ assert.equal(run.waiting, 1n, `the backlog's task waits:\n${describeDataflowResult(run)}`);
233
+ const waiting = (await workspaceStatus(base, ctx.repoName, ws, opts)).tasks.find(({ name }) => name === 'watched_backlog');
234
+ assert.equal(waiting?.status.type, 'waiting');
235
+ });
236
+ it('a call through the package, which reads no workspace, is refused, naming the index and the record', async (t) => {
237
+ const { ctx } = await withIndexes(t);
238
+ const opts = await ctx.opts();
239
+ const viaPackage = await functionCall(ctx.config.baseUrl, ctx.repoName, PKG, VERSION, 'hours_on_press', request('P1'), opts);
240
+ assert.deepEqual(refusals(viaPackage), [
241
+ '\'hours_on_press\' reads the index by_press of .records.jobs, .records.jobs from the workspace it is called through, '
242
+ + 'and a call through the package has none: call it through a workspace it is deployed to, at …/workspaces/<ws>/functions/hours_on_press',
243
+ ]);
244
+ });
245
+ });
246
+ }
247
+ //# sourceMappingURL=index-inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-inputs.js","sourceRoot":"","sources":["../../../src/suites/index-inputs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAC/I,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,OAAO,EACP,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,GAOhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AAEvG,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG5G,OAAO,EAA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M,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;gBACrC,uHAAuH;sBACrH,uIAAuI;aAC1I,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"records-series.d.ts","sourceRoot":"","sources":["../../../src/suites/records-series.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAwS7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CA4crE"}
1
+ {"version":3,"file":"records-series.d.ts","sourceRoot":"","sources":["../../../src/suites/records-series.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA4T7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CA6crE"}
@@ -35,7 +35,7 @@ import { describe, it } from 'node:test';
35
35
  import assert from 'node:assert/strict';
36
36
  import { readFileSync } from 'node:fs';
37
37
  import { ArrayType, DateTimeType, FloatType, IntegerType, NullType, OptionType, PatchType, SortedMap, StringType, StructType, VariantType, compareFor, decodeBeast2For, diffFor, encodeBeast2For, equalFor, isTypeEqual, isTypeValueEqual, none, parseFor, printFor, printType, some, toEastTypeValue, variant, } from '@elaraai/east';
38
- import { NestedEntryKeyType, NestedEntryType, RecordLevelType, RecordNestedItemType, RecordNestedPathType, RecordNestedRunType, RecordSummaryTotalsType, indexWindowType, } from '@elaraai/e3-types';
38
+ import { NestedEntryKeyType, NestedEntryType, NestedIdType, RecordLevelType, RecordNestedPathType, RecordNestedRunType, RecordSummaryTotalsType, indexWindowType, } from '@elaraai/e3-types';
39
39
  import { ApiError, packageImport, workspaceCreate, workspaceDeploy, workspaceRecordDescribe, workspaceRecordMutate, datasetFindKeys, datasetGet, datasetGetPage, datasetGetRuns, datasetGetStatus, datasetPlace, datasetWithin, } from '@elaraai/e3-api-client';
40
40
  import { assertMutationCommitted } from '../assertions.js';
41
41
  import { templateWorkspace } from '../template.js';
@@ -157,17 +157,22 @@ function recordAt(name) {
157
157
  const HOUR_MS = 3_600_000;
158
158
  /** The machines' job lengths, in hours, a job each in turn: filed at the week, the week, the week, the month and the quarter. */
159
159
  const JOB_HOURS = [4, 30, 80, 200, 1_000];
160
- /** A nested index's entry key, at the records' String keys. */
161
- const NestedKeyType = NestedEntryKeyType(StringType);
160
+ /**
161
+ * Each nested index's entry key, at the records' String keys: its ids (#1540) a case for each collection keyed by an
162
+ * id, by its place — the machines' jobs, the halls' members, the assemblies' parts and their jobs.
163
+ */
164
+ const MachinesKeyType = NestedEntryKeyType(StringType, NestedIdType({ jobs: StringType }));
165
+ const HallsKeyType = NestedEntryKeyType(StringType, NestedIdType({ members: StringType }));
166
+ const AssembliesKeyType = NestedEntryKeyType(StringType, NestedIdType({ parts: StringType, 'parts.jobs': StringType }));
162
167
  /** What each nested index files, by place, nesting as its declaration nests. */
163
168
  const MachinePlacesType = VariantType({ jobs: NestedJobType, load: FloatType });
164
169
  const HallPlacesType = VariantType({ members: VariantType({ load: FloatType }) });
165
170
  const AssemblyPlacesType = VariantType({ parts: VariantType({ jobs: NestedJobType }) });
166
171
  /** Each nested index's window: an entry's key, its row's key, what it carries, and no row — a nested index is read alone. */
167
- const MachinesWindowType = ArrayType(StructType({ ik: NestedKeyType, key: StringType, value: NestedEntryType(MachinePlacesType), row: OptionType(MachineType) }));
168
- const HallsWindowType = ArrayType(StructType({ ik: NestedKeyType, key: StringType, value: NestedEntryType(HallPlacesType), row: OptionType(HallType) }));
172
+ const MachinesWindowType = ArrayType(StructType({ ik: MachinesKeyType, key: StringType, value: NestedEntryType(MachinePlacesType), row: OptionType(MachineType) }));
173
+ const HallsWindowType = ArrayType(StructType({ ik: HallsKeyType, key: StringType, value: NestedEntryType(HallPlacesType), row: OptionType(HallType) }));
169
174
  const AssembliesWindowType = ArrayType(StructType({
170
- ik: NestedKeyType, key: StringType, value: NestedEntryType(AssemblyPlacesType), row: OptionType(AssemblyType),
175
+ ik: AssembliesKeyType, key: StringType, value: NestedEntryType(AssemblyPlacesType), row: OptionType(AssemblyType),
171
176
  }));
172
177
  const decodeMachinesWindow = decodeBeast2For(MachinesWindowType);
173
178
  const decodeHallsWindow = decodeBeast2For(HallsWindowType);
@@ -177,7 +182,9 @@ const encodeHallsPatch = encodeBeast2For(PatchType(HallsType));
177
182
  const encodeAssembliesPatch = encodeBeast2For(PatchType(AssembliesType));
178
183
  const printPath = printFor(RecordNestedPathType);
179
184
  const printRun = printFor(RecordNestedRunType);
180
- const printItem = printFor(RecordNestedItemType);
185
+ const printMachineItem = printFor(MachinesKeyType.fields.item);
186
+ const printAssemblyItem = printFor(AssembliesKeyType.fields.item);
187
+ const printAssemblyPath = printFor(AssembliesKeyType.fields.path);
181
188
  const machineEntryEqual = equalFor(NestedEntryType(MachinePlacesType));
182
189
  const assemblyEntryEqual = equalFor(NestedEntryType(AssemblyPlacesType));
183
190
  const hallEntryEqual = equalFor(NestedEntryType(HallPlacesType));
@@ -188,13 +195,24 @@ const ITEMS = variant('items', null);
188
195
  const TOTALS_RUN = variant('totals', null);
189
196
  const SUBTREE = variant('subtree', null);
190
197
  const MEAN = variant('subtotals', { fold: variant('mean', null), aggregate: variant('mean', null) });
191
- /** A place, or a node's path, as a nested key holds it: its keys, folded from the last. */
198
+ /** A collection's place as a nested key holds it: its field names, folded from the last. */
192
199
  function pathOf(keys) {
193
200
  return keys.reduceRight((rest, key) => variant('step', { key, rest }), variant('end', null));
194
201
  }
202
+ /**
203
+ * A node's path as a nested key holds it (#1540): its child rows' keys, each under the case of the rows it is a key
204
+ * of, folded from the last.
205
+ */
206
+ function nodePath(rows, keys) {
207
+ return keys.reduceRight((rest, key) => variant('step', { key: variant(rows, key), rest }), variant('end', null));
208
+ }
209
+ /** The row itself, as a search names a node's path: no child row's key, which every index prints alike. */
210
+ const ROW_ITSELF = printPath(pathOf([]));
211
+ /** The part `p1` of an assembly, as a search names its path. */
212
+ const PART_P1 = printAssemblyPath(nodePath('parts', ['p1']));
195
213
  /** A nested key's leading fields, as a search names them: the collection's place, the row, the node's path, the run and the level. */
196
214
  function nestedLead(collection, row, path, run, level) {
197
- return [printPath(pathOf(collection)), printString(row), printPath(pathOf(path)), printRun(run), printLevel(variant(level, null))];
215
+ return [printPath(pathOf(collection)), printString(row), path, printRun(run), printLevel(variant(level, null))];
198
216
  }
199
217
  /** A search over one run of a nested index at one level: its tiles from `from` to before `to`. */
200
218
  function nestedRange(collection, row, path, run, level, from, to) {
@@ -544,9 +562,9 @@ export function seriesRecordTests(setup) {
544
562
  const nested = sig.indexes.find((index) => stringEqual(index.name, 'machines_in_time'));
545
563
  const bySite = sig.indexes.find((index) => stringEqual(index.name, 'machines_by_site'));
546
564
  assert.ok(nested !== undefined && nested.built && nested.multi, 'the nested index is built, a row filing many entries');
547
- assert.ok(isTypeValueEqual(nested.keyType, toEastTypeValue(NestedKeyType)), 'keyed by place, row, path, run, level, tile and item');
565
+ assert.ok(isTypeValueEqual(nested.keyType, toEastTypeValue(MachinesKeyType)), 'keyed by place, row, path, run, level, tile and item, its jobs\' ids in their own type');
548
566
  assert.ok(isTypeValueEqual(nested.valueType, toEastTypeValue(NestedEntryType(MachinePlacesType))), 'carrying an item, its totals or a subtotal');
549
- assert.ok(isTypeEqual(MachinesWindowType, indexWindowType(StringType, NestedKeyType, NestedEntryType(MachinePlacesType), MachineType)), 'its window is e3-types\' index window');
567
+ assert.ok(isTypeEqual(MachinesWindowType, indexWindowType(StringType, MachinesKeyType, NestedEntryType(MachinePlacesType), MachineType)), 'its window is e3-types\' index window');
550
568
  assert.ok(bySite !== undefined && isTypeValueEqual(bySite.keyType, toEastTypeValue(StringType)), 'machines_by_site is keyed by the site');
551
569
  assert.ok(isTypeValueEqual(bySite.valueType, toEastTypeValue(MachineType)), 'machines_by_site carries a machine');
552
570
  // A page of it, read without a join: each machine without its jobs and its load.
@@ -571,22 +589,23 @@ export function seriesRecordTests(setup) {
571
589
  const to = from + 3 * WEEK_MS;
572
590
  const runs = levelRuns(from, to);
573
591
  const block = [...machines.keys()].slice(5, 55);
574
- const searches = block.flatMap((row) => runs.map((run) => nestedRange(['jobs'], row, [], ITEMS, run.level, run.from, run.to)));
592
+ const searches = block.flatMap((row) => runs.map((run) => nestedRange(['jobs'], row, ROW_ITSELF, ITEMS, run.level, run.from, run.to)));
575
593
  assert.equal(searches.length, 50 * 4, 'a range a machine a level, whatever the span');
576
594
  const entries = await readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', searches, hash, decodeMachinesWindow);
577
595
  const read = [];
578
596
  for (const entry of entries) {
579
597
  assert.ok(entry.ik.item.type === 'id', `${entry.key}: a job, by its id`);
580
- const id = entry.ik.item.value;
598
+ // The job's id, out of its collection's case of the index's ids.
599
+ const id = entry.ik.item.value.value;
581
600
  const job = machines.get(entry.key)?.jobs.get(id);
582
601
  assert.ok(job !== undefined && machineEntryEqual(entry.value, variant('item', variant('jobs', job))), `${entry.key} ${id} is carried whole`);
583
602
  assert.ok(entry.row.type === 'none', `${entry.key} ${id} is read from the index alone`);
584
- read.push(`${entry.key} ${printItem(entry.ik.item)} ${printLevel(entry.ik.level)} ${printDateTime(entry.ik.tile)}`);
603
+ read.push(`${entry.key} ${printMachineItem(entry.ik.item)} ${printLevel(entry.ik.level)} ${printDateTime(entry.ik.tile)}`);
585
604
  }
586
605
  // Held to the brute force: under each run, the block's jobs filed there, each once, and no other.
587
606
  const expected = block.flatMap((row) => [...machines.get(row).jobs].flatMap(([id, job]) => filingsOf(job)
588
607
  .filter((filed) => runs.some((run) => run.level === filed.level && filed.tile >= run.from && filed.tile < run.to))
589
- .map((filed) => `${row} ${printItem(variant('id', id))} ${printLevel(variant(filed.level, null))} ${printDateTime(new Date(filed.tile))}`)));
608
+ .map((filed) => `${row} ${printMachineItem(variant('id', variant('jobs', id)))} ${printLevel(variant(filed.level, null))} ${printDateTime(new Date(filed.tile))}`)));
590
609
  assert.ok(expected.length > 0, 'the block has jobs those weeks');
591
610
  assert.deepEqual(read.sort(stringOrder), expected.sort(stringOrder), 'every job the runs hold, each once, and no other');
592
611
  });
@@ -596,7 +615,7 @@ export function seriesRecordTests(setup) {
596
615
  const from = tileStep('month', tileStart('month', JOBS_FROM.getTime()), -2);
597
616
  const to = tileStep('month', from, 8);
598
617
  const searches = [...machines.keys()].flatMap((row) => [
599
- nestedRange(['jobs'], row, [], TOTALS_RUN, 'month', from, to), nestedRange(['load'], row, [], TOTALS_RUN, 'month', from, to),
618
+ nestedRange(['jobs'], row, ROW_ITSELF, TOTALS_RUN, 'month', from, to), nestedRange(['load'], row, ROW_ITSELF, TOTALS_RUN, 'month', from, to),
600
619
  ]);
601
620
  const entries = await readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', searches, hash, decodeMachinesWindow);
602
621
  // Worked out from the rows: each machine's jobs a month, and its load's values in key order.
@@ -630,7 +649,7 @@ export function seriesRecordTests(setup) {
630
649
  const hash = await nestedHash(ctx, ws, 'halls');
631
650
  const from = tileStep('week', weekHolding(JOBS_FROM.getTime()), -2);
632
651
  const to = tileStep('week', from, 12);
633
- const entries = await readRuns(ctx, ws, recordAt('halls'), 'halls_in_time', [nestedRange(['members', 'load'], 'H-1', [], MEAN, 'week', from, to)], hash, decodeHallsWindow);
652
+ const entries = await readRuns(ctx, ws, recordAt('halls'), 'halls_in_time', [nestedRange(['members', 'load'], 'H-1', ROW_ITSELF, MEAN, 'week', from, to)], hash, decodeHallsWindow);
634
653
  // Worked out from the rows: each member's values a week, in key order, their mean; the hall's, its members' means' mean, in theirs.
635
654
  const means = new Map();
636
655
  for (const member of halls.get('H-1').members.values()) {
@@ -656,19 +675,19 @@ export function seriesRecordTests(setup) {
656
675
  const { ctx, ws } = await withNested(t);
657
676
  const hash = await nestedHash(ctx, ws, 'assemblies');
658
677
  const runs = levelRuns(JOBS_FROM.getTime(), JOBS_FROM.getTime() + 8 * WEEK_MS);
659
- const searches = runs.map((run) => nestedRange(['parts', 'jobs'], 'A-0', ['p1'], SUBTREE, run.level, run.from, run.to));
678
+ const searches = runs.map((run) => nestedRange(['parts', 'jobs'], 'A-0', PART_P1, SUBTREE, run.level, run.from, run.to));
660
679
  assert.equal(searches.length, 4, 'a range a level');
661
680
  const entries = await readRuns(ctx, ws, recordAt('assemblies'), 'assemblies_in_time', searches, hash, decodeAssembliesWindow);
662
681
  // Beneath p1: p1.1's two jobs and p1.1.1's one — p1's own is in its items, not its subtree.
663
682
  const beneath = [{ path: ['p1.1'], letter: 'b' }, { path: ['p1.1'], letter: 'c' }, { path: ['p1.1', 'p1.1.1'], letter: 'd' }];
664
- const expected = beneath.flatMap(({ path, letter }) => filingsOf(partJob(0, letter)).map((filed) => `${printItem(variant('under', { path: pathOf(path), id: `j-0-${letter}` }))} ${printLevel(variant(filed.level, null))} ${printDateTime(new Date(filed.tile))}`));
665
- const read = entries.map((entry) => `${printItem(entry.ik.item)} ${printLevel(entry.ik.level)} ${printDateTime(entry.ik.tile)}`);
683
+ const expected = beneath.flatMap(({ path, letter }) => filingsOf(partJob(0, letter)).map((filed) => `${printAssemblyItem(variant('under', { path: nodePath('parts', path), id: variant('parts.jobs', `j-0-${letter}`) }))} ${printLevel(variant(filed.level, null))} ${printDateTime(new Date(filed.tile))}`));
684
+ const read = entries.map((entry) => `${printAssemblyItem(entry.ik.item)} ${printLevel(entry.ik.level)} ${printDateTime(entry.ik.tile)}`);
666
685
  assert.deepEqual(read.sort(stringOrder), expected.sort(stringOrder), 'every job beneath p1, each once, and no other');
667
686
  for (const entry of entries) {
668
- assert.ok(stringEqual(printPath(entry.ik.path), printPath(pathOf(['p1']))), 'filed under p1');
687
+ assert.ok(stringEqual(printAssemblyPath(entry.ik.path), PART_P1), 'filed under p1');
669
688
  assert.ok(entry.ik.item.type === 'under', 'a job beneath it, by its path and id');
670
- const letter = entry.ik.item.value.id.slice(-1);
671
- assert.ok(assemblyEntryEqual(entry.value, variant('item', variant('parts', variant('jobs', partJob(0, letter))))), `${entry.ik.item.value.id} is carried whole`);
689
+ const letter = entry.ik.item.value.id.value.slice(-1);
690
+ assert.ok(assemblyEntryEqual(entry.value, variant('item', variant('parts', variant('jobs', partJob(0, letter))))), `${letter} is carried whole`);
672
691
  }
673
692
  });
674
693
  it('reads a job moved three weeks on where it went, and not where it was, and totals the months as the jobs then give them', async (t) => {
@@ -685,18 +704,18 @@ export function seriesRecordTests(setup) {
685
704
  // Another session moves it, through the record's patch door.
686
705
  await writeNested(ctx, ws, 'machines', encodeMachinesPatch(diffFor(MachinesType)(machines, next)));
687
706
  const hash = await nestedHash(ctx, ws, 'machines');
688
- const itemEqual = equalFor(RecordNestedItemType);
689
- const tile = (filed) => readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', [nestedTile(['jobs'], row, [], ITEMS, filed)], hash, decodeMachinesWindow);
707
+ const itemEqual = equalFor(MachinesKeyType.fields.item);
708
+ const tile = (filed) => readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', [nestedTile(['jobs'], row, ROW_ITSELF, ITEMS, filed)], hash, decodeMachinesWindow);
690
709
  for (const filed of filingsOf(job)) {
691
710
  const read = await tile(filed);
692
- assert.ok(!read.some((entry) => itemEqual(entry.ik.item, variant('id', id))), `${id} has left the ${filed.level} of ${printDateTime(new Date(filed.tile))}`);
711
+ assert.ok(!read.some((entry) => itemEqual(entry.ik.item, variant('id', variant('jobs', id)))), `${id} has left the ${filed.level} of ${printDateTime(new Date(filed.tile))}`);
693
712
  }
694
713
  for (const filed of filingsOf(moved)) {
695
- const entry = (await tile(filed)).find((e) => itemEqual(e.ik.item, variant('id', id)));
714
+ const entry = (await tile(filed)).find((e) => itemEqual(e.ik.item, variant('id', variant('jobs', id))));
696
715
  assert.ok(entry !== undefined && machineEntryEqual(entry.value, variant('item', variant('jobs', moved))), `${id} is read in the ${filed.level} of ${printDateTime(new Date(filed.tile))}, as moved`);
697
716
  }
698
717
  const from = tileStep('month', tileStart('month', JOBS_FROM.getTime()), -2);
699
- const totals = await readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', [nestedRange(['jobs'], row, [], TOTALS_RUN, 'month', from, tileStep('month', from, 8))], hash, decodeMachinesWindow);
718
+ const totals = await readRuns(ctx, ws, recordAt('machines'), 'machines_in_time', [nestedRange(['jobs'], row, ROW_ITSELF, TOTALS_RUN, 'month', from, tileStep('month', from, 8))], hash, decodeMachinesWindow);
700
719
  const expected = monthTotals(jobs.values());
701
720
  assert.equal(totals.length, expected.size, 'a total for each month its jobs touch');
702
721
  for (const entry of totals) {