@idlekit/core 0.5.0 → 0.7.0
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/README.md +77 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ltv/cohort.d.ts +59 -0
- package/dist/ltv/cohort.js +170 -0
- package/dist/ltv/cohort.js.map +1 -0
- package/dist/ltv/projection.d.ts +7 -6
- package/dist/ltv/projection.js +7 -2
- package/dist/ltv/projection.js.map +1 -1
- package/dist/ltv/public.d.ts +24 -16
- package/dist/ltv/public.js +60 -20
- package/dist/ltv/public.js.map +1 -1
- package/dist/ltv/types.d.ts +17 -0
- package/dist/ltv/uncertainty.d.ts +9 -10
- package/dist/ltv/uncertainty.js +35 -5
- package/dist/ltv/uncertainty.js.map +1 -1
- package/dist/report/compare.js +51 -20
- package/dist/report/compare.js.map +1 -1
- package/dist/scenario/scenarioContract.d.ts +2 -2
- package/dist/scenario/scenarioContract.js +2 -2
- package/dist/sim/analysis/experiment.d.ts +11 -1
- package/dist/sim/analysis/experiment.js +325 -236
- package/dist/sim/analysis/experiment.js.map +1 -1
- package/dist/sim/analysis/flow.d.ts +7 -7
- package/dist/sim/analysis/flow.js +51 -11
- package/dist/sim/analysis/flow.js.map +1 -1
- package/dist/sim/analysis/judge.d.ts +12 -1
- package/dist/sim/analysis/judge.js +64 -19
- package/dist/sim/analysis/judge.js.map +1 -1
- package/dist/sim/executionBackend.d.ts +2 -2
- package/dist/sim/executionBackend.js +8 -2
- package/dist/sim/executionBackend.js.map +1 -1
- package/dist/sim/integrationMatrix.d.ts +17 -6
- package/dist/sim/integrationMatrix.js +30 -10
- package/dist/sim/integrationMatrix.js.map +1 -1
- package/dist/sim/milestoneKeys.d.ts +11 -0
- package/dist/sim/milestoneKeys.js +16 -0
- package/dist/sim/milestoneKeys.js.map +1 -0
- package/dist/sim/observation.d.ts +3 -1
- package/dist/sim/observation.js +9 -4
- package/dist/sim/observation.js.map +1 -1
- package/dist/sim/offline.d.ts +1 -1
- package/dist/sim/offline.js +1 -1
- package/dist/sim/session.d.ts +6 -2
- package/dist/sim/session.js +18 -6
- package/dist/sim/session.js.map +1 -1
- package/dist/sim/sessionOffline.d.ts +40 -0
- package/dist/sim/sessionOffline.js +53 -0
- package/dist/sim/sessionOffline.js.map +1 -0
- package/dist/sim/strategy/opt/finiteAmountLog10.d.ts +10 -0
- package/dist/sim/strategy/opt/finiteAmountLog10.js +19 -0
- package/dist/sim/strategy/opt/finiteAmountLog10.js.map +1 -0
- package/dist/sim/strategy/opt/finiteMean.d.ts +2 -0
- package/dist/sim/strategy/opt/finiteMean.js +37 -0
- package/dist/sim/strategy/opt/finiteMean.js.map +1 -0
- package/dist/sim/strategy/opt/objectives/builtins.js +4 -4
- package/dist/sim/strategy/opt/objectives/builtins.js.map +1 -1
- package/dist/sim/strategy/opt/runner.js +12 -4
- package/dist/sim/strategy/opt/runner.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ import { canonicalJson, sha256Text } from "../../scenario/scenarioContract";
|
|
|
6
6
|
import { createRunFactory } from "../runFactory";
|
|
7
7
|
import { runScenario } from "../simulator";
|
|
8
8
|
import { runElapsedSec } from "../types";
|
|
9
|
+
import { mayRecordAtActionStart } from "../milestoneKeys";
|
|
9
10
|
import { assignmentFitsParamSpace, elasticityFromChange, localElasticity, relativeParameterChange, paretoFrontBy, } from "./sensitivity";
|
|
10
11
|
/**
|
|
11
12
|
* Experiment spec v1.
|
|
@@ -93,30 +94,31 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
93
94
|
const _ip8 = input => "string" === typeof input["originalSpecHash"];
|
|
94
95
|
const _ip9 = input => "string" === typeof input["effectiveSpecHash"];
|
|
95
96
|
const _ip10 = input => "string" === typeof input["effectiveRunHash"];
|
|
96
|
-
const _ip11 = input =>
|
|
97
|
-
const _ip12 = input =>
|
|
98
|
-
const _ip13 = input => Array.isArray(input["
|
|
99
|
-
const _ip14 = input => Array.isArray(input["
|
|
100
|
-
const _ip15 = input => "
|
|
101
|
-
const _ip16 = input =>
|
|
102
|
-
const _ip17 = input => "
|
|
103
|
-
const _ip18 = input => "string" === typeof input["
|
|
104
|
-
const _ip19 = input => "
|
|
105
|
-
const _ip20 = input => "
|
|
106
|
-
const _ip21 = input => "string" === typeof input["
|
|
107
|
-
const _ip22 = input => "string" === typeof input["
|
|
108
|
-
const _ip23 = input => "
|
|
109
|
-
const _ip24 = input =>
|
|
110
|
-
const _ip25 = input => "string" === typeof input["
|
|
111
|
-
const _ip26 = input => "string" === typeof input["
|
|
112
|
-
const _ip27 = input => "string" === typeof input["
|
|
113
|
-
const _ip28 = input => "
|
|
114
|
-
const _ip29 = input => "number" === typeof input["
|
|
115
|
-
const _ip30 = input => "number" === typeof input["
|
|
116
|
-
const _ip31 = input => "
|
|
117
|
-
const _ip32 = input => "
|
|
118
|
-
const _ip33 = input =>
|
|
119
|
-
const
|
|
97
|
+
const _ip11 = input => undefined === input["milestoneKey"] || "string" === typeof input["milestoneKey"];
|
|
98
|
+
const _ip12 = input => "object" === typeof input["budget"] && null !== input["budget"] && _io2(input["budget"]);
|
|
99
|
+
const _ip13 = input => Array.isArray(input["tasks"]) && input["tasks"].every(elem => "object" === typeof elem && null !== elem && _io3(elem));
|
|
100
|
+
const _ip14 = input => Array.isArray(input["candidates"]) && input["candidates"].every(elem => "object" === typeof elem && null !== elem && _io4(elem));
|
|
101
|
+
const _ip15 = input => Array.isArray(input["elasticities"]) && input["elasticities"].every(elem => "object" === typeof elem && null !== elem && _io6(elem));
|
|
102
|
+
const _ip16 = input => "object" === typeof input["pareto"] && null !== input["pareto"] && _io7(input["pareto"]);
|
|
103
|
+
const _ip17 = input => Array.isArray(input["warnings"]) && input["warnings"].every(elem => "string" === typeof elem);
|
|
104
|
+
const _ip18 = input => "string" === typeof input["taskId"];
|
|
105
|
+
const _ip19 = input => "string" === typeof input["candidateId"];
|
|
106
|
+
const _ip20 = input => "number" === typeof input["logicalSeed"];
|
|
107
|
+
const _ip21 = input => "string" === typeof input["engineId"];
|
|
108
|
+
const _ip22 = input => "string" === typeof input["engineVersion"];
|
|
109
|
+
const _ip23 = input => "string" === typeof input["modelId"];
|
|
110
|
+
const _ip24 = input => "number" === typeof input["modelVersion"];
|
|
111
|
+
const _ip25 = input => null === input["strategyId"] || "string" === typeof input["strategyId"];
|
|
112
|
+
const _ip26 = input => "string" === typeof input["modelParams"];
|
|
113
|
+
const _ip27 = input => "string" === typeof input["strategyParams"];
|
|
114
|
+
const _ip28 = input => "string" === typeof input["sessionPattern"];
|
|
115
|
+
const _ip29 = input => "number" === typeof input["sessionDays"];
|
|
116
|
+
const _ip30 = input => "number" === typeof input["horizonSec"];
|
|
117
|
+
const _ip31 = input => "number" === typeof input["stepSec"];
|
|
118
|
+
const _ip32 = input => "endMoney" === input["metricId"] || "timeToMilestone" === input["metricId"] || "timeToMoney" === input["metricId"] || "varBenefit" === input["metricId"];
|
|
119
|
+
const _ip33 = input => "censored" === input["status"] || "failed" === input["status"] || "observed" === input["status"] || "rejected" === input["status"];
|
|
120
|
+
const _ip34 = input => null === input["value"] || "string" === typeof input["value"];
|
|
121
|
+
const _ve0 = "Readonly<{ schemaVersion: 1; contract: \"idlekit.experiment.v1\"; estimatorVersion: \"one-at-a-time-local-v1\"; algorithmVersion: \"experiment-oat-v1\"; method: \"fixed-sweep-and-one-at-a-time\"; ... 12 more ...; warnings: readonly string[]; }>";
|
|
120
122
|
const _vp0 = (input, _path, _exceptionable = true) => 1 === input["schemaVersion"] || _report(_exceptionable, {
|
|
121
123
|
path: _path + ".schemaVersion",
|
|
122
124
|
expected: "1",
|
|
@@ -176,7 +178,12 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
176
178
|
expected: "string",
|
|
177
179
|
value: input["effectiveRunHash"]
|
|
178
180
|
});
|
|
179
|
-
const _vp11 = (input, _path, _exceptionable = true) =>
|
|
181
|
+
const _vp11 = (input, _path, _exceptionable = true) => undefined === input["milestoneKey"] || "string" === typeof input["milestoneKey"] || _report(_exceptionable, {
|
|
182
|
+
path: _path + ".milestoneKey",
|
|
183
|
+
expected: "(string | undefined)",
|
|
184
|
+
value: input["milestoneKey"]
|
|
185
|
+
});
|
|
186
|
+
const _vp12 = (input, _path, _exceptionable = true) => ("object" === typeof input["budget"] && null !== input["budget"] || _report(_exceptionable, {
|
|
180
187
|
path: _path + ".budget",
|
|
181
188
|
expected: "Readonly<{ candidates: number; seeds: number; usedCandidates: number; usedSeeds: number; }>",
|
|
182
189
|
value: input["budget"]
|
|
@@ -185,7 +192,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
185
192
|
expected: "Readonly<{ candidates: number; seeds: number; usedCandidates: number; usedSeeds: number; }>",
|
|
186
193
|
value: input["budget"]
|
|
187
194
|
});
|
|
188
|
-
const
|
|
195
|
+
const _vp13 = (input, _path, _exceptionable = true) => (Array.isArray(input["tasks"]) || _report(_exceptionable, {
|
|
189
196
|
path: _path + ".tasks",
|
|
190
197
|
expected: _ve2,
|
|
191
198
|
value: input["tasks"]
|
|
@@ -204,7 +211,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
204
211
|
});
|
|
205
212
|
const _ve1 = "Readonly<{ taskId: string; candidateId: string; logicalSeed: number; engineId: string; engineVersion: string; modelId: string; modelVersion: number; strategyId: string | null; modelParams: string; ... 7 more ...; value: string | null; }>";
|
|
206
213
|
const _ve2 = "ReadonlyArray<Readonly<{ taskId: string; candidateId: string; logicalSeed: number; engineId: string; engineVersion: string; modelId: string; modelVersion: number; strategyId: string | null; modelParams: string; ... 7 more ...; value: string | null; }>>";
|
|
207
|
-
const
|
|
214
|
+
const _vp14 = (input, _path, _exceptionable = true) => (Array.isArray(input["candidates"]) || _report(_exceptionable, {
|
|
208
215
|
path: _path + ".candidates",
|
|
209
216
|
expected: _ve4,
|
|
210
217
|
value: input["candidates"]
|
|
@@ -223,7 +230,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
223
230
|
});
|
|
224
231
|
const _ve3 = "Readonly<{ id: string; metrics: readonly Readonly<{ metricId: ExperimentMetricId; status: ExperimentMetricStatus; value: string | null; }>[]; constraintViolations: readonly string[]; }>";
|
|
225
232
|
const _ve4 = "ReadonlyArray<Readonly<{ id: string; metrics: readonly Readonly<{ metricId: ExperimentMetricId; status: ExperimentMetricStatus; value: string | null; }>[]; constraintViolations: readonly string[]; }>>";
|
|
226
|
-
const
|
|
233
|
+
const _vp15 = (input, _path, _exceptionable = true) => (Array.isArray(input["elasticities"]) || _report(_exceptionable, {
|
|
227
234
|
path: _path + ".elasticities",
|
|
228
235
|
expected: _ve6,
|
|
229
236
|
value: input["elasticities"]
|
|
@@ -242,7 +249,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
242
249
|
});
|
|
243
250
|
const _ve5 = "Readonly<{ dimensionId: string; candidateId: string; metricId: ExperimentMetricId; method: \"one-at-a-time-local\"; methodVersion: 1; globalSensitivity: false; sobol: false; status: \"observed\" | \"unavailable\"; elasticity: string | null; absoluteChange: string | null; direction: \"flat\" | ... 2 more ... | \"unavailable\";...";
|
|
244
251
|
const _ve6 = "ReadonlyArray<Readonly<{ dimensionId: string; candidateId: string; metricId: ExperimentMetricId; method: \"one-at-a-time-local\"; methodVersion: 1; globalSensitivity: false; sobol: false; status: \"observed\" | \"unavailable\"; elasticity: string | null; absoluteChange: string | null; direction: \"flat\" | ... 2 more ... | \"unavailable\";...>";
|
|
245
|
-
const
|
|
252
|
+
const _vp16 = (input, _path, _exceptionable = true) => ("object" === typeof input["pareto"] && null !== input["pareto"] || _report(_exceptionable, {
|
|
246
253
|
path: _path + ".pareto",
|
|
247
254
|
expected: "Readonly<{ sense: \"per-metric\"; nonDominated: readonly string[]; uncompared: readonly string[]; }>",
|
|
248
255
|
value: input["pareto"]
|
|
@@ -251,7 +258,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
251
258
|
expected: "Readonly<{ sense: \"per-metric\"; nonDominated: readonly string[]; uncompared: readonly string[]; }>",
|
|
252
259
|
value: input["pareto"]
|
|
253
260
|
});
|
|
254
|
-
const
|
|
261
|
+
const _vp17 = (input, _path, _exceptionable = true) => (Array.isArray(input["warnings"]) || _report(_exceptionable, {
|
|
255
262
|
path: _path + ".warnings",
|
|
256
263
|
expected: "ReadonlyArray<string>",
|
|
257
264
|
value: input["warnings"]
|
|
@@ -264,100 +271,100 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
264
271
|
expected: "ReadonlyArray<string>",
|
|
265
272
|
value: input["warnings"]
|
|
266
273
|
});
|
|
267
|
-
const
|
|
274
|
+
const _vp18 = (input, _path, _exceptionable = true) => "string" === typeof input["taskId"] || _report(_exceptionable, {
|
|
268
275
|
path: _path + ".taskId",
|
|
269
276
|
expected: "string",
|
|
270
277
|
value: input["taskId"]
|
|
271
278
|
});
|
|
272
|
-
const
|
|
279
|
+
const _vp19 = (input, _path, _exceptionable = true) => "string" === typeof input["candidateId"] || _report(_exceptionable, {
|
|
273
280
|
path: _path + ".candidateId",
|
|
274
281
|
expected: "string",
|
|
275
282
|
value: input["candidateId"]
|
|
276
283
|
});
|
|
277
|
-
const
|
|
284
|
+
const _vp20 = (input, _path, _exceptionable = true) => "number" === typeof input["logicalSeed"] || _report(_exceptionable, {
|
|
278
285
|
path: _path + ".logicalSeed",
|
|
279
286
|
expected: "number",
|
|
280
287
|
value: input["logicalSeed"]
|
|
281
288
|
});
|
|
282
|
-
const
|
|
289
|
+
const _vp21 = (input, _path, _exceptionable = true) => "string" === typeof input["engineId"] || _report(_exceptionable, {
|
|
283
290
|
path: _path + ".engineId",
|
|
284
291
|
expected: "string",
|
|
285
292
|
value: input["engineId"]
|
|
286
293
|
});
|
|
287
|
-
const
|
|
294
|
+
const _vp22 = (input, _path, _exceptionable = true) => "string" === typeof input["engineVersion"] || _report(_exceptionable, {
|
|
288
295
|
path: _path + ".engineVersion",
|
|
289
296
|
expected: "string",
|
|
290
297
|
value: input["engineVersion"]
|
|
291
298
|
});
|
|
292
|
-
const
|
|
299
|
+
const _vp23 = (input, _path, _exceptionable = true) => "string" === typeof input["modelId"] || _report(_exceptionable, {
|
|
293
300
|
path: _path + ".modelId",
|
|
294
301
|
expected: "string",
|
|
295
302
|
value: input["modelId"]
|
|
296
303
|
});
|
|
297
|
-
const
|
|
304
|
+
const _vp24 = (input, _path, _exceptionable = true) => "number" === typeof input["modelVersion"] || _report(_exceptionable, {
|
|
298
305
|
path: _path + ".modelVersion",
|
|
299
306
|
expected: "number",
|
|
300
307
|
value: input["modelVersion"]
|
|
301
308
|
});
|
|
302
|
-
const
|
|
309
|
+
const _vp25 = (input, _path, _exceptionable = true) => null === input["strategyId"] || "string" === typeof input["strategyId"] || _report(_exceptionable, {
|
|
303
310
|
path: _path + ".strategyId",
|
|
304
311
|
expected: "(null | string)",
|
|
305
312
|
value: input["strategyId"]
|
|
306
313
|
});
|
|
307
|
-
const
|
|
314
|
+
const _vp26 = (input, _path, _exceptionable = true) => "string" === typeof input["modelParams"] || _report(_exceptionable, {
|
|
308
315
|
path: _path + ".modelParams",
|
|
309
316
|
expected: "string",
|
|
310
317
|
value: input["modelParams"]
|
|
311
318
|
});
|
|
312
|
-
const
|
|
319
|
+
const _vp27 = (input, _path, _exceptionable = true) => "string" === typeof input["strategyParams"] || _report(_exceptionable, {
|
|
313
320
|
path: _path + ".strategyParams",
|
|
314
321
|
expected: "string",
|
|
315
322
|
value: input["strategyParams"]
|
|
316
323
|
});
|
|
317
|
-
const
|
|
324
|
+
const _vp28 = (input, _path, _exceptionable = true) => "string" === typeof input["sessionPattern"] || _report(_exceptionable, {
|
|
318
325
|
path: _path + ".sessionPattern",
|
|
319
326
|
expected: "string",
|
|
320
327
|
value: input["sessionPattern"]
|
|
321
328
|
});
|
|
322
|
-
const
|
|
329
|
+
const _vp29 = (input, _path, _exceptionable = true) => "number" === typeof input["sessionDays"] || _report(_exceptionable, {
|
|
323
330
|
path: _path + ".sessionDays",
|
|
324
331
|
expected: "number",
|
|
325
332
|
value: input["sessionDays"]
|
|
326
333
|
});
|
|
327
|
-
const
|
|
334
|
+
const _vp30 = (input, _path, _exceptionable = true) => "number" === typeof input["horizonSec"] || _report(_exceptionable, {
|
|
328
335
|
path: _path + ".horizonSec",
|
|
329
336
|
expected: "number",
|
|
330
337
|
value: input["horizonSec"]
|
|
331
338
|
});
|
|
332
|
-
const
|
|
339
|
+
const _vp31 = (input, _path, _exceptionable = true) => "number" === typeof input["stepSec"] || _report(_exceptionable, {
|
|
333
340
|
path: _path + ".stepSec",
|
|
334
341
|
expected: "number",
|
|
335
342
|
value: input["stepSec"]
|
|
336
343
|
});
|
|
337
|
-
const
|
|
344
|
+
const _vp32 = (input, _path, _exceptionable = true) => "endMoney" === input["metricId"] || "timeToMilestone" === input["metricId"] || "timeToMoney" === input["metricId"] || "varBenefit" === input["metricId"] || _report(_exceptionable, {
|
|
338
345
|
path: _path + ".metricId",
|
|
339
|
-
expected: "(\"endMoney\" | \"timeToMoney\" | \"varBenefit\")",
|
|
346
|
+
expected: "(\"endMoney\" | \"timeToMilestone\" | \"timeToMoney\" | \"varBenefit\")",
|
|
340
347
|
value: input["metricId"]
|
|
341
348
|
});
|
|
342
|
-
const
|
|
349
|
+
const _vp33 = (input, _path, _exceptionable = true) => "censored" === input["status"] || "failed" === input["status"] || "observed" === input["status"] || "rejected" === input["status"] || _report(_exceptionable, {
|
|
343
350
|
path: _path + ".status",
|
|
344
351
|
expected: "(\"censored\" | \"failed\" | \"observed\" | \"rejected\")",
|
|
345
352
|
value: input["status"]
|
|
346
353
|
});
|
|
347
|
-
const
|
|
354
|
+
const _vp34 = (input, _path, _exceptionable = true) => null === input["value"] || "string" === typeof input["value"] || _report(_exceptionable, {
|
|
348
355
|
path: _path + ".value",
|
|
349
356
|
expected: "(null | string)",
|
|
350
357
|
value: input["value"]
|
|
351
358
|
});
|
|
352
|
-
const _io0 = input => _ip0(input) && _ip1(input) && _ip2(input) && _ip3(input) && _ip4(input) && _ip5(input) && _ip6(input) && _ip7(input) && _ip8(input) && _ip9(input) && _ip10(input) && _ip11(input) && _ip12(input) && _ip13(input) && _ip14(input) && _ip15(input) && _ip16(input);
|
|
359
|
+
const _io0 = input => _ip0(input) && _ip1(input) && _ip2(input) && _ip3(input) && _ip4(input) && _ip5(input) && _ip6(input) && _ip7(input) && _ip8(input) && _ip9(input) && _ip10(input) && _ip11(input) && _ip12(input) && _ip13(input) && _ip14(input) && _ip15(input) && _ip16(input) && _ip17(input);
|
|
353
360
|
const _io1 = input => "string" === typeof input.ref && "string" === typeof input.hash;
|
|
354
361
|
const _io2 = input => "number" === typeof input.candidates && "number" === typeof input.seeds && "number" === typeof input.usedCandidates && "number" === typeof input.usedSeeds;
|
|
355
|
-
const _io3 = input =>
|
|
362
|
+
const _io3 = input => _ip18(input) && _ip19(input) && _ip20(input) && _ip21(input) && _ip22(input) && _ip23(input) && _ip24(input) && _ip25(input) && _ip26(input) && _ip27(input) && _ip28(input) && _ip29(input) && _ip30(input) && _ip31(input) && _ip32(input) && _ip33(input) && _ip34(input);
|
|
356
363
|
const _io4 = input => "string" === typeof input.id && (Array.isArray(input.metrics) && input.metrics.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.constraintViolations) && input.constraintViolations.every(elem => "string" === typeof elem));
|
|
357
|
-
const _io5 = input =>
|
|
358
|
-
const _io6 = input => "string" === typeof input.dimensionId &&
|
|
364
|
+
const _io5 = input => _ip32(input) && _ip33(input) && _ip34(input);
|
|
365
|
+
const _io6 = input => "string" === typeof input.dimensionId && _ip19(input) && _ip32(input) && "one-at-a-time-local" === input.method && 1 === input.methodVersion && _ip5(input) && _ip6(input) && ("observed" === input.status || "unavailable" === input.status) && (null === input.elasticity || "string" === typeof input.elasticity) && (null === input.absoluteChange || "string" === typeof input.absoluteChange) && ("flat" === input.direction || "higher" === input.direction || "lower" === input.direction || "unavailable" === input.direction);
|
|
359
366
|
const _io7 = input => "per-metric" === input.sense && (Array.isArray(input.nonDominated) && input.nonDominated.every(elem => "string" === typeof elem)) && (Array.isArray(input.uncompared) && input.uncompared.every(elem => "string" === typeof elem));
|
|
360
|
-
const _vo0 = (input, _path, _exceptionable = true) => [_vp0(input, _path, true && _exceptionable), _vp1(input, _path, true && _exceptionable), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), _vp4(input, _path, true && _exceptionable), _vp5(input, _path, true && _exceptionable), _vp6(input, _path, true && _exceptionable), _vp7(input, _path, true && _exceptionable), _vp8(input, _path, true && _exceptionable), _vp9(input, _path, true && _exceptionable), _vp10(input, _path, true && _exceptionable), _vp11(input, _path, true && _exceptionable), _vp12(input, _path, true && _exceptionable), _vp13(input, _path, true && _exceptionable), _vp14(input, _path, true && _exceptionable), _vp15(input, _path, true && _exceptionable), _vp16(input, _path, true && _exceptionable)].every(flag => flag);
|
|
367
|
+
const _vo0 = (input, _path, _exceptionable = true) => [_vp0(input, _path, true && _exceptionable), _vp1(input, _path, true && _exceptionable), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), _vp4(input, _path, true && _exceptionable), _vp5(input, _path, true && _exceptionable), _vp6(input, _path, true && _exceptionable), _vp7(input, _path, true && _exceptionable), _vp8(input, _path, true && _exceptionable), _vp9(input, _path, true && _exceptionable), _vp10(input, _path, true && _exceptionable), _vp11(input, _path, true && _exceptionable), _vp12(input, _path, true && _exceptionable), _vp13(input, _path, true && _exceptionable), _vp14(input, _path, true && _exceptionable), _vp15(input, _path, true && _exceptionable), _vp16(input, _path, true && _exceptionable), _vp17(input, _path, true && _exceptionable)].every(flag => flag);
|
|
361
368
|
const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.ref || _report(_exceptionable, {
|
|
362
369
|
path: _path + ".ref",
|
|
363
370
|
expected: "string",
|
|
@@ -384,7 +391,7 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
384
391
|
expected: "number",
|
|
385
392
|
value: input.usedSeeds
|
|
386
393
|
})].every(flag => flag);
|
|
387
|
-
const _vo3 = (input, _path, _exceptionable = true) => [
|
|
394
|
+
const _vo3 = (input, _path, _exceptionable = true) => [_vp18(input, _path, true && _exceptionable), _vp19(input, _path, true && _exceptionable), _vp20(input, _path, true && _exceptionable), _vp21(input, _path, true && _exceptionable), _vp22(input, _path, true && _exceptionable), _vp23(input, _path, true && _exceptionable), _vp24(input, _path, true && _exceptionable), _vp25(input, _path, true && _exceptionable), _vp26(input, _path, true && _exceptionable), _vp27(input, _path, true && _exceptionable), _vp28(input, _path, true && _exceptionable), _vp29(input, _path, true && _exceptionable), _vp30(input, _path, true && _exceptionable), _vp31(input, _path, true && _exceptionable), _vp32(input, _path, true && _exceptionable), _vp33(input, _path, true && _exceptionable), _vp34(input, _path, true && _exceptionable)].every(flag => flag);
|
|
388
395
|
const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.id || _report(_exceptionable, {
|
|
389
396
|
path: _path + ".id",
|
|
390
397
|
expected: "string",
|
|
@@ -418,12 +425,12 @@ export const validateExperimentArtifact = (input) => (validateExperimentArtifact
|
|
|
418
425
|
expected: "ReadonlyArray<string>",
|
|
419
426
|
value: input.constraintViolations
|
|
420
427
|
})].every(flag => flag);
|
|
421
|
-
const _vo5 = (input, _path, _exceptionable = true) => [
|
|
428
|
+
const _vo5 = (input, _path, _exceptionable = true) => [_vp32(input, _path, true && _exceptionable), _vp33(input, _path, true && _exceptionable), _vp34(input, _path, true && _exceptionable)].every(flag => flag);
|
|
422
429
|
const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.dimensionId || _report(_exceptionable, {
|
|
423
430
|
path: _path + ".dimensionId",
|
|
424
431
|
expected: "string",
|
|
425
432
|
value: input.dimensionId
|
|
426
|
-
}),
|
|
433
|
+
}), _vp19(input, _path, true && _exceptionable), _vp32(input, _path, true && _exceptionable), "one-at-a-time-local" === input.method || _report(_exceptionable, {
|
|
427
434
|
path: _path + ".method",
|
|
428
435
|
expected: "\"one-at-a-time-local\"",
|
|
429
436
|
value: input.method
|
|
@@ -513,7 +520,7 @@ function buildExperimentJsonSchema() {
|
|
|
513
520
|
return {
|
|
514
521
|
components: {
|
|
515
522
|
schemas: {
|
|
516
|
-
"ReadonlyschemaVersion1contractidlekit_x2E_experiment_x2E_v1estimatorVersionone-at-a-time-local-v1algorithmVersionexperiment-oat-v1methodfixed-sweep-and-one-at-a-time---
|
|
523
|
+
"ReadonlyschemaVersion1contractidlekit_x2E_experiment_x2E_v1estimatorVersionone-at-a-time-local-v1algorithmVersionexperiment-oat-v1methodfixed-sweep-and-one-at-a-time---12more---warningsreadonlystring-x4E471F6D49F1145C": {
|
|
517
524
|
type: "object",
|
|
518
525
|
properties: {
|
|
519
526
|
schemaVersion: {
|
|
@@ -549,6 +556,10 @@ function buildExperimentJsonSchema() {
|
|
|
549
556
|
effectiveRunHash: {
|
|
550
557
|
type: "string"
|
|
551
558
|
},
|
|
559
|
+
milestoneKey: {
|
|
560
|
+
type: "string",
|
|
561
|
+
description: "The exact key used by timeToMilestone, when requested by any metric."
|
|
562
|
+
},
|
|
552
563
|
budget: {
|
|
553
564
|
$ref: "#/components/schemas/ReadonlycandidatesnumberseedsnumberusedCandidatesnumberusedSeedsnumber"
|
|
554
565
|
},
|
|
@@ -736,6 +747,9 @@ function buildExperimentJsonSchema() {
|
|
|
736
747
|
{
|
|
737
748
|
"const": "endMoney"
|
|
738
749
|
},
|
|
750
|
+
{
|
|
751
|
+
"const": "timeToMilestone"
|
|
752
|
+
},
|
|
739
753
|
{
|
|
740
754
|
"const": "timeToMoney"
|
|
741
755
|
},
|
|
@@ -963,6 +977,10 @@ function buildExperimentJsonSchema() {
|
|
|
963
977
|
effectiveRunHash: {
|
|
964
978
|
type: "string"
|
|
965
979
|
},
|
|
980
|
+
milestoneKey: {
|
|
981
|
+
type: "string",
|
|
982
|
+
description: "The exact key used by timeToMilestone, when requested by any metric."
|
|
983
|
+
},
|
|
966
984
|
budget: {
|
|
967
985
|
$ref: "#/components/schemas/ReadonlycandidatesnumberseedsnumberusedCandidatesnumberusedSeedsnumber"
|
|
968
986
|
},
|
|
@@ -1029,52 +1047,222 @@ export function experimentJsonSchema() {
|
|
|
1029
1047
|
}
|
|
1030
1048
|
let validateExperimentSpecValidator;
|
|
1031
1049
|
export const validateExperimentSpec = (input) => (validateExperimentSpecValidator ??= (() => {
|
|
1032
|
-
const _ip0 = input =>
|
|
1033
|
-
const _ip1 = input => "
|
|
1034
|
-
const _ip2 = input => "
|
|
1035
|
-
const _ip3 = input => "
|
|
1036
|
-
const
|
|
1037
|
-
const
|
|
1050
|
+
const _ip0 = input => 1 === input["schemaVersion"];
|
|
1051
|
+
const _ip1 = input => "object" === typeof input["scenario"] && null !== input["scenario"] && _io1(input["scenario"]);
|
|
1052
|
+
const _ip2 = input => "object" === typeof input["model"] && null !== input["model"] && _io2(input["model"]);
|
|
1053
|
+
const _ip3 = input => undefined === input["strategy"] || "object" === typeof input["strategy"] && null !== input["strategy"] && _io3(input["strategy"]);
|
|
1054
|
+
const _ip4 = input => "endMoney" === input["metricId"] || "timeToMilestone" === input["metricId"] || "timeToMoney" === input["metricId"] || "varBenefit" === input["metricId"];
|
|
1055
|
+
const _ip5 = input => undefined === input["goal"] || "object" === typeof input["goal"] && null !== input["goal"] && _io4(input["goal"]);
|
|
1056
|
+
const _ip6 = input => undefined === input["milestoneKey"] || "string" === typeof input["milestoneKey"];
|
|
1057
|
+
const _ip7 = input => undefined === input["objectives"] || Array.isArray(input["objectives"]) && input["objectives"].every(elem => "object" === typeof elem && null !== elem && _io5(elem));
|
|
1058
|
+
const _ip8 = input => undefined === input["constraints"] || Array.isArray(input["constraints"]) && input["constraints"].every(elem => "object" === typeof elem && null !== elem && _io6(elem));
|
|
1059
|
+
const _ip9 = input => Array.isArray(input["dimensions"]) && input["dimensions"].every(elem => "object" === typeof elem && null !== elem && _io7(elem));
|
|
1060
|
+
const _ip10 = input => undefined === input["candidates"] || Array.isArray(input["candidates"]) && input["candidates"].every(elem => "object" === typeof elem && null !== elem && _io12(elem));
|
|
1061
|
+
const _ip11 = input => "object" === typeof input["budget"] && null !== input["budget"] && _io14(input["budget"]);
|
|
1062
|
+
const _ip12 = input => Array.isArray(input["seeds"]) && input["seeds"].every(elem => "number" === typeof elem);
|
|
1063
|
+
const _ip13 = input => "number" === typeof input["horizonSec"];
|
|
1064
|
+
const _ip14 = input => "number" === typeof input["stepSec"];
|
|
1065
|
+
const _ip15 = input => "object" === typeof input["session"] && null !== input["session"] && _io15(input["session"]);
|
|
1066
|
+
const _ip16 = input => "string" === typeof input["id"];
|
|
1067
|
+
const _ip17 = input => "number" === typeof input["min"];
|
|
1068
|
+
const _ip18 = input => "number" === typeof input["max"];
|
|
1069
|
+
const _ve0 = "Readonly<{ schemaVersion: 1; scenario: Readonly<{ ref: string; hash: string; }>; model: Readonly<{ id: string; version: number; }>; strategy?: Readonly<{ id: string; }> | undefined; ... 11 more ...; session: Readonly<...>; }>";
|
|
1070
|
+
const _vp0 = (input, _path, _exceptionable = true) => 1 === input["schemaVersion"] || _report(_exceptionable, {
|
|
1071
|
+
path: _path + ".schemaVersion",
|
|
1072
|
+
expected: "1",
|
|
1073
|
+
value: input["schemaVersion"]
|
|
1074
|
+
});
|
|
1075
|
+
const _vp1 = (input, _path, _exceptionable = true) => ("object" === typeof input["scenario"] && null !== input["scenario"] || _report(_exceptionable, {
|
|
1076
|
+
path: _path + ".scenario",
|
|
1077
|
+
expected: "Readonly<{ ref: string; hash: string; }>",
|
|
1078
|
+
value: input["scenario"]
|
|
1079
|
+
})) && _vo1(input["scenario"], _path + ".scenario", true && _exceptionable) || _report(_exceptionable, {
|
|
1080
|
+
path: _path + ".scenario",
|
|
1081
|
+
expected: "Readonly<{ ref: string; hash: string; }>",
|
|
1082
|
+
value: input["scenario"]
|
|
1083
|
+
});
|
|
1084
|
+
const _vp2 = (input, _path, _exceptionable = true) => ("object" === typeof input["model"] && null !== input["model"] || _report(_exceptionable, {
|
|
1085
|
+
path: _path + ".model",
|
|
1086
|
+
expected: "Readonly<{ id: string; version: number; }>",
|
|
1087
|
+
value: input["model"]
|
|
1088
|
+
})) && _vo2(input["model"], _path + ".model", true && _exceptionable) || _report(_exceptionable, {
|
|
1089
|
+
path: _path + ".model",
|
|
1090
|
+
expected: "Readonly<{ id: string; version: number; }>",
|
|
1091
|
+
value: input["model"]
|
|
1092
|
+
});
|
|
1093
|
+
const _vp3 = (input, _path, _exceptionable = true) => undefined === input["strategy"] || ("object" === typeof input["strategy"] && null !== input["strategy"] || _report(_exceptionable, {
|
|
1094
|
+
path: _path + ".strategy",
|
|
1095
|
+
expected: "(Readonly<{ id: string; }> | undefined)",
|
|
1096
|
+
value: input["strategy"]
|
|
1097
|
+
})) && _vo3(input["strategy"], _path + ".strategy", true && _exceptionable) || _report(_exceptionable, {
|
|
1098
|
+
path: _path + ".strategy",
|
|
1099
|
+
expected: "(Readonly<{ id: string; }> | undefined)",
|
|
1100
|
+
value: input["strategy"]
|
|
1101
|
+
});
|
|
1102
|
+
const _vp4 = (input, _path, _exceptionable = true) => "endMoney" === input["metricId"] || "timeToMilestone" === input["metricId"] || "timeToMoney" === input["metricId"] || "varBenefit" === input["metricId"] || _report(_exceptionable, {
|
|
1038
1103
|
path: _path + ".metricId",
|
|
1039
|
-
expected: "(\"endMoney\" | \"timeToMoney\" | \"varBenefit\")",
|
|
1104
|
+
expected: "(\"endMoney\" | \"timeToMilestone\" | \"timeToMoney\" | \"varBenefit\")",
|
|
1040
1105
|
value: input["metricId"]
|
|
1041
1106
|
});
|
|
1107
|
+
const _vp5 = (input, _path, _exceptionable = true) => undefined === input["goal"] || ("object" === typeof input["goal"] && null !== input["goal"] || _report(_exceptionable, {
|
|
1108
|
+
path: _path + ".goal",
|
|
1109
|
+
expected: "(Readonly<{ target: number; }> | undefined)",
|
|
1110
|
+
value: input["goal"]
|
|
1111
|
+
})) && _vo4(input["goal"], _path + ".goal", true && _exceptionable) || _report(_exceptionable, {
|
|
1112
|
+
path: _path + ".goal",
|
|
1113
|
+
expected: "(Readonly<{ target: number; }> | undefined)",
|
|
1114
|
+
value: input["goal"]
|
|
1115
|
+
});
|
|
1116
|
+
const _vp6 = (input, _path, _exceptionable = true) => undefined === input["milestoneKey"] || "string" === typeof input["milestoneKey"] || _report(_exceptionable, {
|
|
1117
|
+
path: _path + ".milestoneKey",
|
|
1118
|
+
expected: "(string | undefined)",
|
|
1119
|
+
value: input["milestoneKey"]
|
|
1120
|
+
});
|
|
1121
|
+
const _vp7 = (input, _path, _exceptionable = true) => undefined === input["objectives"] || (Array.isArray(input["objectives"]) || _report(_exceptionable, {
|
|
1122
|
+
path: _path + ".objectives",
|
|
1123
|
+
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>> | undefined)",
|
|
1124
|
+
value: input["objectives"]
|
|
1125
|
+
})) && input["objectives"].map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1126
|
+
path: _path + ".objectives[" + _index9 + "]",
|
|
1127
|
+
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>",
|
|
1128
|
+
value: elem
|
|
1129
|
+
})) && _vo5(elem, _path + ".objectives[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1130
|
+
path: _path + ".objectives[" + _index9 + "]",
|
|
1131
|
+
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>",
|
|
1132
|
+
value: elem
|
|
1133
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1134
|
+
path: _path + ".objectives",
|
|
1135
|
+
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>> | undefined)",
|
|
1136
|
+
value: input["objectives"]
|
|
1137
|
+
});
|
|
1138
|
+
const _vp8 = (input, _path, _exceptionable = true) => undefined === input["constraints"] || (Array.isArray(input["constraints"]) || _report(_exceptionable, {
|
|
1139
|
+
path: _path + ".constraints",
|
|
1140
|
+
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>> | undefined)",
|
|
1141
|
+
value: input["constraints"]
|
|
1142
|
+
})) && input["constraints"].map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1143
|
+
path: _path + ".constraints[" + _index10 + "]",
|
|
1144
|
+
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>",
|
|
1145
|
+
value: elem
|
|
1146
|
+
})) && _vo6(elem, _path + ".constraints[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1147
|
+
path: _path + ".constraints[" + _index10 + "]",
|
|
1148
|
+
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>",
|
|
1149
|
+
value: elem
|
|
1150
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1151
|
+
path: _path + ".constraints",
|
|
1152
|
+
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>> | undefined)",
|
|
1153
|
+
value: input["constraints"]
|
|
1154
|
+
});
|
|
1155
|
+
const _vp9 = (input, _path, _exceptionable = true) => (Array.isArray(input["dimensions"]) || _report(_exceptionable, {
|
|
1156
|
+
path: _path + ".dimensions",
|
|
1157
|
+
expected: _ve2,
|
|
1158
|
+
value: input["dimensions"]
|
|
1159
|
+
})) && input["dimensions"].map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1160
|
+
path: _path + ".dimensions[" + _index11 + "]",
|
|
1161
|
+
expected: _ve1,
|
|
1162
|
+
value: elem
|
|
1163
|
+
})) && _vo7(elem, _path + ".dimensions[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1164
|
+
path: _path + ".dimensions[" + _index11 + "]",
|
|
1165
|
+
expected: _ve1,
|
|
1166
|
+
value: elem
|
|
1167
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1168
|
+
path: _path + ".dimensions",
|
|
1169
|
+
expected: _ve2,
|
|
1170
|
+
value: input["dimensions"]
|
|
1171
|
+
});
|
|
1042
1172
|
const _ve1 = "Readonly<{ id: string; target: \"model\" | \"session\" | \"strategy\"; path: string; space: ExperimentParamSpace; baseline: ExperimentScalar; probes?: readonly ExperimentScalar[] | undefined; }>";
|
|
1043
1173
|
const _ve2 = "ReadonlyArray<Readonly<{ id: string; target: \"model\" | \"session\" | \"strategy\"; path: string; space: ExperimentParamSpace; baseline: ExperimentScalar; probes?: readonly ExperimentScalar[] | undefined; }>>";
|
|
1174
|
+
const _vp10 = (input, _path, _exceptionable = true) => undefined === input["candidates"] || (Array.isArray(input["candidates"]) || _report(_exceptionable, {
|
|
1175
|
+
path: _path + ".candidates",
|
|
1176
|
+
expected: _ve3,
|
|
1177
|
+
value: input["candidates"]
|
|
1178
|
+
})) && input["candidates"].map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1179
|
+
path: _path + ".candidates[" + _index12 + "]",
|
|
1180
|
+
expected: "Readonly<{ id: string; assignments: readonly Readonly<{ dimensionId: string; value: ExperimentScalar; }>[]; }>",
|
|
1181
|
+
value: elem
|
|
1182
|
+
})) && _vo12(elem, _path + ".candidates[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1183
|
+
path: _path + ".candidates[" + _index12 + "]",
|
|
1184
|
+
expected: "Readonly<{ id: string; assignments: readonly Readonly<{ dimensionId: string; value: ExperimentScalar; }>[]; }>",
|
|
1185
|
+
value: elem
|
|
1186
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1187
|
+
path: _path + ".candidates",
|
|
1188
|
+
expected: _ve3,
|
|
1189
|
+
value: input["candidates"]
|
|
1190
|
+
});
|
|
1044
1191
|
const _ve3 = "(ReadonlyArray<Readonly<{ id: string; assignments: readonly Readonly<{ dimensionId: string; value: ExperimentScalar; }>[]; }>> | undefined)";
|
|
1045
|
-
const
|
|
1192
|
+
const _vp11 = (input, _path, _exceptionable = true) => ("object" === typeof input["budget"] && null !== input["budget"] || _report(_exceptionable, {
|
|
1193
|
+
path: _path + ".budget",
|
|
1194
|
+
expected: "Readonly<{ candidates: number; seeds: number; }>",
|
|
1195
|
+
value: input["budget"]
|
|
1196
|
+
})) && _vo14(input["budget"], _path + ".budget", true && _exceptionable) || _report(_exceptionable, {
|
|
1197
|
+
path: _path + ".budget",
|
|
1198
|
+
expected: "Readonly<{ candidates: number; seeds: number; }>",
|
|
1199
|
+
value: input["budget"]
|
|
1200
|
+
});
|
|
1201
|
+
const _vp12 = (input, _path, _exceptionable = true) => (Array.isArray(input["seeds"]) || _report(_exceptionable, {
|
|
1202
|
+
path: _path + ".seeds",
|
|
1203
|
+
expected: "ReadonlyArray<number>",
|
|
1204
|
+
value: input["seeds"]
|
|
1205
|
+
})) && input["seeds"].map((elem, _index13) => "number" === typeof elem || _report(_exceptionable, {
|
|
1206
|
+
path: _path + ".seeds[" + _index13 + "]",
|
|
1207
|
+
expected: "number",
|
|
1208
|
+
value: elem
|
|
1209
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1210
|
+
path: _path + ".seeds",
|
|
1211
|
+
expected: "ReadonlyArray<number>",
|
|
1212
|
+
value: input["seeds"]
|
|
1213
|
+
});
|
|
1214
|
+
const _vp13 = (input, _path, _exceptionable = true) => "number" === typeof input["horizonSec"] || _report(_exceptionable, {
|
|
1215
|
+
path: _path + ".horizonSec",
|
|
1216
|
+
expected: "number",
|
|
1217
|
+
value: input["horizonSec"]
|
|
1218
|
+
});
|
|
1219
|
+
const _vp14 = (input, _path, _exceptionable = true) => "number" === typeof input["stepSec"] || _report(_exceptionable, {
|
|
1220
|
+
path: _path + ".stepSec",
|
|
1221
|
+
expected: "number",
|
|
1222
|
+
value: input["stepSec"]
|
|
1223
|
+
});
|
|
1224
|
+
const _vp15 = (input, _path, _exceptionable = true) => ("object" === typeof input["session"] && null !== input["session"] || _report(_exceptionable, {
|
|
1225
|
+
path: _path + ".session",
|
|
1226
|
+
expected: "Readonly<{ pattern: string; days: number; }>",
|
|
1227
|
+
value: input["session"]
|
|
1228
|
+
})) && _vo15(input["session"], _path + ".session", true && _exceptionable) || _report(_exceptionable, {
|
|
1229
|
+
path: _path + ".session",
|
|
1230
|
+
expected: "Readonly<{ pattern: string; days: number; }>",
|
|
1231
|
+
value: input["session"]
|
|
1232
|
+
});
|
|
1233
|
+
const _vp16 = (input, _path, _exceptionable = true) => "string" === typeof input["id"] || _report(_exceptionable, {
|
|
1046
1234
|
path: _path + ".id",
|
|
1047
1235
|
expected: "string",
|
|
1048
1236
|
value: input["id"]
|
|
1049
1237
|
});
|
|
1050
1238
|
const _ve4 = "(Readonly<{ kind: \"bool\"; }> | Readonly<{ kind: \"choice\"; values: readonly ExperimentScalar[]; }> | Readonly<{ kind: \"int\"; min: number; max: number; }> | Readonly<{ kind: \"number\"; min: number; max: number; scale?: \"linear\" | \"log\" | undefined; }>)";
|
|
1051
|
-
const
|
|
1239
|
+
const _vp17 = (input, _path, _exceptionable = true) => "number" === typeof input["min"] || _report(_exceptionable, {
|
|
1052
1240
|
path: _path + ".min",
|
|
1053
1241
|
expected: "number",
|
|
1054
1242
|
value: input["min"]
|
|
1055
1243
|
});
|
|
1056
|
-
const
|
|
1244
|
+
const _vp18 = (input, _path, _exceptionable = true) => "number" === typeof input["max"] || _report(_exceptionable, {
|
|
1057
1245
|
path: _path + ".max",
|
|
1058
1246
|
expected: "number",
|
|
1059
1247
|
value: input["max"]
|
|
1060
1248
|
});
|
|
1061
1249
|
const _ve5 = "(Readonly<{ kind: \"bool\"; }> | Readonly<{ kind: \"int\"; min: number; max: number; }> | Readonly<{ kind: \"number\"; min: number; max: number; scale?: \"linear\" | \"log\" | undefined; }> | Readonly<{ kind: \"choice\"; values: readonly ExperimentScalar[]; }>)";
|
|
1062
|
-
const _io0 = input =>
|
|
1250
|
+
const _io0 = input => _ip0(input) && _ip1(input) && _ip2(input) && _ip3(input) && _ip4(input) && _ip5(input) && _ip6(input) && _ip7(input) && _ip8(input) && _ip9(input) && _ip10(input) && _ip11(input) && _ip12(input) && _ip13(input) && _ip14(input) && _ip15(input);
|
|
1063
1251
|
const _io1 = input => "string" === typeof input.ref && "string" === typeof input.hash;
|
|
1064
|
-
const _io10 = input => "number" === input.kind &&
|
|
1252
|
+
const _io10 = input => "number" === input.kind && _ip17(input) && _ip18(input) && (undefined === input.scale || "linear" === input.scale || "log" === input.scale);
|
|
1065
1253
|
const _io11 = input => "choice" === input.kind && (Array.isArray(input.values) && input.values.every(elem => null === elem || "string" === typeof elem || "number" === typeof elem || "boolean" === typeof elem));
|
|
1066
|
-
const _io12 = input =>
|
|
1254
|
+
const _io12 = input => _ip16(input) && (Array.isArray(input.assignments) && input.assignments.every(elem => "object" === typeof elem && null !== elem && _io13(elem)));
|
|
1067
1255
|
const _io13 = input => "string" === typeof input.dimensionId && (null === input.value || "string" === typeof input.value || "number" === typeof input.value || "boolean" === typeof input.value);
|
|
1068
1256
|
const _io14 = input => "number" === typeof input.candidates && "number" === typeof input.seeds;
|
|
1069
1257
|
const _io15 = input => "string" === typeof input.pattern && "number" === typeof input.days;
|
|
1070
|
-
const _io2 = input =>
|
|
1071
|
-
const _io3 = input =>
|
|
1258
|
+
const _io2 = input => _ip16(input) && "number" === typeof input.version;
|
|
1259
|
+
const _io3 = input => _ip16(input);
|
|
1072
1260
|
const _io4 = input => "number" === typeof input.target;
|
|
1073
|
-
const _io5 = input =>
|
|
1074
|
-
const _io6 = input =>
|
|
1075
|
-
const _io7 = input =>
|
|
1261
|
+
const _io5 = input => _ip16(input) && _ip4(input) && ("higher" === input.sense || "lower" === input.sense);
|
|
1262
|
+
const _io6 = input => _ip16(input) && _ip4(input) && ("gte" === input.op || "lte" === input.op) && "number" === typeof input.limit;
|
|
1263
|
+
const _io7 = input => _ip16(input) && ("model" === input.target || "session" === input.target || "strategy" === input.target) && "string" === typeof input.path && ("object" === typeof input.space && null !== input.space && _iu0(input.space)) && (null === input.baseline || "string" === typeof input.baseline || "number" === typeof input.baseline || "boolean" === typeof input.baseline) && (undefined === input.probes || Array.isArray(input.probes) && input.probes.every(elem => null === elem || "string" === typeof elem || "number" === typeof elem || "boolean" === typeof elem));
|
|
1076
1264
|
const _io8 = input => "bool" === input.kind;
|
|
1077
|
-
const _io9 = input => "int" === input.kind &&
|
|
1265
|
+
const _io9 = input => "int" === input.kind && _ip17(input) && _ip18(input);
|
|
1078
1266
|
const _iu0 = input => (() => {
|
|
1079
1267
|
if ("bool" === input.kind)
|
|
1080
1268
|
return _io8(input);
|
|
@@ -1087,143 +1275,7 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1087
1275
|
else
|
|
1088
1276
|
return false;
|
|
1089
1277
|
})();
|
|
1090
|
-
const _vo0 = (input, _path, _exceptionable = true) => [
|
|
1091
|
-
path: _path + ".schemaVersion",
|
|
1092
|
-
expected: "1",
|
|
1093
|
-
value: input.schemaVersion
|
|
1094
|
-
}), ("object" === typeof input.scenario && null !== input.scenario || _report(_exceptionable, {
|
|
1095
|
-
path: _path + ".scenario",
|
|
1096
|
-
expected: "Readonly<{ ref: string; hash: string; }>",
|
|
1097
|
-
value: input.scenario
|
|
1098
|
-
})) && _vo1(input.scenario, _path + ".scenario", true && _exceptionable) || _report(_exceptionable, {
|
|
1099
|
-
path: _path + ".scenario",
|
|
1100
|
-
expected: "Readonly<{ ref: string; hash: string; }>",
|
|
1101
|
-
value: input.scenario
|
|
1102
|
-
}), ("object" === typeof input.model && null !== input.model || _report(_exceptionable, {
|
|
1103
|
-
path: _path + ".model",
|
|
1104
|
-
expected: "Readonly<{ id: string; version: number; }>",
|
|
1105
|
-
value: input.model
|
|
1106
|
-
})) && _vo2(input.model, _path + ".model", true && _exceptionable) || _report(_exceptionable, {
|
|
1107
|
-
path: _path + ".model",
|
|
1108
|
-
expected: "Readonly<{ id: string; version: number; }>",
|
|
1109
|
-
value: input.model
|
|
1110
|
-
}), undefined === input.strategy || ("object" === typeof input.strategy && null !== input.strategy || _report(_exceptionable, {
|
|
1111
|
-
path: _path + ".strategy",
|
|
1112
|
-
expected: "(Readonly<{ id: string; }> | undefined)",
|
|
1113
|
-
value: input.strategy
|
|
1114
|
-
})) && _vo3(input.strategy, _path + ".strategy", true && _exceptionable) || _report(_exceptionable, {
|
|
1115
|
-
path: _path + ".strategy",
|
|
1116
|
-
expected: "(Readonly<{ id: string; }> | undefined)",
|
|
1117
|
-
value: input.strategy
|
|
1118
|
-
}), _vp0(input, _path, true && _exceptionable), undefined === input.goal || ("object" === typeof input.goal && null !== input.goal || _report(_exceptionable, {
|
|
1119
|
-
path: _path + ".goal",
|
|
1120
|
-
expected: "(Readonly<{ target: number; }> | undefined)",
|
|
1121
|
-
value: input.goal
|
|
1122
|
-
})) && _vo4(input.goal, _path + ".goal", true && _exceptionable) || _report(_exceptionable, {
|
|
1123
|
-
path: _path + ".goal",
|
|
1124
|
-
expected: "(Readonly<{ target: number; }> | undefined)",
|
|
1125
|
-
value: input.goal
|
|
1126
|
-
}), undefined === input.objectives || (Array.isArray(input.objectives) || _report(_exceptionable, {
|
|
1127
|
-
path: _path + ".objectives",
|
|
1128
|
-
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>> | undefined)",
|
|
1129
|
-
value: input.objectives
|
|
1130
|
-
})) && input.objectives.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1131
|
-
path: _path + ".objectives[" + _index9 + "]",
|
|
1132
|
-
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>",
|
|
1133
|
-
value: elem
|
|
1134
|
-
})) && _vo5(elem, _path + ".objectives[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1135
|
-
path: _path + ".objectives[" + _index9 + "]",
|
|
1136
|
-
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>",
|
|
1137
|
-
value: elem
|
|
1138
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
1139
|
-
path: _path + ".objectives",
|
|
1140
|
-
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; sense: \"higher\" | \"lower\"; }>> | undefined)",
|
|
1141
|
-
value: input.objectives
|
|
1142
|
-
}), undefined === input.constraints || (Array.isArray(input.constraints) || _report(_exceptionable, {
|
|
1143
|
-
path: _path + ".constraints",
|
|
1144
|
-
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>> | undefined)",
|
|
1145
|
-
value: input.constraints
|
|
1146
|
-
})) && input.constraints.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1147
|
-
path: _path + ".constraints[" + _index10 + "]",
|
|
1148
|
-
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>",
|
|
1149
|
-
value: elem
|
|
1150
|
-
})) && _vo6(elem, _path + ".constraints[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1151
|
-
path: _path + ".constraints[" + _index10 + "]",
|
|
1152
|
-
expected: "Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>",
|
|
1153
|
-
value: elem
|
|
1154
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
1155
|
-
path: _path + ".constraints",
|
|
1156
|
-
expected: "(ReadonlyArray<Readonly<{ id: string; metricId: ExperimentMetricId; op: \"gte\" | \"lte\"; limit: number; }>> | undefined)",
|
|
1157
|
-
value: input.constraints
|
|
1158
|
-
}), (Array.isArray(input.dimensions) || _report(_exceptionable, {
|
|
1159
|
-
path: _path + ".dimensions",
|
|
1160
|
-
expected: _ve2,
|
|
1161
|
-
value: input.dimensions
|
|
1162
|
-
})) && input.dimensions.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1163
|
-
path: _path + ".dimensions[" + _index11 + "]",
|
|
1164
|
-
expected: _ve1,
|
|
1165
|
-
value: elem
|
|
1166
|
-
})) && _vo7(elem, _path + ".dimensions[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1167
|
-
path: _path + ".dimensions[" + _index11 + "]",
|
|
1168
|
-
expected: _ve1,
|
|
1169
|
-
value: elem
|
|
1170
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
1171
|
-
path: _path + ".dimensions",
|
|
1172
|
-
expected: _ve2,
|
|
1173
|
-
value: input.dimensions
|
|
1174
|
-
}), undefined === input.candidates || (Array.isArray(input.candidates) || _report(_exceptionable, {
|
|
1175
|
-
path: _path + ".candidates",
|
|
1176
|
-
expected: _ve3,
|
|
1177
|
-
value: input.candidates
|
|
1178
|
-
})) && input.candidates.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1179
|
-
path: _path + ".candidates[" + _index12 + "]",
|
|
1180
|
-
expected: "Readonly<{ id: string; assignments: readonly Readonly<{ dimensionId: string; value: ExperimentScalar; }>[]; }>",
|
|
1181
|
-
value: elem
|
|
1182
|
-
})) && _vo12(elem, _path + ".candidates[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1183
|
-
path: _path + ".candidates[" + _index12 + "]",
|
|
1184
|
-
expected: "Readonly<{ id: string; assignments: readonly Readonly<{ dimensionId: string; value: ExperimentScalar; }>[]; }>",
|
|
1185
|
-
value: elem
|
|
1186
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
1187
|
-
path: _path + ".candidates",
|
|
1188
|
-
expected: _ve3,
|
|
1189
|
-
value: input.candidates
|
|
1190
|
-
}), ("object" === typeof input.budget && null !== input.budget || _report(_exceptionable, {
|
|
1191
|
-
path: _path + ".budget",
|
|
1192
|
-
expected: "Readonly<{ candidates: number; seeds: number; }>",
|
|
1193
|
-
value: input.budget
|
|
1194
|
-
})) && _vo14(input.budget, _path + ".budget", true && _exceptionable) || _report(_exceptionable, {
|
|
1195
|
-
path: _path + ".budget",
|
|
1196
|
-
expected: "Readonly<{ candidates: number; seeds: number; }>",
|
|
1197
|
-
value: input.budget
|
|
1198
|
-
}), (Array.isArray(input.seeds) || _report(_exceptionable, {
|
|
1199
|
-
path: _path + ".seeds",
|
|
1200
|
-
expected: "ReadonlyArray<number>",
|
|
1201
|
-
value: input.seeds
|
|
1202
|
-
})) && input.seeds.map((elem, _index13) => "number" === typeof elem || _report(_exceptionable, {
|
|
1203
|
-
path: _path + ".seeds[" + _index13 + "]",
|
|
1204
|
-
expected: "number",
|
|
1205
|
-
value: elem
|
|
1206
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
1207
|
-
path: _path + ".seeds",
|
|
1208
|
-
expected: "ReadonlyArray<number>",
|
|
1209
|
-
value: input.seeds
|
|
1210
|
-
}), "number" === typeof input.horizonSec || _report(_exceptionable, {
|
|
1211
|
-
path: _path + ".horizonSec",
|
|
1212
|
-
expected: "number",
|
|
1213
|
-
value: input.horizonSec
|
|
1214
|
-
}), "number" === typeof input.stepSec || _report(_exceptionable, {
|
|
1215
|
-
path: _path + ".stepSec",
|
|
1216
|
-
expected: "number",
|
|
1217
|
-
value: input.stepSec
|
|
1218
|
-
}), ("object" === typeof input.session && null !== input.session || _report(_exceptionable, {
|
|
1219
|
-
path: _path + ".session",
|
|
1220
|
-
expected: "Readonly<{ pattern: string; days: number; }>",
|
|
1221
|
-
value: input.session
|
|
1222
|
-
})) && _vo15(input.session, _path + ".session", true && _exceptionable) || _report(_exceptionable, {
|
|
1223
|
-
path: _path + ".session",
|
|
1224
|
-
expected: "Readonly<{ pattern: string; days: number; }>",
|
|
1225
|
-
value: input.session
|
|
1226
|
-
})].every(flag => flag);
|
|
1278
|
+
const _vo0 = (input, _path, _exceptionable = true) => [_vp0(input, _path, true && _exceptionable), _vp1(input, _path, true && _exceptionable), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), _vp4(input, _path, true && _exceptionable), _vp5(input, _path, true && _exceptionable), _vp6(input, _path, true && _exceptionable), _vp7(input, _path, true && _exceptionable), _vp8(input, _path, true && _exceptionable), _vp9(input, _path, true && _exceptionable), _vp10(input, _path, true && _exceptionable), _vp11(input, _path, true && _exceptionable), _vp12(input, _path, true && _exceptionable), _vp13(input, _path, true && _exceptionable), _vp14(input, _path, true && _exceptionable), _vp15(input, _path, true && _exceptionable)].every(flag => flag);
|
|
1227
1279
|
const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.ref || _report(_exceptionable, {
|
|
1228
1280
|
path: _path + ".ref",
|
|
1229
1281
|
expected: "string",
|
|
@@ -1237,7 +1289,7 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1237
1289
|
path: _path + ".kind",
|
|
1238
1290
|
expected: "\"number\"",
|
|
1239
1291
|
value: input.kind
|
|
1240
|
-
}),
|
|
1292
|
+
}), _vp17(input, _path, true && _exceptionable), _vp18(input, _path, true && _exceptionable), undefined === input.scale || "linear" === input.scale || "log" === input.scale || _report(_exceptionable, {
|
|
1241
1293
|
path: _path + ".scale",
|
|
1242
1294
|
expected: "(\"linear\" | \"log\" | undefined)",
|
|
1243
1295
|
value: input.scale
|
|
@@ -1259,7 +1311,7 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1259
1311
|
expected: "ReadonlyArray<ExperimentScalar>",
|
|
1260
1312
|
value: input.values
|
|
1261
1313
|
})].every(flag => flag);
|
|
1262
|
-
const _vo12 = (input, _path, _exceptionable = true) => [
|
|
1314
|
+
const _vo12 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable), (Array.isArray(input.assignments) || _report(_exceptionable, {
|
|
1263
1315
|
path: _path + ".assignments",
|
|
1264
1316
|
expected: "ReadonlyArray<Readonly<{ dimensionId: string; value: ExperimentScalar; }>>",
|
|
1265
1317
|
value: input.assignments
|
|
@@ -1303,23 +1355,23 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1303
1355
|
expected: "number",
|
|
1304
1356
|
value: input.days
|
|
1305
1357
|
})].every(flag => flag);
|
|
1306
|
-
const _vo2 = (input, _path, _exceptionable = true) => [
|
|
1358
|
+
const _vo2 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable), "number" === typeof input.version || _report(_exceptionable, {
|
|
1307
1359
|
path: _path + ".version",
|
|
1308
1360
|
expected: "number",
|
|
1309
1361
|
value: input.version
|
|
1310
1362
|
})].every(flag => flag);
|
|
1311
|
-
const _vo3 = (input, _path, _exceptionable = true) => [
|
|
1363
|
+
const _vo3 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable)].every(flag => flag);
|
|
1312
1364
|
const _vo4 = (input, _path, _exceptionable = true) => ["number" === typeof input.target || _report(_exceptionable, {
|
|
1313
1365
|
path: _path + ".target",
|
|
1314
1366
|
expected: "number",
|
|
1315
1367
|
value: input.target
|
|
1316
1368
|
})].every(flag => flag);
|
|
1317
|
-
const _vo5 = (input, _path, _exceptionable = true) => [
|
|
1369
|
+
const _vo5 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable), _vp4(input, _path, true && _exceptionable), "higher" === input.sense || "lower" === input.sense || _report(_exceptionable, {
|
|
1318
1370
|
path: _path + ".sense",
|
|
1319
1371
|
expected: "(\"higher\" | \"lower\")",
|
|
1320
1372
|
value: input.sense
|
|
1321
1373
|
})].every(flag => flag);
|
|
1322
|
-
const _vo6 = (input, _path, _exceptionable = true) => [
|
|
1374
|
+
const _vo6 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable), _vp4(input, _path, true && _exceptionable), "gte" === input.op || "lte" === input.op || _report(_exceptionable, {
|
|
1323
1375
|
path: _path + ".op",
|
|
1324
1376
|
expected: "(\"gte\" | \"lte\")",
|
|
1325
1377
|
value: input.op
|
|
@@ -1328,7 +1380,7 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1328
1380
|
expected: "number",
|
|
1329
1381
|
value: input.limit
|
|
1330
1382
|
})].every(flag => flag);
|
|
1331
|
-
const _vo7 = (input, _path, _exceptionable = true) => [
|
|
1383
|
+
const _vo7 = (input, _path, _exceptionable = true) => [_vp16(input, _path, true && _exceptionable), "model" === input.target || "session" === input.target || "strategy" === input.target || _report(_exceptionable, {
|
|
1332
1384
|
path: _path + ".target",
|
|
1333
1385
|
expected: "(\"model\" | \"session\" | \"strategy\")",
|
|
1334
1386
|
value: input.target
|
|
@@ -1370,7 +1422,7 @@ export const validateExperimentSpec = (input) => (validateExperimentSpecValidato
|
|
|
1370
1422
|
path: _path + ".kind",
|
|
1371
1423
|
expected: "\"int\"",
|
|
1372
1424
|
value: input.kind
|
|
1373
|
-
}),
|
|
1425
|
+
}), _vp17(input, _path, true && _exceptionable), _vp18(input, _path, true && _exceptionable)].every(flag => flag);
|
|
1374
1426
|
const _vu0 = (input, _path, _exceptionable = true) => (() => {
|
|
1375
1427
|
if ("bool" === input.kind)
|
|
1376
1428
|
return _vo8(input, _path, true && _exceptionable);
|
|
@@ -1837,17 +1889,20 @@ function readBenefit(vars) {
|
|
|
1837
1889
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1838
1890
|
}
|
|
1839
1891
|
/** Metrics at the horizon. The reach time is the first committed state at or above the target, read on the way. */
|
|
1840
|
-
function observeMetrics(E, spec, end,
|
|
1841
|
-
/** The runner elapsed clock. A censored reach time is
|
|
1892
|
+
function observeMetrics(E, spec, end, moneyElapsedSec, milestoneElapsedSec,
|
|
1893
|
+
/** The runner elapsed clock. A censored reach time is at or after it. */
|
|
1842
1894
|
elapsedSec) {
|
|
1843
1895
|
const amount = end.wallet.money.amount;
|
|
1844
1896
|
const benefit = readBenefit(end.vars);
|
|
1845
1897
|
return metricIds(spec).map((metricId) => {
|
|
1846
|
-
if (metricId === "timeToMoney") {
|
|
1847
|
-
|
|
1848
|
-
|
|
1898
|
+
if (metricId === "timeToMoney" || metricId === "timeToMilestone") {
|
|
1899
|
+
const elapsed = metricId === "timeToMoney" ? moneyElapsedSec : milestoneElapsedSec;
|
|
1900
|
+
if (elapsed === undefined) {
|
|
1901
|
+
// Money is read at tick end, so a later reach is strictly after the horizon. An action key can still
|
|
1902
|
+
// be recorded at the start of the next tick, which is exactly the horizon. Other keys are tick end.
|
|
1903
|
+
const strict = metricId === "timeToMoney" || !mayRecordAtActionStart(spec.milestoneKey ?? "");
|
|
1904
|
+
return { metricId, status: "censored", value: null, lowerBound: { sec: elapsedSec, strict } };
|
|
1849
1905
|
}
|
|
1850
|
-
const elapsed = reachedAt - startT;
|
|
1851
1906
|
return { metricId, status: "observed", value: String(elapsed), num: elapsed };
|
|
1852
1907
|
}
|
|
1853
1908
|
if (metricId === "endMoney") {
|
|
@@ -1875,7 +1930,7 @@ function aggregate(E, rows, metricId) {
|
|
|
1875
1930
|
if (picked.some((metric) => metric.status !== "observed" || metric.value === null)) {
|
|
1876
1931
|
// Every seed is either observed or censored with a known lower bound, so the mean has a lower bound too.
|
|
1877
1932
|
const bounded = picked.every((metric) => metric.num !== undefined || metric.lowerBound !== undefined);
|
|
1878
|
-
if (metricId !== "timeToMoney" || !bounded)
|
|
1933
|
+
if ((metricId !== "timeToMoney" && metricId !== "timeToMilestone") || !bounded)
|
|
1879
1934
|
return { metricId, status: "censored", value: null };
|
|
1880
1935
|
const bounds = picked.map((metric) => metric.num ?? metric.lowerBound.sec);
|
|
1881
1936
|
const total = bounds.reduce((sum, bound) => sum + bound, 0);
|
|
@@ -1987,6 +2042,10 @@ function prepareExperiment(request) {
|
|
|
1987
2042
|
reject("goal target must be finite");
|
|
1988
2043
|
if (metrics.includes("timeToMoney") && spec.goal === undefined)
|
|
1989
2044
|
reject("timeToMoney requires a finite goal target");
|
|
2045
|
+
if (spec.milestoneKey !== undefined && spec.milestoneKey.trim().length === 0)
|
|
2046
|
+
reject("milestoneKey must not be blank");
|
|
2047
|
+
if (metrics.includes("timeToMilestone") && spec.milestoneKey === undefined)
|
|
2048
|
+
reject("timeToMilestone requires milestoneKey");
|
|
1990
2049
|
// Every spec field the run reads must be one both spec hashes record.
|
|
1991
2050
|
if (!isJsonData(request.spec, new Set(), true))
|
|
1992
2051
|
reject("spec must be JSON data, because the spec hashes record it as JSON");
|
|
@@ -2022,9 +2081,14 @@ function prepareExperiment(request) {
|
|
|
2022
2081
|
export function checkExperimentSpec(request) {
|
|
2023
2082
|
prepareExperiment(request);
|
|
2024
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* @evidence docs/requirements/active/parameter-experiments.md#req-pr14-milestone-reach Reads the first matching committed milestone through the observer, independent of retained samples and wallet resets.
|
|
2086
|
+
* @evidenceReview docs/requirements/active/parameter-experiments.md#req-pr14-milestone-reach #4bb99f4 Re-read the milestone contract and ran the experiment tests: reset timing is 10 and 5, money timing is 4, horizon money is 2, missing milestones stay censored, mixed-seed bounds prove only known deadline violations, a censored action key keeps a non-strict horizon bound so a purchase due exactly at the horizon does not prove an lte deadline equal to it while a model key does, and a 0.2-second tick at absolute time 2 ** 50 is measured as 0.2 for both reach metrics. Milestone phases preserve tick-start actions and tick-end model/prestige facts even when a final partial tick has identical absolute timestamps.
|
|
2087
|
+
*/
|
|
2025
2088
|
export function runExperiment(request) {
|
|
2026
2089
|
const { spec, metrics, base, prepared, specHashes } = prepareExperiment(request);
|
|
2027
|
-
const
|
|
2090
|
+
const measuresMoney = metrics.includes("timeToMoney");
|
|
2091
|
+
const measuresMilestone = metrics.includes("timeToMilestone");
|
|
2028
2092
|
const E = request.engine;
|
|
2029
2093
|
// The plan builds the strategy, so compile does not build the scenario one.
|
|
2030
2094
|
const { strategy: _scenarioStrategy, ...withoutStrategy } = request.scenario;
|
|
@@ -2045,7 +2109,7 @@ export function runExperiment(request) {
|
|
|
2045
2109
|
models: request.modelRegistry,
|
|
2046
2110
|
strategies: request.strategyRegistry,
|
|
2047
2111
|
});
|
|
2048
|
-
const target =
|
|
2112
|
+
const target = measuresMoney && spec.goal !== undefined ? E.from(spec.goal.target) : undefined;
|
|
2049
2113
|
// Stopping at the goal is safe only when no other metric reads the horizon state.
|
|
2050
2114
|
const stopAtReach = metrics.every((metricId) => metricId === "timeToMoney");
|
|
2051
2115
|
const tasks = [];
|
|
@@ -2072,23 +2136,46 @@ export function runExperiment(request) {
|
|
|
2072
2136
|
try {
|
|
2073
2137
|
const opened = binding.fresh({ trialId: taskId, seed, plan });
|
|
2074
2138
|
const scenario = opened.scenario;
|
|
2075
|
-
let
|
|
2139
|
+
let moneyElapsedSec;
|
|
2140
|
+
let milestoneElapsedSec;
|
|
2141
|
+
let observedElapsedSec = 0;
|
|
2142
|
+
let stepStartElapsedSec = 0;
|
|
2076
2143
|
const result = runScenario({
|
|
2077
2144
|
...scenario,
|
|
2078
2145
|
run: {
|
|
2079
2146
|
...scenario.run,
|
|
2147
|
+
...(measuresMoney || measuresMilestone ? {
|
|
2148
|
+
// Read elapsed ticks, since subtracting large absolute clocks can round the duration.
|
|
2149
|
+
// The observer still receives milestone facts when no samples are retained.
|
|
2150
|
+
observation: { ...scenario.run.observation, enabled: true, ...(measuresMilestone ? { maxMilestones: 0 } : {}) },
|
|
2151
|
+
observer: {
|
|
2152
|
+
...scenario.run.observer,
|
|
2153
|
+
onStep: (fact) => {
|
|
2154
|
+
stepStartElapsedSec = observedElapsedSec;
|
|
2155
|
+
observedElapsedSec += fact.dt;
|
|
2156
|
+
scenario.run.observer?.onStep?.(fact);
|
|
2157
|
+
},
|
|
2158
|
+
onMilestone: (fact) => {
|
|
2159
|
+
if (measuresMilestone && milestoneElapsedSec === undefined && fact.key === spec.milestoneKey) {
|
|
2160
|
+
// A final partial tick may round t1 to t0, so use the committed phase.
|
|
2161
|
+
milestoneElapsedSec = fact.phase === "action-start" ? stepStartElapsedSec : observedElapsedSec;
|
|
2162
|
+
}
|
|
2163
|
+
scenario.run.observer?.onMilestone?.(fact);
|
|
2164
|
+
},
|
|
2165
|
+
},
|
|
2166
|
+
} : {}),
|
|
2080
2167
|
...(target !== undefined
|
|
2081
2168
|
? {
|
|
2082
2169
|
until: (state) => {
|
|
2083
|
-
if (
|
|
2084
|
-
|
|
2085
|
-
return stopAtReach &&
|
|
2170
|
+
if (moneyElapsedSec === undefined && E.cmp(state.wallet.money.amount, target) >= 0)
|
|
2171
|
+
moneyElapsedSec = observedElapsedSec;
|
|
2172
|
+
return stopAtReach && moneyElapsedSec !== undefined;
|
|
2086
2173
|
},
|
|
2087
2174
|
}
|
|
2088
2175
|
: {}),
|
|
2089
2176
|
},
|
|
2090
2177
|
});
|
|
2091
|
-
readings = observeMetrics(E, spec, result.end,
|
|
2178
|
+
readings = observeMetrics(E, spec, result.end, moneyElapsedSec, milestoneElapsedSec, runElapsedSec(result));
|
|
2092
2179
|
}
|
|
2093
2180
|
catch {
|
|
2094
2181
|
readings = failedMetrics(spec);
|
|
@@ -2122,7 +2209,8 @@ export function runExperiment(request) {
|
|
|
2122
2209
|
const constraintViolations = (spec.constraints ?? [])
|
|
2123
2210
|
.filter((constraint) => {
|
|
2124
2211
|
const reading = readings.find((metric) => metric.metricId === constraint.metricId);
|
|
2125
|
-
// A censored reach time is
|
|
2212
|
+
// A censored reach time is at or after its lower bound, strictly after when the bound is strict.
|
|
2213
|
+
// That proves an lte violation once the bound passes the limit, or reaches it strictly.
|
|
2126
2214
|
const bound = reading !== undefined && reading.status === "censored" ? reading.lowerBound : undefined;
|
|
2127
2215
|
if (isObserved(reading))
|
|
2128
2216
|
return violates(E, reading, constraint);
|
|
@@ -2186,6 +2274,7 @@ export function runExperiment(request) {
|
|
|
2186
2274
|
originalSpecHash: specHashes.original,
|
|
2187
2275
|
effectiveSpecHash: specHashes.effective,
|
|
2188
2276
|
effectiveRunHash: request.effectiveRunHash,
|
|
2277
|
+
...(measuresMilestone ? { milestoneKey: spec.milestoneKey } : {}),
|
|
2189
2278
|
budget: {
|
|
2190
2279
|
candidates: spec.budget.candidates,
|
|
2191
2280
|
seeds: spec.budget.seeds,
|