bitfab 0.28.3 → 0.28.4

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/index.d.cts CHANGED
@@ -623,9 +623,9 @@ interface ReplayOptions {
623
623
  codeChangeFiles?: CodeChangeFile[];
624
624
  /**
625
625
  * Mock strategy for child spans during replay.
626
- * - "none": everything runs real code (default)
626
+ * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
627
+ * - "none": everything runs real code
627
628
  * - "all": every child withSpan returns historical output
628
- * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked
629
629
  */
630
630
  mock?: MockStrategy;
631
631
  /**
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
1603
1603
  /**
1604
1604
  * SDK version from package.json (injected at build time)
1605
1605
  */
1606
- declare const __version__ = "0.28.3";
1606
+ declare const __version__ = "0.28.4";
1607
1607
 
1608
1608
  /**
1609
1609
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -623,9 +623,9 @@ interface ReplayOptions {
623
623
  codeChangeFiles?: CodeChangeFile[];
624
624
  /**
625
625
  * Mock strategy for child spans during replay.
626
- * - "none": everything runs real code (default)
626
+ * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
627
+ * - "none": everything runs real code
627
628
  * - "all": every child withSpan returns historical output
628
- * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked
629
629
  */
630
630
  mock?: MockStrategy;
631
631
  /**
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
1603
1603
  /**
1604
1604
  * SDK version from package.json (injected at build time)
1605
1605
  */
1606
- declare const __version__ = "0.28.3";
1606
+ declare const __version__ = "0.28.4";
1607
1607
 
1608
1608
  /**
1609
1609
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -23,12 +23,12 @@ import {
23
23
  flushTraces,
24
24
  getCurrentSpan,
25
25
  getCurrentTrace
26
- } from "./chunk-KYDQQPIS.js";
26
+ } from "./chunk-3F46BMPM.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  BitfabError,
30
30
  reportReplayProgress
31
- } from "./chunk-B262VQWF.js";
31
+ } from "./chunk-SAGZ674W.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
34
34
  Bitfab,
package/dist/node.cjs CHANGED
@@ -407,10 +407,25 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
407
407
  }
408
408
  let mockTree;
409
409
  if (mockStrategy === "all" || mockStrategy === "marked") {
410
- const treeResponse = await httpClient.getSpanTree(
411
- serverItem.externalSpanId
412
- );
413
- mockTree = buildMockTree(treeResponse.root);
410
+ try {
411
+ const treeResponse = await httpClient.getSpanTree(
412
+ serverItem.externalSpanId
413
+ );
414
+ if (treeResponse.root) {
415
+ mockTree = buildMockTree(treeResponse.root);
416
+ } else if (mockStrategy === "all") {
417
+ throw new BitfabError(
418
+ `Replay mock strategy "all" requires a span tree root for source span ${serverItem.externalSpanId}.`
419
+ );
420
+ } else {
421
+ mockTree = void 0;
422
+ }
423
+ } catch (e) {
424
+ if (mockStrategy === "all") {
425
+ throw e;
426
+ }
427
+ mockTree = void 0;
428
+ }
414
429
  }
415
430
  const maybePromise = runWithReplayContext(
416
431
  {
@@ -516,7 +531,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
516
531
  options?.experimentGroupId,
517
532
  options?.datasetId
518
533
  );
519
- const mockStrategy = options?.mock ?? "none";
534
+ const mockStrategy = options?.mock ?? "marked";
520
535
  const maxConcurrency = options?.maxConcurrency ?? 10;
521
536
  const tasks = serverItems.map(
522
537
  (serverItem) => () => processItem(
@@ -667,7 +682,7 @@ registerAsyncLocalStorageClass(
667
682
  );
668
683
 
669
684
  // src/version.generated.ts
670
- var __version__ = "0.28.3";
685
+ var __version__ = "0.28.4";
671
686
 
672
687
  // src/constants.ts
673
688
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";