bitfab 0.36.12 → 0.36.13
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/{chunk-VUYTATF5.js → chunk-VOUV7ZTS.js} +8 -11
- package/dist/chunk-VOUV7ZTS.js.map +1 -0
- package/dist/{chunk-OCJSHTJR.js → chunk-XAQJOZMJ.js} +9 -4
- package/dist/{chunk-OCJSHTJR.js.map → chunk-XAQJOZMJ.js.map} +1 -1
- package/dist/index.cjs +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -14
- package/dist/index.d.ts +20 -14
- package/dist/index.js +2 -2
- package/dist/node.cjs +13 -11
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-P35CUNGH.js → replay-WHZFV6OB.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-VUYTATF5.js.map +0 -1
- /package/dist/{replay-P35CUNGH.js.map → replay-WHZFV6OB.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -182,8 +182,9 @@ interface MockOverride {
|
|
|
182
182
|
* A single span entry in the mock tree.
|
|
183
183
|
*
|
|
184
184
|
* Under the eager path (`mock: "all"`) `output`/`outputMeta` are populated
|
|
185
|
-
* inline
|
|
186
|
-
*
|
|
185
|
+
* inline, even when overrides are present. Under a non-`all` path that needs a
|
|
186
|
+
* tree (`marked`, or `none` with overrides), they are absent and the recorded
|
|
187
|
+
* output is fetched on demand via `externalSpanId` - see
|
|
187
188
|
* {@link ReplayContext.fetchSpanOutput}.
|
|
188
189
|
*/
|
|
189
190
|
interface MockSpan {
|
|
@@ -267,9 +268,10 @@ interface ReplayContext {
|
|
|
267
268
|
mockOverrides?: MockOverride[];
|
|
268
269
|
/**
|
|
269
270
|
* Memoized lazy fetch of a span's recorded output (deserialized), keyed by
|
|
270
|
-
* `externalSpanId`. Present ONLY on
|
|
271
|
-
* absent under `mock: "all"`, where
|
|
272
|
-
*
|
|
271
|
+
* `externalSpanId`. Present ONLY on a non-`all` path that needs a tree
|
|
272
|
+
* (`marked`, or `none` with overrides); absent under `mock: "all"`, where
|
|
273
|
+
* outputs are inline even when overrides are present. Its presence is the
|
|
274
|
+
* signal that outputs must be fetched rather than read inline.
|
|
273
275
|
*/
|
|
274
276
|
fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
|
|
275
277
|
dbBranchLease?: DbBranchLease;
|
|
@@ -1177,9 +1179,9 @@ interface DbBranchOptions {
|
|
|
1177
1179
|
}
|
|
1178
1180
|
interface ReplayOptions {
|
|
1179
1181
|
/**
|
|
1180
|
-
* Maximum number of traces to replay (1-
|
|
1181
|
-
* `traceIds` is passed (with a warning)
|
|
1182
|
-
* determines how many traces replay.
|
|
1182
|
+
* Maximum number of traces to replay (1-5,000, default 5). Ignored when
|
|
1183
|
+
* `traceIds` is passed (with a warning), or when `datasetId` is passed,
|
|
1184
|
+
* because either source already determines how many traces replay.
|
|
1183
1185
|
*/
|
|
1184
1186
|
limit?: number;
|
|
1185
1187
|
/** Optional list of specific trace IDs to replay (max 100). */
|
|
@@ -1209,7 +1211,8 @@ interface ReplayOptions {
|
|
|
1209
1211
|
* Mock strategy for child spans during replay.
|
|
1210
1212
|
* - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
|
|
1211
1213
|
* - "none": everything runs real code
|
|
1212
|
-
* - "all": every child withSpan returns historical output
|
|
1214
|
+
* - "all": every matched recorded child withSpan returns historical output;
|
|
1215
|
+
* a missing occurrence fails the replay item closed
|
|
1213
1216
|
*/
|
|
1214
1217
|
mock?: MockStrategy;
|
|
1215
1218
|
/**
|
|
@@ -1229,9 +1232,10 @@ interface ReplayOptions {
|
|
|
1229
1232
|
* branch with `getCurrentReplayBranch()`.
|
|
1230
1233
|
*
|
|
1231
1234
|
* Items whose source trace carried no DB snapshot reference get no branch and
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
+
* use the app's normal database path. Unsafe calls on that path still require
|
|
1236
|
+
* replay mocking. An item whose branch was requested but could not be resolved
|
|
1237
|
+
* fails instead of running, so replay never silently reports a result that did
|
|
1238
|
+
* not use the historical data you asked for.
|
|
1235
1239
|
*/
|
|
1236
1240
|
dbBranch?: DbBranchOptions | boolean;
|
|
1237
1241
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
@@ -1966,7 +1970,9 @@ interface SpanOptions {
|
|
|
1966
1970
|
*
|
|
1967
1971
|
* Use this for child spans that are expensive (paid LLM/API calls),
|
|
1968
1972
|
* slow, or non-deterministic - the root function still runs real code,
|
|
1969
|
-
* only the marked descendants return their recorded output.
|
|
1973
|
+
* only the marked descendants return their recorded output. If a selected
|
|
1974
|
+
* occurrence is unavailable, replay fails the item without executing the
|
|
1975
|
+
* real child.
|
|
1970
1976
|
*/
|
|
1971
1977
|
mockOnReplay?: boolean;
|
|
1972
1978
|
/**
|
|
@@ -2575,7 +2581,7 @@ declare class BitfabFunction {
|
|
|
2575
2581
|
/**
|
|
2576
2582
|
* SDK version from package.json (injected at build time)
|
|
2577
2583
|
*/
|
|
2578
|
-
declare const __version__ = "0.36.
|
|
2584
|
+
declare const __version__ = "0.36.13";
|
|
2579
2585
|
|
|
2580
2586
|
/**
|
|
2581
2587
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -182,8 +182,9 @@ interface MockOverride {
|
|
|
182
182
|
* A single span entry in the mock tree.
|
|
183
183
|
*
|
|
184
184
|
* Under the eager path (`mock: "all"`) `output`/`outputMeta` are populated
|
|
185
|
-
* inline
|
|
186
|
-
*
|
|
185
|
+
* inline, even when overrides are present. Under a non-`all` path that needs a
|
|
186
|
+
* tree (`marked`, or `none` with overrides), they are absent and the recorded
|
|
187
|
+
* output is fetched on demand via `externalSpanId` - see
|
|
187
188
|
* {@link ReplayContext.fetchSpanOutput}.
|
|
188
189
|
*/
|
|
189
190
|
interface MockSpan {
|
|
@@ -267,9 +268,10 @@ interface ReplayContext {
|
|
|
267
268
|
mockOverrides?: MockOverride[];
|
|
268
269
|
/**
|
|
269
270
|
* Memoized lazy fetch of a span's recorded output (deserialized), keyed by
|
|
270
|
-
* `externalSpanId`. Present ONLY on
|
|
271
|
-
* absent under `mock: "all"`, where
|
|
272
|
-
*
|
|
271
|
+
* `externalSpanId`. Present ONLY on a non-`all` path that needs a tree
|
|
272
|
+
* (`marked`, or `none` with overrides); absent under `mock: "all"`, where
|
|
273
|
+
* outputs are inline even when overrides are present. Its presence is the
|
|
274
|
+
* signal that outputs must be fetched rather than read inline.
|
|
273
275
|
*/
|
|
274
276
|
fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
|
|
275
277
|
dbBranchLease?: DbBranchLease;
|
|
@@ -1177,9 +1179,9 @@ interface DbBranchOptions {
|
|
|
1177
1179
|
}
|
|
1178
1180
|
interface ReplayOptions {
|
|
1179
1181
|
/**
|
|
1180
|
-
* Maximum number of traces to replay (1-
|
|
1181
|
-
* `traceIds` is passed (with a warning)
|
|
1182
|
-
* determines how many traces replay.
|
|
1182
|
+
* Maximum number of traces to replay (1-5,000, default 5). Ignored when
|
|
1183
|
+
* `traceIds` is passed (with a warning), or when `datasetId` is passed,
|
|
1184
|
+
* because either source already determines how many traces replay.
|
|
1183
1185
|
*/
|
|
1184
1186
|
limit?: number;
|
|
1185
1187
|
/** Optional list of specific trace IDs to replay (max 100). */
|
|
@@ -1209,7 +1211,8 @@ interface ReplayOptions {
|
|
|
1209
1211
|
* Mock strategy for child spans during replay.
|
|
1210
1212
|
* - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
|
|
1211
1213
|
* - "none": everything runs real code
|
|
1212
|
-
* - "all": every child withSpan returns historical output
|
|
1214
|
+
* - "all": every matched recorded child withSpan returns historical output;
|
|
1215
|
+
* a missing occurrence fails the replay item closed
|
|
1213
1216
|
*/
|
|
1214
1217
|
mock?: MockStrategy;
|
|
1215
1218
|
/**
|
|
@@ -1229,9 +1232,10 @@ interface ReplayOptions {
|
|
|
1229
1232
|
* branch with `getCurrentReplayBranch()`.
|
|
1230
1233
|
*
|
|
1231
1234
|
* Items whose source trace carried no DB snapshot reference get no branch and
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
+
* use the app's normal database path. Unsafe calls on that path still require
|
|
1236
|
+
* replay mocking. An item whose branch was requested but could not be resolved
|
|
1237
|
+
* fails instead of running, so replay never silently reports a result that did
|
|
1238
|
+
* not use the historical data you asked for.
|
|
1235
1239
|
*/
|
|
1236
1240
|
dbBranch?: DbBranchOptions | boolean;
|
|
1237
1241
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
@@ -1966,7 +1970,9 @@ interface SpanOptions {
|
|
|
1966
1970
|
*
|
|
1967
1971
|
* Use this for child spans that are expensive (paid LLM/API calls),
|
|
1968
1972
|
* slow, or non-deterministic - the root function still runs real code,
|
|
1969
|
-
* only the marked descendants return their recorded output.
|
|
1973
|
+
* only the marked descendants return their recorded output. If a selected
|
|
1974
|
+
* occurrence is unavailable, replay fails the item without executing the
|
|
1975
|
+
* real child.
|
|
1970
1976
|
*/
|
|
1971
1977
|
mockOnReplay?: boolean;
|
|
1972
1978
|
/**
|
|
@@ -2575,7 +2581,7 @@ declare class BitfabFunction {
|
|
|
2575
2581
|
/**
|
|
2576
2582
|
* SDK version from package.json (injected at build time)
|
|
2577
2583
|
*/
|
|
2578
|
-
declare const __version__ = "0.36.
|
|
2584
|
+
declare const __version__ = "0.36.13";
|
|
2579
2585
|
|
|
2580
2586
|
/**
|
|
2581
2587
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getCurrentReplayBranch,
|
|
21
21
|
getCurrentSpan,
|
|
22
22
|
getCurrentTrace
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-XAQJOZMJ.js";
|
|
24
24
|
import {
|
|
25
25
|
BITFAB_PROGRESS_PREFIX,
|
|
26
26
|
BitfabError,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
flushTraces,
|
|
33
33
|
reportReplayProgress,
|
|
34
34
|
serializeReplayResult
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-VOUV7ZTS.js";
|
|
36
36
|
export {
|
|
37
37
|
BITFAB_PROGRESS_PREFIX,
|
|
38
38
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.36.
|
|
100
|
+
__version__ = "0.36.13";
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
@@ -2602,20 +2602,17 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2602
2602
|
includeOutputs,
|
|
2603
2603
|
includeRootOutput: false
|
|
2604
2604
|
});
|
|
2605
|
-
if (treeResponse.root) {
|
|
2606
|
-
mockTree = buildMockTree(treeResponse.root);
|
|
2607
|
-
} else if (mockStrategy === "all" || hasOverrides) {
|
|
2605
|
+
if (!treeResponse.root) {
|
|
2608
2606
|
throw new BitfabError(
|
|
2609
2607
|
`Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for original span ${originalSpanId}.`
|
|
2610
2608
|
);
|
|
2611
|
-
} else {
|
|
2612
|
-
mockTree = void 0;
|
|
2613
2609
|
}
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2610
|
+
mockTree = buildMockTree(treeResponse.root);
|
|
2611
|
+
} catch (error2) {
|
|
2612
|
+
if (mockStrategy !== "marked" || hasOverrides) {
|
|
2613
|
+
throw error2;
|
|
2617
2614
|
}
|
|
2618
|
-
mockTree =
|
|
2615
|
+
mockTree = { spans: /* @__PURE__ */ new Map() };
|
|
2619
2616
|
}
|
|
2620
2617
|
}
|
|
2621
2618
|
const outputCache = /* @__PURE__ */ new Map();
|
|
@@ -6197,7 +6194,12 @@ var Bitfab = class {
|
|
|
6197
6194
|
}
|
|
6198
6195
|
}
|
|
6199
6196
|
const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
|
|
6200
|
-
if (shouldMock && mockSpan) {
|
|
6197
|
+
if (shouldMock && !mockSpan) {
|
|
6198
|
+
throw new BitfabError(
|
|
6199
|
+
`Replay selected span "${traceFunctionKey}:${baseSpanParams.spanName}" for mocking, but recorded occurrence ${callIndex + 1} is unavailable. The real span was not executed.`
|
|
6200
|
+
);
|
|
6201
|
+
}
|
|
6202
|
+
if (shouldMock) {
|
|
6201
6203
|
const recorded = resolveRecordedOutput();
|
|
6202
6204
|
if (recorded instanceof Promise) {
|
|
6203
6205
|
return emitMockAsync(recorded, "recorded");
|