@bitfab/sdk 0.64.11 → 0.64.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.
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-3H3QMZBN.js";
10
+ } from "./chunk-JN3C4PIV.js";
11
11
  export {
12
12
  BitfabError,
13
13
  HttpClient,
@@ -18,4 +18,4 @@ export {
18
18
  parseRetryAfterMs,
19
19
  serializePayloadBody
20
20
  };
21
- //# sourceMappingURL=http-PXJMOXSK.js.map
21
+ //# sourceMappingURL=http-4DPVYNI3.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-A6RYFTIX.js";
10
+ } from "./chunk-YOM2DADY.js";
11
11
  import "./chunk-MT36GJMW.js";
12
12
  export {
13
13
  BitfabError,
@@ -19,4 +19,4 @@ export {
19
19
  parseRetryAfterMs,
20
20
  serializePayloadBody
21
21
  };
22
- //# sourceMappingURL=http-QCQPXTCA.js.map
22
+ //# sourceMappingURL=http-IFJ4TUVR.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.64.11";
45
+ __version__ = "0.64.13";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -4641,7 +4641,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4641
4641
  dbBranchTimings: dbBranchTimings ?? null
4642
4642
  };
4643
4643
  }
4644
- async function waitForReplayPersistence(httpClient, experimentId, replayedTraceIds) {
4644
+ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceIds, replayLabels = {}, warn2 = console.warn) {
4645
4645
  const deferredSettled = await httpClient.settleDeferredWork(
4646
4646
  REPLAY_PERSISTENCE_TIMEOUT_MS
4647
4647
  );
@@ -4674,7 +4674,7 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
4674
4674
  return readBackTraceIds;
4675
4675
  }
4676
4676
  const deadline = Date.now() + REPLAY_PERSISTENCE_TIMEOUT_MS;
4677
- let missing = Object.keys(expectedSpanCounts).length;
4677
+ let missing = Object.keys(expectedSpanCounts);
4678
4678
  while (true) {
4679
4679
  const status = await httpClient.getReplayStatus(
4680
4680
  experimentId,
@@ -4684,8 +4684,8 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
4684
4684
  Object.assign(readBackTraceIds, ready);
4685
4685
  missing = Object.keys(expectedSpanCounts).filter(
4686
4686
  (traceId) => ready[traceId] === void 0
4687
- ).length;
4688
- if (missing === 0) {
4687
+ );
4688
+ if (missing.length === 0) {
4689
4689
  return readBackTraceIds;
4690
4690
  }
4691
4691
  if (Date.now() >= deadline) {
@@ -4695,10 +4695,19 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
4695
4695
  Math.min(100, Math.max(0, deadline - Date.now()))
4696
4696
  );
4697
4697
  }
4698
- const cause = flushed ? "" : " Delivery was also not confirmed before the flush deadline, so the spans likely never reached the server.";
4699
- throw new BitfabError(
4700
- `Replay traces were not fully persisted before the delivery deadline (experiment ${experimentId}, missing ${missing} of ${Object.keys(expectedSpanCounts).length} trace(s)).${cause}`
4701
- );
4698
+ for (const traceId of missing) {
4699
+ warn2(
4700
+ unconfirmedReplayWarning(
4701
+ replayLabels[traceId] ?? traceId,
4702
+ REPLAY_PERSISTENCE_TIMEOUT_MS / 1e3,
4703
+ flushed
4704
+ )
4705
+ );
4706
+ }
4707
+ return readBackTraceIds;
4708
+ }
4709
+ function unconfirmedReplayWarning(label, seconds, flushed) {
4710
+ return `[bitfab] replay ${label} could not confirm all spans reached Bitfab within ${seconds}s. The run continues; Bitfab will show this replay as capture incomplete.${flushed ? "" : " Some spans likely never left this process."}`;
4702
4711
  }
4703
4712
  function sleepForReplayPersistence(ms) {
4704
4713
  return new Promise((resolve) => {
@@ -5101,7 +5110,17 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
5101
5110
  }
5102
5111
  throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
5103
5112
  const deliveredTraceIds = await preserveReplayFailure(
5104
- () => waitForReplayPersistence(httpClient, experimentId, replayedTraceIds),
5113
+ () => waitForReplayPersistence(
5114
+ httpClient,
5115
+ experimentId,
5116
+ replayedTraceIds,
5117
+ Object.fromEntries(
5118
+ workItems.map(({ serverItem, attempt }, index) => [
5119
+ replayedTraceIds[index],
5120
+ `${serverItem.originalTraceId ?? serverItem.sourceTraceId}#${attempt}`
5121
+ ])
5122
+ )
5123
+ ),
5105
5124
  resultItems,
5106
5125
  experimentId,
5107
5126
  fullExperimentUrl