@elaraai/e3-cli 1.0.80 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import type { DeploySourceProgress } from '@elaraai/e3-core';
6
+ import type { DeployProgress, IntakeFile } from '@elaraai/e3-types';
7
+ import { type Progress, type StepHandle } from './progress.js';
8
+ /** Reports files as they are taken in. */
9
+ export interface IntakeReporter {
10
+ /**
11
+ * Hears how far a file has got.
12
+ *
13
+ * @param progress - The file's progress, with every file the intake takes in
14
+ */
15
+ report(progress: DeploySourceProgress): void;
16
+ /** Ends the live line without a summary: the intake failed. */
17
+ fail(): void;
18
+ }
19
+ /**
20
+ * Builds the reporter of an intake of files.
21
+ *
22
+ * @param progress - Where the lines go
23
+ * @param now - The clock, in milliseconds (injectable for tests)
24
+ * @returns The reporter, which completes its live line with a summary once the
25
+ * last of the files it hears of is in
26
+ */
27
+ export declare function intakeReporter(progress: Progress, now?: () => number): IntakeReporter;
28
+ /** One upload, as it tells an {@link UploadReporter} how far it has got. */
29
+ export interface UploadHandle {
30
+ /**
31
+ * Hears how far this machine has hashed the file.
32
+ *
33
+ * @param bytes - The bytes read so far
34
+ */
35
+ hashing(bytes: number): void;
36
+ /** Hears that the file's bytes are being sent. */
37
+ sending(): void;
38
+ /**
39
+ * Hears how far the server's commit has taken the file in.
40
+ *
41
+ * @param file - How far it has got, as the server says
42
+ */
43
+ committing(file: IntakeFile): void;
44
+ /**
45
+ * Prints the file's line: it is in.
46
+ *
47
+ * @param text - What the line says
48
+ */
49
+ done(text: string): void;
50
+ }
51
+ /** Reports files uploaded side by side. */
52
+ export interface UploadReporter {
53
+ /**
54
+ * Starts a file's upload, which joins the live line.
55
+ *
56
+ * @param name - What the lines call the file
57
+ * @param total - Its size
58
+ * @returns Where the upload says how far it has got
59
+ */
60
+ start(name: string, total: number): UploadHandle;
61
+ /** Ends the live line without a summary: an upload failed, and the uploads
62
+ * still in flight are no longer heard. */
63
+ fail(): void;
64
+ }
65
+ /**
66
+ * Builds the reporter of files uploaded side by side: a `✔` line per file as
67
+ * it finishes, a summary once the last is in, and on a terminal a live line
68
+ * naming the files in flight, each with what it is doing — hashing here,
69
+ * sending, or being taken in by the server's commit.
70
+ *
71
+ * @param progress - Where the lines go
72
+ * @param count - How many files
73
+ * @param bytes - Their bytes between them
74
+ * @param now - The clock, in milliseconds (injectable for tests)
75
+ * @returns The reporter, whose live line starts at once
76
+ */
77
+ export declare function uploadReporter(progress: Progress, count: number, bytes: number, now?: () => number): UploadReporter;
78
+ /**
79
+ * Hashes a delivery before it is uploaded, saying on the upload's line how far
80
+ * the read has got: the hash is how the server knows a delivery it already
81
+ * holds, which then costs no upload at all.
82
+ *
83
+ * @param file - The delivery
84
+ * @param size - Its size
85
+ * @param name - What the line calls it
86
+ * @param step - The upload's line
87
+ * @param now - The clock, in milliseconds (injectable for tests)
88
+ * @returns The file's SHA-256, as lowercase hex
89
+ */
90
+ export declare function hashDelivery(file: string, size: number, name: string, step: StepHandle, now?: () => number): Promise<string>;
91
+ /**
92
+ * What a server says of a delivery its commit is taking in, as the line that
93
+ * uploaded it shows it: `the server is hashing it: 12.0 MB/67.4 MB`, then
94
+ * `taking it in`, with its pieces when it has several.
95
+ *
96
+ * @param file - How far the commit has got, as the server says
97
+ * @returns The text
98
+ */
99
+ export declare function commitText(file: IntakeFile): string;
100
+ /**
101
+ * What a server's deploy job says it is doing, as the line that waits for it
102
+ * shows it: its file sources while it takes them in, then the record it
103
+ * migrates or builds an index of, or `finishing`.
104
+ *
105
+ * @param progress - How far the job has got, as the server says
106
+ * @returns The text
107
+ */
108
+ export declare function deployJobText(progress: DeployProgress): string;
109
+ //# sourceMappingURL=intake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src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,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAE,MAAM,MAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5I;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAOnD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAc9D"}
@@ -0,0 +1,290 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * How taking files into a repository shows as it goes: a `✔` line per file as
7
+ * it finishes — its name, size, time, rate and how it was taken in, naming the
8
+ * runner that took it in — and, on a terminal, a live line for the files in
9
+ * flight, each with how far it has got, and the rate and time left across them
10
+ * all.
11
+ *
12
+ * A file is hashed before it is taken in: the hash is how the store knows a
13
+ * delivery it already holds, which then costs nothing more. A collection is
14
+ * then taken in by intake units on the runners, a piece of its segments each,
15
+ * and moves forward as each piece finishes. The live line says which a file is
16
+ * doing. A runner that fell back to another says why once, on the line of the
17
+ * first file it took in.
18
+ *
19
+ * Against a server, a delivery is hashed here first, saying how far the read
20
+ * has got, and the rest shows as the server says it: what its commit of the
21
+ * upload is doing with the file, and what its deploy job is doing. A deploy
22
+ * uploads its file sources side by side, shown as a local deploy's are: a `✔`
23
+ * line per file as it finishes, and a live line for the files in flight.
24
+ */
25
+ import { sha256File } from '@elaraai/e3';
26
+ import { formatBytes } from './progress.js';
27
+ /** How often the live line is redrawn, at most. */
28
+ const REDRAW_MS = 100;
29
+ /** How many files in flight the live line names; it counts the rest. */
30
+ const NAMED_IN_FLIGHT = 3;
31
+ /** What a file's line says of how it was taken in. */
32
+ function takenText(file) {
33
+ switch (file.taken) {
34
+ case 'known': return 'unchanged, already in the store';
35
+ case 'taken': return file.runners === undefined || file.runners.length === 0
36
+ ? 'taken in from the pieces an earlier intake finished'
37
+ : `taken in by ${file.runners.join(' and ')}`;
38
+ default: return 'carried';
39
+ }
40
+ }
41
+ /** What each way a file was taken in says in the summary. */
42
+ const TAKEN_SHORT = { known: 'unchanged', carried: 'carried', taken: 'taken in' };
43
+ /**
44
+ * Builds the reporter of an intake of files.
45
+ *
46
+ * @param progress - Where the lines go
47
+ * @param now - The clock, in milliseconds (injectable for tests)
48
+ * @returns The reporter, which completes its live line with a summary once the
49
+ * last of the files it hears of is in
50
+ */
51
+ export function intakeReporter(progress, now = Date.now) {
52
+ const inFlight = new Map();
53
+ const taken = { known: 0, carried: 0, taken: 0 };
54
+ let step;
55
+ let started = 0;
56
+ let finished = 0;
57
+ let finishedBytes = 0;
58
+ let drawn = 0;
59
+ let fellBack = false;
60
+ /** Bytes taken in so far: every finished file's, and the in-flight files'
61
+ * past their hash. */
62
+ const moved = () => {
63
+ let bytes = finishedBytes;
64
+ for (const file of inFlight.values())
65
+ if (file.phase === 'take-in')
66
+ bytes += file.bytes;
67
+ return bytes;
68
+ };
69
+ const live = (sources) => {
70
+ const done = moved();
71
+ const seconds = (now() - started) / 1000;
72
+ const rate = seconds > 0 ? done / seconds : 0;
73
+ const files = [...inFlight.values()];
74
+ const named = files.slice(0, NAMED_IN_FLIGHT).map((file) => {
75
+ const pieces = file.phase === 'take-in' && file.pieces !== undefined && file.pieces.total > 1 ? ` (${file.pieces.done}/${file.pieces.total} pieces)` : '';
76
+ return `${file.name} ${file.phase === 'hash' ? 'hashing ' : ''}${formatBytes(file.bytes)}/${formatBytes(file.total)}${pieces}`;
77
+ });
78
+ if (files.length > NAMED_IN_FLIGHT)
79
+ named.push(`${files.length - NAMED_IN_FLIGHT} more`);
80
+ const pace = rate > 0 ? `, ${formatBytes(rate)}/s, ${formatSeconds((sources.bytes - done) / rate)} left` : '';
81
+ return `taking in ${finished}/${sources.count} files, ${formatBytes(done)}/${formatBytes(sources.bytes)}${pace}: ${named.join(', ')}`;
82
+ };
83
+ const draw = (sources, force) => {
84
+ const at = now();
85
+ if (!force && at - drawn < REDRAW_MS)
86
+ return;
87
+ drawn = at;
88
+ step?.update(live(sources));
89
+ };
90
+ const summary = (sources) => {
91
+ const seconds = (now() - started) / 1000;
92
+ const how = Object.keys(TAKEN_SHORT)
93
+ .filter((way) => taken[way] > 0)
94
+ .map((way) => `${taken[way]} ${TAKEN_SHORT[way]}`);
95
+ const files = `${sources.count} file${sources.count === 1 ? '' : 's'}`;
96
+ return `took in ${files}, ${formatBytes(sources.bytes)} in ${formatSeconds(seconds)}${rateOf(sources.bytes, seconds)}: ${how.join(', ')}`;
97
+ };
98
+ return {
99
+ report(p) {
100
+ if (step === undefined) {
101
+ started = now();
102
+ step = progress.step(`taking in ${p.sources.count} file${p.sources.count === 1 ? '' : 's'} (${formatBytes(p.sources.bytes)})`);
103
+ }
104
+ const name = p.path.split('/').pop() ?? p.path;
105
+ if (p.phase === 'done') {
106
+ const file = inFlight.get(p.path);
107
+ inFlight.delete(p.path);
108
+ finished++;
109
+ finishedBytes += p.total;
110
+ const way = p.taken ?? 'carried';
111
+ taken[way]++;
112
+ const seconds = (now() - (file?.since ?? now())) / 1000;
113
+ // Why a runner fell back is said once, on the first file it touched.
114
+ const why = p.fallback !== undefined && !fellBack ? `, since ${p.fallback}` : '';
115
+ if (p.fallback !== undefined)
116
+ fellBack = true;
117
+ progress.phase(`${name} ${formatBytes(p.total)} in ${formatSeconds(seconds)}${rateOf(p.total, seconds)}, ${takenText(p)}${why}`);
118
+ if (finished === p.sources.count) {
119
+ step.done(summary(p.sources));
120
+ }
121
+ else {
122
+ draw(p.sources, true);
123
+ }
124
+ return;
125
+ }
126
+ const file = inFlight.get(p.path) ?? { name, since: now(), phase: p.phase, bytes: 0, total: p.total, pieces: undefined };
127
+ file.phase = p.phase;
128
+ file.bytes = p.bytes;
129
+ file.total = p.total;
130
+ file.pieces = p.pieces;
131
+ inFlight.set(p.path, file);
132
+ draw(p.sources, false);
133
+ },
134
+ fail() {
135
+ step?.fail();
136
+ },
137
+ };
138
+ }
139
+ /**
140
+ * Builds the reporter of files uploaded side by side: a `✔` line per file as
141
+ * it finishes, a summary once the last is in, and on a terminal a live line
142
+ * naming the files in flight, each with what it is doing — hashing here,
143
+ * sending, or being taken in by the server's commit.
144
+ *
145
+ * @param progress - Where the lines go
146
+ * @param count - How many files
147
+ * @param bytes - Their bytes between them
148
+ * @param now - The clock, in milliseconds (injectable for tests)
149
+ * @returns The reporter, whose live line starts at once
150
+ */
151
+ export function uploadReporter(progress, count, bytes, now = Date.now) {
152
+ const files = `${count} file${count === 1 ? '' : 's'}`;
153
+ const started = now();
154
+ const step = progress.step(`uploading ${files} (${formatBytes(bytes)})`);
155
+ const inFlight = new Set();
156
+ let finished = 0;
157
+ let drawn = 0;
158
+ let failed = false;
159
+ const draw = (force) => {
160
+ const at = now();
161
+ if (!force && at - drawn < REDRAW_MS)
162
+ return;
163
+ drawn = at;
164
+ const named = [...inFlight].slice(0, NAMED_IN_FLIGHT).map((file) => `${file.name} ${file.doing}`);
165
+ if (inFlight.size > NAMED_IN_FLIGHT)
166
+ named.push(`${inFlight.size - NAMED_IN_FLIGHT} more`);
167
+ step.update(`uploading ${finished}/${count} files: ${named.join(', ')}`);
168
+ };
169
+ return {
170
+ start(name, total) {
171
+ const file = { name, doing: `hashing 0 B/${formatBytes(total)}` };
172
+ const hear = (doing, force) => {
173
+ if (failed || !inFlight.has(file))
174
+ return;
175
+ file.doing = doing;
176
+ draw(force);
177
+ };
178
+ if (!failed) {
179
+ inFlight.add(file);
180
+ draw(true);
181
+ }
182
+ return {
183
+ hashing: (read) => hear(`hashing ${formatBytes(read)}/${formatBytes(total)}`, false),
184
+ sending: () => hear(`sending ${formatBytes(total)}`, true),
185
+ committing: (intake) => hear(`server ${serverDoing(intake)}`, false),
186
+ done(text) {
187
+ if (failed || !inFlight.delete(file))
188
+ return;
189
+ finished++;
190
+ progress.phase(text);
191
+ if (finished < count) {
192
+ draw(true);
193
+ return;
194
+ }
195
+ const seconds = (now() - started) / 1000;
196
+ step.done(`uploaded ${files}, ${formatBytes(bytes)} in ${formatSeconds(seconds)}${rateOf(bytes, seconds)}`);
197
+ },
198
+ };
199
+ },
200
+ fail() {
201
+ failed = true;
202
+ step.fail();
203
+ },
204
+ };
205
+ }
206
+ /** What a server's commit is doing with an upload, as the live line says it. */
207
+ function serverDoing(file) {
208
+ const moved = `${formatBytes(Number(file.bytes))}/${formatBytes(Number(file.total))}`;
209
+ switch (file.step.type) {
210
+ case 'waiting': return 'waiting';
211
+ case 'hashing': return `hashing ${moved}`;
212
+ case 'taking_in': {
213
+ const { pieces, done } = file.step.value;
214
+ return `taking in ${moved}${pieces > 1n ? ` (${done}/${pieces} pieces)` : ''}`;
215
+ }
216
+ default: return 'done';
217
+ }
218
+ }
219
+ /**
220
+ * Hashes a delivery before it is uploaded, saying on the upload's line how far
221
+ * the read has got: the hash is how the server knows a delivery it already
222
+ * holds, which then costs no upload at all.
223
+ *
224
+ * @param file - The delivery
225
+ * @param size - Its size
226
+ * @param name - What the line calls it
227
+ * @param step - The upload's line
228
+ * @param now - The clock, in milliseconds (injectable for tests)
229
+ * @returns The file's SHA-256, as lowercase hex
230
+ */
231
+ export async function hashDelivery(file, size, name, step, now = Date.now) {
232
+ let drawn = 0;
233
+ return sha256File(file, (bytes) => {
234
+ const at = now();
235
+ if (at - drawn < REDRAW_MS)
236
+ return;
237
+ drawn = at;
238
+ step.update(`hashing ${name}: ${formatBytes(bytes)}/${formatBytes(size)}`);
239
+ });
240
+ }
241
+ /**
242
+ * What a server says of a delivery its commit is taking in, as the line that
243
+ * uploaded it shows it: `the server is hashing it: 12.0 MB/67.4 MB`, then
244
+ * `taking it in`, with its pieces when it has several.
245
+ *
246
+ * @param file - How far the commit has got, as the server says
247
+ * @returns The text
248
+ */
249
+ export function commitText(file) {
250
+ const doing = file.step.type === 'hashing' ? 'hashing it'
251
+ : file.step.type === 'taking_in'
252
+ ? (file.step.value.pieces > 1n ? `taking it in (${file.step.value.done}/${file.step.value.pieces} pieces)` : 'taking it in')
253
+ : file.step.type === 'waiting' ? 'about to take it in'
254
+ : 'done with it';
255
+ return `the server is ${doing}: ${formatBytes(Number(file.bytes))}/${formatBytes(Number(file.total))}`;
256
+ }
257
+ /**
258
+ * What a server's deploy job says it is doing, as the line that waits for it
259
+ * shows it: its file sources while it takes them in, then the record it
260
+ * migrates or builds an index of, or `finishing`.
261
+ *
262
+ * @param progress - How far the job has got, as the server says
263
+ * @returns The text
264
+ */
265
+ export function deployJobText(progress) {
266
+ const files = progress.files;
267
+ const done = files.filter((file) => file.step.type === 'done').length;
268
+ if (done < files.length)
269
+ return `taking in ${done}/${files.length} files`;
270
+ for (const record of progress.records) {
271
+ const name = record.plan.record.split('/').pop() ?? record.plan.record;
272
+ if (record.step.type === 'migrating') {
273
+ return `migrating ${name}: ${record.step.value.name} (${record.step.value.step}/${record.step.value.steps})`;
274
+ }
275
+ if (record.step.type === 'indexing') {
276
+ return `building ${name}.${record.step.value.index} (${record.step.value.build}/${record.step.value.builds})`;
277
+ }
278
+ }
279
+ return 'finishing';
280
+ }
281
+ /** `12.3 s`, or `2 min 5 s` past a minute. */
282
+ function formatSeconds(seconds) {
283
+ const s = Number.isFinite(seconds) ? Math.max(0, seconds) : 0;
284
+ return s < 60 ? `${s.toFixed(1)} s` : `${Math.floor(s / 60)} min ${Math.round(s % 60)} s`;
285
+ }
286
+ /** ` (58.2 MB/s)`, or nothing for no time at all. */
287
+ function rateOf(bytes, seconds) {
288
+ return seconds > 0 ? ` (${formatBytes(bytes / seconds)}/s)` : '';
289
+ }
290
+ //# sourceMappingURL=intake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.js","sourceRoot":"","sources":["../../src/intake.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EA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C,OAAe;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;AAC5F,CAAC;AAED,qDAAqD;AACrD,SAAS,MAAM,CAAC,KAAa,EAAE,OAAe;IAC5C,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=intake.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.spec.d.ts","sourceRoot":"","sources":["../../src/intake.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { test } from 'node:test';
6
+ import assert from 'node:assert';
7
+ import { createHash } from 'node:crypto';
8
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
9
+ import { tmpdir } from 'node:os';
10
+ import { join } from 'node:path';
11
+ import { variant } from '@elaraai/east';
12
+ import { createProgress } from './progress.js';
13
+ import { commitText, deployJobText, hashDelivery, intakeReporter, uploadReporter } from './intake.js';
14
+ function fakeStream(tty) {
15
+ const chunks = [];
16
+ return { chunks, isTTY: tty, write: (c) => { chunks.push(c); return true; } };
17
+ }
18
+ const MB = 1024 * 1024;
19
+ const sources = { count: 3, bytes: 30 * MB };
20
+ const event = (path, rest) => ({ path, file: `/deliveries/${path.split('/').pop()}.beast2`, sources, phase: 'hash', bytes: 0, total: 10 * MB, ...rest });
21
+ test('a line per file as it finishes, naming the runner that took it in, and a summary once the last is in', () => {
22
+ const stream = fakeStream(false);
23
+ let clock = 0;
24
+ const intake = intakeReporter(createProgress({ stream }), () => clock);
25
+ intake.report(event('inputs/a', { phase: 'hash', bytes: 5 * MB }));
26
+ intake.report(event('inputs/b', { phase: 'hash', bytes: 5 * MB }));
27
+ clock = 1000;
28
+ intake.report(event('inputs/a', { phase: 'take-in', bytes: 10 * MB }));
29
+ clock = 2000;
30
+ intake.report(event('inputs/a', { phase: 'done', bytes: 10 * MB, taken: 'carried' }));
31
+ intake.report(event('inputs/b', { phase: 'done', bytes: 10 * MB, taken: 'known' }));
32
+ intake.report(event('inputs/c', { phase: 'take-in', bytes: 0, pieces: { done: 0, total: 4 } }));
33
+ clock = 4000;
34
+ intake.report(event('inputs/c', { phase: 'done', bytes: 10 * MB, taken: 'taken', runners: ['east-c'] }));
35
+ assert.deepStrictEqual(stream.chunks.join('').split('\n').filter(Boolean), [
36
+ 'taking in 3 files (30.0 MB) …',
37
+ '✔ a 10.0 MB in 2.0 s (5.0 MB/s), carried',
38
+ '✔ b 10.0 MB in 2.0 s (5.0 MB/s), unchanged, already in the store',
39
+ '✔ c 10.0 MB in 2.0 s (5.0 MB/s), taken in by east-c',
40
+ '✔ took in 3 files, 30.0 MB in 4.0 s (7.5 MB/s): 1 unchanged, 1 carried, 1 taken in',
41
+ ]);
42
+ });
43
+ test('a runner that fell back says why once, on the first file it took in', () => {
44
+ const stream = fakeStream(false);
45
+ const intake = intakeReporter(createProgress({ stream }), () => 0);
46
+ const fallback = 'east-c exited 2 without recording a result for the intake unit (Unknown command: exec)';
47
+ for (const path of ['inputs/a', 'inputs/b']) {
48
+ intake.report(event(path, { phase: 'done', bytes: 10 * MB, taken: 'taken', runners: ['east-node'], fallback }));
49
+ }
50
+ intake.report(event('inputs/c', { phase: 'done', bytes: 10 * MB, taken: 'taken', runners: [] }));
51
+ assert.deepStrictEqual(stream.chunks.join('').split('\n').filter(Boolean).slice(1, 4), [
52
+ `✔ a 10.0 MB in 0.0 s, taken in by east-node, since ${fallback}`,
53
+ '✔ b 10.0 MB in 0.0 s, taken in by east-node',
54
+ '✔ c 10.0 MB in 0.0 s, taken in from the pieces an earlier intake finished',
55
+ ]);
56
+ });
57
+ test('on a terminal, the live line names the files in flight, their pieces, and the pace across them', () => {
58
+ const stream = fakeStream(true);
59
+ let clock = 0;
60
+ const intake = intakeReporter(createProgress({ stream }), () => clock);
61
+ intake.report(event('inputs/a', { phase: 'hash', bytes: 2 * MB }));
62
+ clock = 1000;
63
+ intake.report(event('inputs/a', { phase: 'take-in', bytes: 5 * MB, pieces: { done: 2, total: 4 } }));
64
+ const out = stream.chunks.join('');
65
+ assert.ok(out.includes('taking in 0/3 files, 5.0 MB/30.0 MB, 5.0 MB/s, 5.0 s left: a 5.0 MB/10.0 MB (2/4 pieces)'), out);
66
+ });
67
+ test('a failed intake ends its live line without a summary', () => {
68
+ const stream = fakeStream(false);
69
+ const intake = intakeReporter(createProgress({ stream }), () => 0);
70
+ intake.report(event('inputs/a', { phase: 'hash', bytes: MB }));
71
+ intake.fail();
72
+ assert.strictEqual(stream.chunks.join('').includes('took in'), false);
73
+ });
74
+ test('uploads side by side: a line per file as it finishes, and a summary once the last is in', () => {
75
+ const stream = fakeStream(false);
76
+ let clock = 0;
77
+ const upload = uploadReporter(createProgress({ stream }), 2, 20 * MB, () => clock);
78
+ const a = upload.start('a', 10 * MB);
79
+ const b = upload.start('b', 10 * MB);
80
+ a.hashing(5 * MB);
81
+ b.sending();
82
+ clock = 1000;
83
+ b.done('uploaded ws.b (10.0 MB, 0123456789ab...)');
84
+ clock = 2000;
85
+ a.done('uploaded ws.a (10.0 MB, ba9876543210...)');
86
+ assert.deepStrictEqual(stream.chunks.join('').split('\n').filter(Boolean), [
87
+ 'uploading 2 files (20.0 MB) …',
88
+ '✔ uploaded ws.b (10.0 MB, 0123456789ab...)',
89
+ '✔ uploaded ws.a (10.0 MB, ba9876543210...)',
90
+ '✔ uploaded 2 files, 20.0 MB in 2.0 s (10.0 MB/s)',
91
+ ]);
92
+ });
93
+ test('on a terminal, the upload line names the files in flight and what each is doing', () => {
94
+ const stream = fakeStream(true);
95
+ let clock = 0;
96
+ const upload = uploadReporter(createProgress({ stream }), 5, 50 * MB, () => clock);
97
+ const [a, b, c] = ['a', 'b', 'c', 'd'].map((name) => upload.start(name, 10 * MB));
98
+ clock = 1000;
99
+ a.hashing(4 * MB);
100
+ b.sending();
101
+ clock = 2000;
102
+ c.committing({ path: 'inputs/c', step: variant('taking_in', { pieces: 4n, done: 1n }), bytes: BigInt(3 * MB), total: BigInt(10 * MB) });
103
+ upload.fail();
104
+ const out = stream.chunks.join('');
105
+ assert.ok(out.includes('uploading 0/5 files: a hashing 4.0 MB/10.0 MB, b sending 10.0 MB, c server taking in 3.0 MB/10.0 MB (1/4 pieces), 1 more'), out);
106
+ });
107
+ test('a failed upload ends the live line without a summary, and the uploads still in flight are no longer heard', () => {
108
+ const stream = fakeStream(false);
109
+ const upload = uploadReporter(createProgress({ stream }), 2, 20 * MB, () => 0);
110
+ const a = upload.start('a', 10 * MB);
111
+ const b = upload.start('b', 10 * MB);
112
+ upload.fail();
113
+ a.done('uploaded ws.a (10.0 MB, 0123456789ab...)');
114
+ b.done('uploaded ws.b (10.0 MB, ba9876543210...)');
115
+ assert.deepStrictEqual(stream.chunks.join('').split('\n').filter(Boolean), ['uploading 2 files (20.0 MB) …']);
116
+ });
117
+ test('an upload hashes its delivery first, saying how far the read has got, at most every tenth of a second', async () => {
118
+ const dir = mkdtempSync(join(tmpdir(), 'e3-intake-'));
119
+ try {
120
+ const file = join(dir, 'table.beast2');
121
+ const bytes = new Uint8Array(3 * MB).fill(7);
122
+ writeFileSync(file, bytes);
123
+ const lines = () => {
124
+ const updates = [];
125
+ return { updates, step: { update: (text) => { updates.push(text); }, done: () => { }, fail: () => { } } };
126
+ };
127
+ // The clock moves a tenth of a second between reads: every read is said.
128
+ const paced = lines();
129
+ let clock = 0;
130
+ const hash = await hashDelivery(file, bytes.length, 'table', paced.step, () => (clock += 100));
131
+ assert.strictEqual(hash, createHash('sha256').update(bytes).digest('hex'));
132
+ assert.deepStrictEqual(paced.updates, ['hashing table: 1.0 MB/3.0 MB', 'hashing table: 2.0 MB/3.0 MB', 'hashing table: 3.0 MB/3.0 MB']);
133
+ // It stands still: the first read is said, and the rest wait for the clock.
134
+ const still = lines();
135
+ await hashDelivery(file, bytes.length, 'table', still.step, () => 100);
136
+ assert.deepStrictEqual(still.updates, ['hashing table: 1.0 MB/3.0 MB']);
137
+ }
138
+ finally {
139
+ rmSync(dir, { recursive: true, force: true });
140
+ }
141
+ });
142
+ test("a server's commit says what it is doing with the file", () => {
143
+ const at = (step) => commitText({ path: 'inputs/a', step, bytes: BigInt(4 * MB), total: BigInt(10 * MB) });
144
+ assert.strictEqual(at(variant('hashing', null)), 'the server is hashing it: 4.0 MB/10.0 MB');
145
+ assert.strictEqual(at(variant('taking_in', { pieces: 1n, done: 0n })), 'the server is taking it in: 4.0 MB/10.0 MB');
146
+ assert.strictEqual(at(variant('taking_in', { pieces: 4n, done: 1n })), 'the server is taking it in (1/4 pieces): 4.0 MB/10.0 MB');
147
+ });
148
+ test("a server's deploy job says its files, then the record it migrates or indexes, then finishing", () => {
149
+ const file = (step) => ({ path: 'inputs/a', step, bytes: 0n, total: 1n });
150
+ const job = (files, step) => ({
151
+ package: { name: 'p', version: '1.0.0' },
152
+ startedAt: new Date(0),
153
+ files,
154
+ records: [{ plan: { record: 'records/orders', action: variant('migrate', { steps: ['a', 'b'] }) }, indexes: ['by_customer'], step }],
155
+ });
156
+ const done = file(variant('done', variant('carried', null)));
157
+ assert.strictEqual(deployJobText(job([done, file(variant('waiting', null))], variant('waiting', null))), 'taking in 1/2 files');
158
+ assert.strictEqual(deployJobText(job([done], variant('migrating', { name: 'b', step: 2n, steps: 2n }))), 'migrating orders: b (2/2)');
159
+ assert.strictEqual(deployJobText(job([], variant('indexing', { index: 'by_customer', build: 1n, builds: 1n }))), 'building orders.by_customer (1/1)');
160
+ assert.strictEqual(deployJobText(job([done], variant('done', null))), 'finishing');
161
+ });
162
+ //# sourceMappingURL=intake.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.spec.js","sourceRoot":"","sources":["../../src/intake.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAwC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtG,SAAS,UAAU,CAAC,GAAY;IAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAS,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,MAAM,EAAE,GAAG,I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I,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,mCAAmC,CAAC,CAAC;IACtJ,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC"}
@@ -52,7 +52,7 @@ export declare function createProgress(options?: {
52
52
  stream?: ProgressStream;
53
53
  }): Progress;
54
54
  /**
55
- * Format a byte count for progress lines (`812 kB`, `1.2 MB`).
55
+ * Format a byte count for progress lines (`812 kB`, `1.2 MB`, `7.5 GB`).
56
56
  *
57
57
  * @param bytes - The byte count
58
58
  * @returns Human-readable size
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/progress.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,kFAAkF;IAClF,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,wEAAwE;IACxE,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8EAA8E;IAC9E,IAAI,IAAI,IAAI,CAAC;CACd;AAED,4EAA4E;AAC5E,MAAM,WAAW,QAAQ;IACvB,+CAA+C;IAC/C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,qDAAqD;AACrD,M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