bitfab 0.64.12 → 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.
@@ -8,7 +8,7 @@ import {
8
8
  replayContextReady,
9
9
  runWithReplayContext,
10
10
  unrefTimer
11
- } from "./chunk-3T32S5N7.js";
11
+ } from "./chunk-NZWWPT76.js";
12
12
  import {
13
13
  runWithCaptureSuppressed,
14
14
  warnOnce,
@@ -1437,7 +1437,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
1437
1437
  dbBranchTimings: dbBranchTimings ?? null
1438
1438
  };
1439
1439
  }
1440
- async function waitForReplayPersistence(httpClient, experimentId, replayedTraceIds) {
1440
+ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceIds, replayLabels = {}, warn = console.warn) {
1441
1441
  const deferredSettled = await httpClient.settleDeferredWork(
1442
1442
  REPLAY_PERSISTENCE_TIMEOUT_MS
1443
1443
  );
@@ -1470,7 +1470,7 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
1470
1470
  return readBackTraceIds;
1471
1471
  }
1472
1472
  const deadline = Date.now() + REPLAY_PERSISTENCE_TIMEOUT_MS;
1473
- let missing = Object.keys(expectedSpanCounts).length;
1473
+ let missing = Object.keys(expectedSpanCounts);
1474
1474
  while (true) {
1475
1475
  const status = await httpClient.getReplayStatus(
1476
1476
  experimentId,
@@ -1480,8 +1480,8 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
1480
1480
  Object.assign(readBackTraceIds, ready);
1481
1481
  missing = Object.keys(expectedSpanCounts).filter(
1482
1482
  (traceId) => ready[traceId] === void 0
1483
- ).length;
1484
- if (missing === 0) {
1483
+ );
1484
+ if (missing.length === 0) {
1485
1485
  return readBackTraceIds;
1486
1486
  }
1487
1487
  if (Date.now() >= deadline) {
@@ -1491,10 +1491,19 @@ async function waitForReplayPersistence(httpClient, experimentId, replayedTraceI
1491
1491
  Math.min(100, Math.max(0, deadline - Date.now()))
1492
1492
  );
1493
1493
  }
1494
- const cause = flushed ? "" : " Delivery was also not confirmed before the flush deadline, so the spans likely never reached the server.";
1495
- throw new BitfabError(
1496
- `Replay traces were not fully persisted before the delivery deadline (experiment ${experimentId}, missing ${missing} of ${Object.keys(expectedSpanCounts).length} trace(s)).${cause}`
1497
- );
1494
+ for (const traceId of missing) {
1495
+ warn(
1496
+ unconfirmedReplayWarning(
1497
+ replayLabels[traceId] ?? traceId,
1498
+ REPLAY_PERSISTENCE_TIMEOUT_MS / 1e3,
1499
+ flushed
1500
+ )
1501
+ );
1502
+ }
1503
+ return readBackTraceIds;
1504
+ }
1505
+ function unconfirmedReplayWarning(label, seconds, flushed) {
1506
+ 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."}`;
1498
1507
  }
1499
1508
  function sleepForReplayPersistence(ms) {
1500
1509
  return new Promise((resolve) => {
@@ -1898,7 +1907,17 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
1898
1907
  }
1899
1908
  throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
1900
1909
  const deliveredTraceIds = await preserveReplayFailure(
1901
- () => waitForReplayPersistence(httpClient, experimentId, replayedTraceIds),
1910
+ () => waitForReplayPersistence(
1911
+ httpClient,
1912
+ experimentId,
1913
+ replayedTraceIds,
1914
+ Object.fromEntries(
1915
+ workItems.map(({ serverItem, attempt }, index) => [
1916
+ replayedTraceIds[index],
1917
+ `${serverItem.originalTraceId ?? serverItem.sourceTraceId}#${attempt}`
1918
+ ])
1919
+ )
1920
+ ),
1902
1921
  resultItems,
1903
1922
  experimentId,
1904
1923
  fullExperimentUrl
@@ -2031,4 +2050,4 @@ export {
2031
2050
  warnJudgeAssertionsDeprecated,
2032
2051
  replay
2033
2052
  };
2034
- //# sourceMappingURL=chunk-N63C4XC6.js.map
2053
+ //# sourceMappingURL=chunk-K64TGFIC.js.map