@elaraai/east-node-cli 1.0.82 → 1.0.84

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.
package/dist/runner.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
4
  */
5
- import { type UnitResult } from '@elaraai/east';
5
+ import { type UnitDecode, type UnitResult } from '@elaraai/east';
6
6
  import type { PlatformFunction, EastTypeValue } from '@elaraai/east/internal';
7
7
  /** A file's size for the verbose account, or `?` when it cannot be read. @internal */
8
8
  export declare function formatFileSize(path: string): string;
@@ -25,8 +25,48 @@ export declare function reportInput(i: number, path: string, type: EastTypeValue
25
25
  */
26
26
  export declare function reportInputLazy(i: number): void;
27
27
  /**
28
- * Prints what reading a lazily opened input came to, against what it weighs;
29
- * nothing for an input read whole.
28
+ * Prints the verbose account of an input decoded whole as it loaded: the
29
+ * growth in resident memory across its decode — what it holds in memory, as a
30
+ * runner that loads its inputs first sees it — beside what it weighs on disk,
31
+ * since a nested collection decodes at many times that.
32
+ *
33
+ * @param i - the input's position
34
+ * @param bytes - the growth in resident memory, in bytes
35
+ * @internal
36
+ */
37
+ export declare function reportInputWhole(i: number, bytes: number): void;
38
+ /**
39
+ * Opens a program's inputs, always frozen: task inputs are immutable, and
40
+ * mutating one throws the uniform copy-first error.
41
+ *
42
+ * With `decode` lazy, each beast2 collection input opens as a paged value
43
+ * whatever it weighs, so a read decodes only the segments it reaches and an
44
+ * operation the pager cannot serve decodes it whole, once, when it first needs
45
+ * it; frozen collapses the shape gate, so nested element shapes open lazily
46
+ * too. With `whole`, every input is decoded before the program runs. An input
47
+ * that cannot open lazily — another format, an index-less blob, an element
48
+ * shape holding a Ref or a function — is decoded whole either way. A manifest
49
+ * is the collection it names, its segments the files beside it.
50
+ *
51
+ * @param paths - the input files, in parameter order
52
+ * @param types - the parameters' types
53
+ * @param decode - how the collection inputs are read
54
+ * @param verbose - print how each input opened: lazily, or decoded whole and
55
+ * the resident memory it added
56
+ * @returns the inputs, in parameter order
57
+ * @internal
58
+ */
59
+ export declare function openInputs(paths: readonly string[], types: readonly EastTypeValue[], decode: UnitDecode, verbose: boolean): unknown[];
60
+ /**
61
+ * Prints what reading a lazily opened input came to; nothing for an input
62
+ * decoded whole as it loaded.
63
+ *
64
+ * An operation the pager cannot serve decoded the input whole, and says what
65
+ * that added to resident memory; reads that decoded segments again, beyond the
66
+ * ones the pager keeps, say so, since decoding the input whole would decode
67
+ * each once; any other reads say the segments they decoded and the fences
68
+ * they probed, and then the bytes they read, against what the input weighs.
69
+ * east-c and east-py say each in the same words, but for the bytes read.
30
70
  *
31
71
  * @param i - the input's position
32
72
  * @param path - its file
@@ -46,16 +86,23 @@ export declare function reportInputReads(i: number, path: string, value: unknown
46
86
  export declare class UsageError extends Error {
47
87
  constructor(message: string);
48
88
  }
49
- /** Resolves the lazy-open threshold: the environment, else the default. An
50
- * unset or empty `EAST_LAZY_INPUT_BYTES` falls through to the 64 MiB default
51
- * (`Number('')` is `0`, which would silently DISABLE lazy opening); invalid
52
- * or negative values fall through too, matching east-c and east-py. Exported
53
- * for `exec` and the spec. @internal */
54
- export declare function lazyThreshold(): number;
55
89
  /**
56
90
  * Runs an East IR program.
91
+ *
92
+ * @param irPath - the program's IR file
93
+ * @param platformFns - the platform functions it may call
94
+ * @param packages - the platform packages they came from, for the verbose
95
+ * account
96
+ * @param inputPaths - one input file per parameter, in order
97
+ * @param outputPath - where the result is written, in its extension's format;
98
+ * without it the result prints as East text
99
+ * @param verbose - print where the time went, the peak memory and how each
100
+ * input opened
101
+ * @param decode - how the collection inputs are read: lazily (the default), or
102
+ * decoded whole before the program runs
103
+ * @returns the result, when it is not written to `outputPath`
57
104
  */
58
- export declare function runProgram(irPath: string, platformFns: PlatformFunction[], packages: string[], inputPaths: string[], outputPath?: string, verbose?: boolean): Promise<unknown>;
105
+ export declare function runProgram(irPath: string, platformFns: PlatformFunction[], packages: string[], inputPaths: string[], outputPath?: string, verbose?: boolean, decode?: UnitDecode): Promise<unknown>;
59
106
  /** A compiled `(K, V, V) -> V` fold of equal keys. */
60
107
  export type MergeFunction = (key: unknown, acc: unknown, value: unknown) => unknown;
61
108
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EASH,KAAK,UAAU,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAa9E,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAQD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAG9E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAG9E;AAED;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI9B;AAKD;;;;yCAIyC;AACzC,wBAAgB,aAAa,IAAI,MAAM,CAOtC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC5B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,UAAQ,GAChB,OAAO,CAAC,OAAO,CAAC,CAoGlB;AAED,sDAAsD;AACtD,MAAM,MAA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AO,GAAG,OAAO,EAAE,CAYrI;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAc9E;AAED;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,UAAU,CAC5B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,UAAQ,EACf,MAAM,GAAE,UAAkC,GAC3C,OAAO,CAAC,OAAO,CAAC,CAyFlB;AAED,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAEpF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAejK;AAqBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAUpD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAQlC"}
package/dist/runner.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { readFileSync, statSync, writeFileSync } from 'fs';
6
6
  import { extname } from 'path';
7
- import { EastIR, encodeBeast2For, encodeBeast2PagedFor, encodeEastFor, encodeJSONFor, isTypeValueEqual, printFor, variant, } from '@elaraai/east';
7
+ import { EastIR, beast2LazyStats, encodeBeast2For, encodeBeast2PagedFor, encodeEastFor, encodeJSONFor, isTypeValueEqual, printFor, variant, } from '@elaraai/east';
8
8
  import { printTypeValue } from '@elaraai/east/internal';
9
9
  import { inputBytes, lazyInputBytesRead, loadEastIR, loadInput, loadInputLazy } from './loader.js';
10
10
  function now() { return process.hrtime.bigint(); }
@@ -59,8 +59,76 @@ export function reportInputLazy(i) {
59
59
  console.error(` input ${i}: opened lazily — paged from the file`);
60
60
  }
61
61
  /**
62
- * Prints what reading a lazily opened input came to, against what it weighs;
63
- * nothing for an input read whole.
62
+ * What a whole decode added to resident memory, as the verbose account says
63
+ * it: `+X resident`, never below 0 B, since memory freed across the decode can
64
+ * leave the process smaller after it. The load-time and the mid-run
65
+ * whole-decode accounts both say it through here.
66
+ *
67
+ * @param bytes - the growth in resident memory, in bytes
68
+ * @returns the account's words for it
69
+ */
70
+ function formatResident(bytes) {
71
+ return `+${formatSize(Math.max(0, bytes))} resident`;
72
+ }
73
+ /**
74
+ * Prints the verbose account of an input decoded whole as it loaded: the
75
+ * growth in resident memory across its decode — what it holds in memory, as a
76
+ * runner that loads its inputs first sees it — beside what it weighs on disk,
77
+ * since a nested collection decodes at many times that.
78
+ *
79
+ * @param i - the input's position
80
+ * @param bytes - the growth in resident memory, in bytes
81
+ * @internal
82
+ */
83
+ export function reportInputWhole(i, bytes) {
84
+ console.error(` input ${i}: decoded whole — ${formatResident(bytes)}`);
85
+ }
86
+ /**
87
+ * Opens a program's inputs, always frozen: task inputs are immutable, and
88
+ * mutating one throws the uniform copy-first error.
89
+ *
90
+ * With `decode` lazy, each beast2 collection input opens as a paged value
91
+ * whatever it weighs, so a read decodes only the segments it reaches and an
92
+ * operation the pager cannot serve decodes it whole, once, when it first needs
93
+ * it; frozen collapses the shape gate, so nested element shapes open lazily
94
+ * too. With `whole`, every input is decoded before the program runs. An input
95
+ * that cannot open lazily — another format, an index-less blob, an element
96
+ * shape holding a Ref or a function — is decoded whole either way. A manifest
97
+ * is the collection it names, its segments the files beside it.
98
+ *
99
+ * @param paths - the input files, in parameter order
100
+ * @param types - the parameters' types
101
+ * @param decode - how the collection inputs are read
102
+ * @param verbose - print how each input opened: lazily, or decoded whole and
103
+ * the resident memory it added
104
+ * @returns the inputs, in parameter order
105
+ * @internal
106
+ */
107
+ export function openInputs(paths, types, decode, verbose) {
108
+ return paths.map((path, i) => {
109
+ const lazy = decode.type === 'lazy' ? loadInputLazy(path) : undefined;
110
+ if (lazy !== undefined) {
111
+ if (verbose)
112
+ reportInputLazy(i);
113
+ return lazy;
114
+ }
115
+ const before = verbose ? process.memoryUsage.rss() : 0;
116
+ const value = loadInput(path, types[i]);
117
+ if (verbose)
118
+ reportInputWhole(i, process.memoryUsage.rss() - before);
119
+ return value;
120
+ });
121
+ }
122
+ /**
123
+ * Prints what reading a lazily opened input came to; nothing for an input
124
+ * decoded whole as it loaded.
125
+ *
126
+ * An operation the pager cannot serve decoded the input whole, and says what
127
+ * that added to resident memory; reads that decoded segments again, beyond the
128
+ * ones the pager keeps, say so, since decoding the input whole would decode
129
+ * each once; any other reads say the segments they decoded and the fences
130
+ * they probed, and then the bytes they read, against what the input weighs.
131
+ * east-c and east-py say each in the same words, but for the bytes read.
64
132
  *
65
133
  * @param i - the input's position
66
134
  * @param path - its file
@@ -69,8 +137,21 @@ export function reportInputLazy(i) {
69
137
  */
70
138
  export function reportInputReads(i, path, value) {
71
139
  const read = lazyInputBytesRead(value);
72
- if (read !== undefined)
73
- console.error(` input ${i}: ${formatSize(read)} read of ${formatInputSize(path)}`);
140
+ const stats = beast2LazyStats(value);
141
+ if (read === undefined || stats === undefined)
142
+ return;
143
+ if (stats.hydrated) {
144
+ console.error(` input ${i}: decoded whole (an operation the pager cannot serve) — ${formatResident(stats.hydratedBytes)}`);
145
+ }
146
+ else if (stats.segmentsDecoded > stats.segments) {
147
+ console.error(` input ${i}: ${stats.segmentsDecoded} segment decodes of its ${stats.segments} segments, ` +
148
+ `${stats.fencesProbed} fences probed — its reads land at random beyond the segments kept, so decoding it ` +
149
+ 'whole would decode each once');
150
+ }
151
+ else {
152
+ console.error(` input ${i}: ${stats.segmentsDecoded} of ${stats.segments} segments decoded, ${stats.fencesProbed} fences probed — ` +
153
+ `${formatSize(read)} read of ${formatInputSize(path)}`);
154
+ }
74
155
  }
75
156
  /**
76
157
  * A refusal of the command line itself — a function the inputs given do not
@@ -87,26 +168,23 @@ export class UsageError extends Error {
87
168
  this.name = 'UsageError';
88
169
  }
89
170
  }
90
- /** Default size threshold above which collection inputs open lazily. */
91
- const LAZY_INPUT_BYTES_DEFAULT = 64 * 1024 * 1024;
92
- /** Resolves the lazy-open threshold: the environment, else the default. An
93
- * unset or empty `EAST_LAZY_INPUT_BYTES` falls through to the 64 MiB default
94
- * (`Number('')` is `0`, which would silently DISABLE lazy opening); invalid
95
- * or negative values fall through too, matching east-c and east-py. Exported
96
- * for `exec` and the spec. @internal */
97
- export function lazyThreshold() {
98
- const raw = process.env.EAST_LAZY_INPUT_BYTES;
99
- if (raw !== undefined && raw !== '') {
100
- const env = Number(raw);
101
- if (Number.isFinite(env) && env >= 0)
102
- return env;
103
- }
104
- return LAZY_INPUT_BYTES_DEFAULT;
105
- }
106
171
  /**
107
172
  * Runs an East IR program.
173
+ *
174
+ * @param irPath - the program's IR file
175
+ * @param platformFns - the platform functions it may call
176
+ * @param packages - the platform packages they came from, for the verbose
177
+ * account
178
+ * @param inputPaths - one input file per parameter, in order
179
+ * @param outputPath - where the result is written, in its extension's format;
180
+ * without it the result prints as East text
181
+ * @param verbose - print where the time went, the peak memory and how each
182
+ * input opened
183
+ * @param decode - how the collection inputs are read: lazily (the default), or
184
+ * decoded whole before the program runs
185
+ * @returns the result, when it is not written to `outputPath`
108
186
  */
109
- export async function runProgram(irPath, platformFns, packages, inputPaths, outputPath, verbose = false) {
187
+ export async function runProgram(irPath, platformFns, packages, inputPaths, outputPath, verbose = false, decode = variant('lazy', null)) {
110
188
  const t0 = now();
111
189
  // Load as an EastIR bundle so source_map travels with the IR and error
112
190
  // frames resolve end-to-end.
@@ -139,21 +217,9 @@ export async function runProgram(irPath, platformFns, packages, inputPaths, outp
139
217
  console.error(` ${printTypeValue(outputType)}`);
140
218
  }
141
219
  }
142
- // Load inputs — always frozen (task inputs are immutable; mutating one
143
- // throws the uniform copy-first error). Beast2 collection inputs open
144
- // lazily at or above the size threshold, so a sparse read into a huge
145
- // indexed input stops paying a whole decode — and because frozen collapses
146
- // the shape gate, nested-container element shapes open lazily too. The
147
- // size is the value's: an input staged as a manifest is a small file
148
- // naming large ones.
149
- const threshold = lazyThreshold();
150
- const inputs = [];
151
- for (let i = 0; i < inputPaths.length; i++) {
152
- const lazy = threshold > 0 && inputBytes(inputPaths[i]) >= threshold ? loadInputLazy(inputPaths[i]) : undefined;
153
- if (lazy !== undefined && verbose)
154
- reportInputLazy(i);
155
- inputs.push(lazy !== undefined ? lazy : loadInput(inputPaths[i], inputTypes[i]));
156
- }
220
+ // Load inputs, frozen: each collection lazily, unless --decode whole says
221
+ // to decode them before the program runs.
222
+ const inputs = openInputs(inputPaths, inputTypes, decode, verbose);
157
223
  /** The verbose summary's account of each lazy input: what paging came
158
224
  * to, against the size of the value. */
159
225
  const reportLazyReads = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EACH,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,OAAO,GAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;A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IAAqB,CAAC;gBACnD,CAAC,CAAC,oBAAoB,CAAC,IAAW,CAAC;gBACnC,CAAC,CAAC,eAAe,CAAC,IAAW,CAAC,CAAC;YACnC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACxC,MAAM;QACV,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,aAAa,CAAC,IAAW,CAAC,CAAC;YAC3C,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACxC,MAAM;QACV,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,aAAa,CAAC,IAAW,CAAC,CAAC;YAC3C,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACxC,MAAM;QACV,CAAC;QACD;YACI,MAAM,IAAI,KAAK,CACX,sCAAsC,GAAG,KAAK;gBAC9C,qDAAqD,CACxD,CAAC;IACV,CAAC;AACL,CAAC"}
@@ -15,7 +15,7 @@ import { join } from 'node:path';
15
15
  import { spawn, spawnSync } from 'node:child_process';
16
16
  import { fileURLToPath } from 'node:url';
17
17
  import { ArrayType, DictType, FloatType, FunctionType, IntegerType, NullType, OptionType, SetType, StringType, StructType, Beast2ManifestWriter, East, SortedMap, SortedSet, UnitType, compareFor, decodeBeast2For, decodeCollectionManifest, encodeBeast2For, encodeBeast2PagedFor, encodeBeast2SegmentsFor, toEastTypeValue, encodeEastIR, none, openBeast2PagesFor, some, spliceBeast2, variant, } from '@elaraai/east';
18
- import { runProgram, lazyThreshold } from './runner.js';
18
+ import { runProgram } from './runner.js';
19
19
  import { mergeBlobs } from './merge.js';
20
20
  /** Runs `run` with console.error captured; returns what it printed. */
21
21
  async function stderrOf(run) {
@@ -30,20 +30,6 @@ async function stderrOf(run) {
30
30
  }
31
31
  return lines.join('\n');
32
32
  }
33
- /** Runs `run` with the lazy-open threshold set to `bytes`. */
34
- async function withLazyThreshold(bytes, run) {
35
- const saved = process.env.EAST_LAZY_INPUT_BYTES;
36
- process.env.EAST_LAZY_INPUT_BYTES = String(bytes);
37
- try {
38
- return await run();
39
- }
40
- finally {
41
- if (saved === undefined)
42
- delete process.env.EAST_LAZY_INPUT_BYTES;
43
- else
44
- process.env.EAST_LAZY_INPUT_BYTES = saved;
45
- }
46
- }
47
33
  /** `promise`'s value, or `undefined` once `ms` pass first — a bounded wait. */
48
34
  async function within(promise, ms) {
49
35
  let timer;
@@ -115,12 +101,12 @@ describe('lazy inputs', () => {
115
101
  writeFileSync(inputPath, encodeBeast2SegmentsFor(DT)(Array.from({ length: 8 }, (_, i) => new Map(entries.slice(i * 250, (i + 1) * 250)))));
116
102
  const fn = East.function([DT], StringType, ($, table) => table.get(1234n));
117
103
  const outputPath = join(tempDir, 'output.beast2');
118
- // Threshold of 1 byte forces the lazy open for any input size.
119
- await withLazyThreshold(1, () => runProgram(writeIr(fn), [], [], [inputPath], outputPath));
104
+ // Every collection input opens lazily, whatever it weighs.
105
+ await runProgram(writeIr(fn), [], [], [inputPath], outputPath);
120
106
  const result = decodeBeast2For(StringType)(new Uint8Array(readFileSync(outputPath)));
121
107
  assert.equal(result, 'row-1234');
122
108
  });
123
- it('reports a lazily opened input in verbose output', async () => {
109
+ it('reports a lazily opened input in verbose output, and what an input decoded whole holds', async () => {
124
110
  const DT = DictType(IntegerType, StringType);
125
111
  const table = new SortedMap(Array.from({ length: 500 }, (_, i) => [BigInt(i), `row-${i}`]), compareFor(IntegerType));
126
112
  const inputPath = join(tempDir, 'table.beast2');
@@ -128,20 +114,72 @@ describe('lazy inputs', () => {
128
114
  writeFileSync(inputPath, encodeBeast2SegmentsFor(DT)(Array.from({ length: 5 }, (_, i) => new Map(entries.slice(i * 100, (i + 1) * 100)))));
129
115
  const fn = East.function([DT], StringType, ($, table) => table.get(42n));
130
116
  const outputPath = join(tempDir, 'output.beast2');
131
- const err = await stderrOf(() => withLazyThreshold(1, () => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true)));
117
+ const err = await stderrOf(() => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true));
132
118
  assert.ok(err.includes('input 0: opened lazily'), `verbose output names the lazy input:\n${err}`);
119
+ assert.ok(!err.includes('decoded whole'), `a lazy input is not decoded whole:\n${err}`);
120
+ assert.equal(decodeBeast2For(StringType)(new Uint8Array(readFileSync(outputPath))), 'row-42');
121
+ // `whole` decodes it before the program runs, and says what it holds.
122
+ const whole = await stderrOf(() => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true, variant('whole', null)));
123
+ assert.ok(!whole.includes('opened lazily'), `a whole input opened lazily:\n${whole}`);
124
+ assert.match(whole, /input 0: decoded whole — \+[\d.]+ (B|KB|MB) resident/);
133
125
  assert.equal(decodeBeast2For(StringType)(new Uint8Array(readFileSync(outputPath))), 'row-42');
134
126
  });
135
- it('a lazily opened wide input reads a fraction of the file and stays below the eager run\'s residency', { skip: process.platform === 'win32' ? 'no RSS comparison on Windows' : false }, () => {
127
+ it('says a lazy input an operation read whole, and what that added to resident memory, in east-c\'s and east-py\'s words', async () => {
128
+ // A struct holds what it is built from whole, which the pager cannot
129
+ // serve: the input opens lazily, and the body reads it whole once.
130
+ const DT = DictType(IntegerType, StringType);
131
+ const inputPath = join(tempDir, 'table.beast2');
132
+ writeFileSync(inputPath, encodeBeast2PagedFor(DT)(new SortedMap(Array.from({ length: 500 }, (_, i) => [BigInt(i), `row-${i}`]), compareFor(IntegerType))));
133
+ const Boxed = StructType({ table: DT });
134
+ const fn = East.function([DT], IntegerType, ($, table) => {
135
+ const boxed = $.let({ table }, Boxed);
136
+ return boxed.table.size();
137
+ });
138
+ const outputPath = join(tempDir, 'output.beast2');
139
+ const err = await stderrOf(() => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true));
140
+ assert.equal(decodeBeast2For(IntegerType)(new Uint8Array(readFileSync(outputPath))), 500n);
141
+ assert.ok(err.includes('input 0: opened lazily'), err);
142
+ assert.match(err, /input 0: decoded whole \(an operation the pager cannot serve\) — \+[\d.]+ (B|KB|MB) resident/);
143
+ assert.ok(!err.includes(' read of '), `a whole read says so, not the bytes it read:\n${err}`);
144
+ });
145
+ it('says a lazy input\'s reads decoded its segments again, in east-c\'s and east-py\'s words', async () => {
146
+ // Keyed reads that cycle over five segments, one more than the pager
147
+ // keeps: each read decodes its segment again.
148
+ const DT = DictType(IntegerType, StringType);
149
+ const entries = Array.from({ length: 500 }, (_, i) => [BigInt(i), `row-${i}`]);
150
+ const inputPath = join(tempDir, 'table.beast2');
151
+ writeFileSync(inputPath, encodeBeast2SegmentsFor(DT)(Array.from({ length: 5 }, (_, i) => new Map(entries.slice(i * 100, (i + 1) * 100)))));
152
+ const fn = East.function([DT], IntegerType, ($, table) => {
153
+ const hits = $.let(0n);
154
+ $.for(East.Array.range(0n, 50n), ($, i) => {
155
+ $.if(table.has(i.remainder(5n).multiply(100n)), ($) => {
156
+ $.assign(hits, hits.add(1n));
157
+ });
158
+ });
159
+ return hits;
160
+ });
161
+ const outputPath = join(tempDir, 'output.beast2');
162
+ const err = await stderrOf(() => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true));
163
+ assert.equal(decodeBeast2For(IntegerType)(new Uint8Array(readFileSync(outputPath))), 50n);
164
+ const account = /input 0: (\d+) segment decodes of its (\d+) segments, (\d+) fences probed — its reads land at random beyond the segments kept, so decoding it whole would decode each once/.exec(err);
165
+ assert.ok(account !== null, `the reads' account:\n${err}`);
166
+ assert.deepEqual(account.slice(1).map(Number), [50, 5, 5], 'every read decoded its segment, and the fences were probed once');
167
+ // Decoded whole before the program runs, the input has no reads to account for.
168
+ const whole = await stderrOf(() => runProgram(writeIr(fn), [], [], [inputPath], outputPath, true, variant('whole', null)));
169
+ assert.equal(decodeBeast2For(IntegerType)(new Uint8Array(readFileSync(outputPath))), 50n);
170
+ assert.ok(!whole.includes('segment decodes'), whole);
171
+ });
172
+ it('a lazily opened wide input reads a fraction of the file and stays below the whole run\'s residency', { skip: process.platform === 'win32' ? 'no RSS comparison on Windows' : false }, () => {
136
173
  // A keyed read twice through the CLI binary, each run its own process:
137
- // the lazy run pages the wide file from its descriptor, the eager
138
- // control reads and decodes it whole. The runner's verbose summary
174
+ // the lazy run pages the wide file from its descriptor, the `--decode
175
+ // whole` control reads and decodes it whole. The runner's verbose summary
139
176
  // accounts for every byte the lazy input read (geometry, fence probes,
140
177
  // the one decoded segment), and that count must be a fraction of the
141
178
  // file — the exact gate a positioned-read runtime allows, where RSS
142
179
  // alone would not be (Node's own baseline wanders by more than a
143
- // segment between identical runs). The eager control's RSS must still
144
- // sit above the lazy run's: it pays the file's bytes plus every row.
180
+ // segment between identical runs). The whole control's RSS must still
181
+ // sit above the lazy run's: it pays the file's bytes plus every row, and
182
+ // it says what the input holds in memory.
145
183
  const DT = DictType(IntegerType, StringType);
146
184
  const rows = 160_000;
147
185
  const table = new SortedMap(Array.from({ length: rows }, (_, i) => [BigInt(i), `row-${i}-` + String.fromCharCode(97 + (i % 26)).repeat(190)]), compareFor(IntegerType));
@@ -155,22 +193,24 @@ describe('lazy inputs', () => {
155
193
  // search dirs e3 passes it; in a pnpm layout east-node-std is not a
156
194
  // dependency of this package, so point the loader at the package itself.
157
195
  const stdDir = fileURLToPath(new URL('../../east-node-std', import.meta.url));
158
- const run = (threshold) => {
159
- const outputPath = join(tempDir, `wide-${threshold}.beast2`);
160
- const result = spawnSync(process.execPath, [bin, 'run', irPath, '-p', '@elaraai/east-node-std', '-i', inputPath, '-o', outputPath, '-v'], {
161
- env: { ...process.env, EAST_LAZY_INPUT_BYTES: threshold, E3_RUNNER_SEARCH_DIRS: stdDir },
196
+ const run = (decode) => {
197
+ const outputPath = join(tempDir, `wide-${decode}.beast2`);
198
+ const result = spawnSync(process.execPath, [bin, 'run', irPath, '-p', '@elaraai/east-node-std', '-i', inputPath, '-o', outputPath, '--decode', decode, '-v'], {
199
+ env: { ...process.env, E3_RUNNER_SEARCH_DIRS: stdDir },
162
200
  encoding: 'utf8',
163
201
  });
164
202
  assert.equal(result.status, 0, result.stderr);
165
203
  assert.equal(decodeBeast2For(StringType)(new Uint8Array(readFileSync(outputPath))), table.get(42n));
166
204
  return result.stderr;
167
205
  };
168
- const lazyErr = run('1');
169
- const eagerErr = run('0');
206
+ const lazyErr = run('lazy');
207
+ const eagerErr = run('whole');
170
208
  assert.ok(lazyErr.includes('input 0: opened lazily'), lazyErr);
171
209
  assert.ok(!eagerErr.includes('opened lazily'), eagerErr);
210
+ assert.match(eagerErr, /input 0: decoded whole — \+[\d.]+ MB resident/);
172
211
  const sizeMb = (m) => m ? Number(m[1]) / (m[2] === 'B' ? 1024 * 1024 : m[2] === 'KB' ? 1024 : 1) : null;
173
- const read = sizeMb(/input 0: ([\d.]+) (B|KB|MB) read of/.exec(lazyErr));
212
+ assert.match(lazyErr, /input 0: 1 of (\d+) segments decoded, \1 fences probed — /, 'one segment decoded, every fence probed once');
213
+ const read = sizeMb(/input 0: .* — ([\d.]+) (B|KB|MB) read of/.exec(lazyErr));
174
214
  assert.ok(read !== null, `the summary accounts for the lazy input's reads:\n${lazyErr}`);
175
215
  assert.ok(read < wireMb / 2, `the lazy input read ${read.toFixed(1)} MB of a ${wireMb.toFixed(1)} MB file — was it read whole?`);
176
216
  const peak = (err) => sizeMb(/Peak RSS:\s+([\d.]+) (MB)/.exec(err));
@@ -479,9 +519,10 @@ describe('the blob merge and the stdin lifeline (#770)', () => {
479
519
  writeIr('spin.beast2', spin);
480
520
  const unitPath = join(tempDir, 'unit.beast2');
481
521
  writeFileSync(unitPath, encodeBeast2For(UnitType)({
482
- work: variant('run', { program: 'spin.beast2', inputs: [], output: variant('set', 'spin-output') }),
522
+ work: variant('run', { program: 'spin.beast2', inputs: [], output: variant('set', 'spin-output'), decode: variant('lazy', null) }),
483
523
  platforms: [],
484
524
  threads: 1n,
525
+ fetch: false,
485
526
  result: 'result.beast2',
486
527
  }));
487
528
  const bin = fileURLToPath(new URL('../bin/east-node.mjs', import.meta.url));
@@ -664,10 +705,9 @@ describe('frozen inputs', () => {
664
705
  });
665
706
  it('the frozen shape gate admits nested containers lazily, blob or manifest: reads serve, writes refuse', async () => {
666
707
  // Frozen is what makes lazy service safe for nested element shapes, so
667
- // with a 1-byte threshold this opens pager-backed AND immutable. A gate
668
- // that refused the shape would fall back to the eager frozen decode, which
669
- // answers both the same, so the runner's own account, under -v, is what
670
- // says the input was paged.
708
+ // this opens pager-backed AND immutable. A gate that refused the shape
709
+ // would fall back to the whole frozen decode, which answers both the same,
710
+ // so the runner's own account, under -v, is what says the input was paged.
671
711
  const read = East.function([NestedT], IntegerType, ($, d) => d.get(1n).xs.size());
672
712
  const write = East.function([NestedT], IntegerType, ($, d) => {
673
713
  const row = $.let(d.get(1n));
@@ -676,37 +716,44 @@ describe('frozen inputs', () => {
676
716
  });
677
717
  for (const input of [writeNestedInput(), writeNestedManifest()]) {
678
718
  const outputPath = join(tempDir, 'out.beast2');
679
- const readErr = await stderrOf(() => withLazyThreshold(1, () => runProgram(writeIr(read), [], [], [input], outputPath, true)));
719
+ const readErr = await stderrOf(() => runProgram(writeIr(read), [], [], [input], outputPath, true));
680
720
  assert.ok(readErr.includes('input 0: opened lazily'), `${input} was paged:\n${readErr}`);
681
721
  assert.equal(decodeBeast2For(IntegerType)(new Uint8Array(readFileSync(outputPath))), 2n);
682
- const writeErr = await stderrOf(() => withLazyThreshold(1, () => assert.rejects(runProgram(writeIr(write), [], [], [input], join(tempDir, 'out2.beast2'), true), /cannot mutate a frozen value \(task inputs are immutable\) — copy first/)));
722
+ const writeErr = await stderrOf(() => assert.rejects(runProgram(writeIr(write), [], [], [input], join(tempDir, 'out2.beast2'), true), /cannot mutate a frozen value \(task inputs are immutable\) — copy first/));
683
723
  assert.ok(writeErr.includes('input 0: opened lazily'), `${input} was paged:\n${writeErr}`);
684
724
  }
685
725
  });
686
726
  });
687
- describe('lazy input threshold resolution', () => {
688
- const saved = process.env.EAST_LAZY_INPUT_BYTES;
727
+ describe('--decode', () => {
728
+ let tempDir;
729
+ beforeEach(() => {
730
+ tempDir = mkdtempSync(join(tmpdir(), 'east-node-decode-'));
731
+ });
689
732
  afterEach(() => {
690
- if (saved === undefined)
691
- delete process.env.EAST_LAZY_INPUT_BYTES;
692
- else
693
- process.env.EAST_LAZY_INPUT_BYTES = saved;
694
- });
695
- it('defaults to 64 MiB when the environment variable is unset or empty', () => {
696
- delete process.env.EAST_LAZY_INPUT_BYTES;
697
- assert.equal(lazyThreshold(), 64 * 1024 * 1024);
698
- process.env.EAST_LAZY_INPUT_BYTES = '';
699
- assert.equal(lazyThreshold(), 64 * 1024 * 1024, 'empty must fall through to the default, not disable lazy opening');
700
- });
701
- it('honours numeric overrides, 0 as the kill switch, and falls back on invalid values', () => {
702
- process.env.EAST_LAZY_INPUT_BYTES = '0';
703
- assert.equal(lazyThreshold(), 0, '0 disables lazy opening');
704
- process.env.EAST_LAZY_INPUT_BYTES = '123';
705
- assert.equal(lazyThreshold(), 123);
706
- process.env.EAST_LAZY_INPUT_BYTES = '-5';
707
- assert.equal(lazyThreshold(), 64 * 1024 * 1024, 'negative values fall back to the default');
708
- process.env.EAST_LAZY_INPUT_BYTES = 'not-a-number';
709
- assert.equal(lazyThreshold(), 64 * 1024 * 1024, 'garbage falls back to the default');
733
+ rmSync(tempDir, { recursive: true, force: true });
734
+ });
735
+ it('opens collection inputs lazily unless it says whole, the same choice east-c and east-py take, and refuses anything else', () => {
736
+ const DT = DictType(IntegerType, StringType);
737
+ const inputPath = join(tempDir, 'table.beast2');
738
+ writeFileSync(inputPath, encodeBeast2PagedFor(DT)(new SortedMap([[1n, 'a'], [2n, 'b']], compareFor(IntegerType))));
739
+ const irPath = join(tempDir, 'program.beast2');
740
+ writeFileSync(irPath, encodeEastIR(East.function([DT], StringType, ($, table) => table.get(2n)).toIR()));
741
+ const bin = fileURLToPath(new URL('../bin/east-node.mjs', import.meta.url));
742
+ const stdDir = fileURLToPath(new URL('../../east-node-std', import.meta.url));
743
+ const run = (...flags) => spawnSync(process.execPath, [bin, 'run', irPath, '-p', '@elaraai/east-node-std', '-i', inputPath, '-v', ...flags], { env: { ...process.env, E3_RUNNER_SEARCH_DIRS: stdDir }, encoding: 'utf8' });
744
+ for (const flags of [[], ['--decode', 'lazy']]) {
745
+ const lazy = run(...flags);
746
+ assert.equal(lazy.status, 0, lazy.stderr);
747
+ assert.ok(lazy.stderr.includes('input 0: opened lazily'), `${flags.join(' ') || 'no flag'}:\n${lazy.stderr}`);
748
+ assert.equal(lazy.stdout.trim(), '"b"');
749
+ }
750
+ const whole = run('--decode', 'whole');
751
+ assert.equal(whole.status, 0, whole.stderr);
752
+ assert.match(whole.stderr, /input 0: decoded whole — \+[\d.]+ (B|KB|MB) resident/);
753
+ assert.equal(whole.stdout.trim(), '"b"');
754
+ const refused = run('--decode', 'eager');
755
+ assert.equal(refused.status, 1);
756
+ assert.equal(refused.stderr.trim(), 'Error: --decode takes lazy or whole, not eager');
710
757
  });
711
758
  });
712
759
  //# sourceMappingURL=runner.spec.js.map