@bitfab/sdk 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
@@ -14,12 +14,12 @@ import {
14
14
  flushTraces,
15
15
  getCurrentSpan,
16
16
  getCurrentTrace
17
- } from "./chunk-KYDQQPIS.js";
17
+ } from "./chunk-3F46BMPM.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
20
20
  BitfabError,
21
21
  reportReplayProgress
22
- } from "./chunk-B262VQWF.js";
22
+ } from "./chunk-SAGZ674W.js";
23
23
  export {
24
24
  BITFAB_PROGRESS_PREFIX,
25
25
  Bitfab,
package/dist/node.cjs CHANGED
@@ -398,10 +398,25 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
398
398
  }
399
399
  let mockTree;
400
400
  if (mockStrategy === "all" || mockStrategy === "marked") {
401
- const treeResponse = await httpClient.getSpanTree(
402
- serverItem.externalSpanId
403
- );
404
- mockTree = buildMockTree(treeResponse.root);
401
+ try {
402
+ const treeResponse = await httpClient.getSpanTree(
403
+ serverItem.externalSpanId
404
+ );
405
+ if (treeResponse.root) {
406
+ mockTree = buildMockTree(treeResponse.root);
407
+ } else if (mockStrategy === "all") {
408
+ throw new BitfabError(
409
+ `Replay mock strategy "all" requires a span tree root for source span ${serverItem.externalSpanId}.`
410
+ );
411
+ } else {
412
+ mockTree = void 0;
413
+ }
414
+ } catch (e) {
415
+ if (mockStrategy === "all") {
416
+ throw e;
417
+ }
418
+ mockTree = void 0;
419
+ }
405
420
  }
406
421
  const maybePromise = runWithReplayContext(
407
422
  {
@@ -507,7 +522,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
507
522
  options?.experimentGroupId,
508
523
  options?.datasetId
509
524
  );
510
- const mockStrategy = options?.mock ?? "none";
525
+ const mockStrategy = options?.mock ?? "marked";
511
526
  const maxConcurrency = options?.maxConcurrency ?? 10;
512
527
  const tasks = serverItems.map(
513
528
  (serverItem) => () => processItem(
@@ -658,7 +673,7 @@ registerAsyncLocalStorageClass(
658
673
  );
659
674
 
660
675
  // src/version.generated.ts
661
- var __version__ = "0.28.3";
676
+ var __version__ = "0.28.4";
662
677
 
663
678
  // src/constants.ts
664
679
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";