bitfab 0.63.0 → 0.63.2

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.
Files changed (31) hide show
  1. package/cloudReplay.py +889 -707
  2. package/dist/{chunk-NUMYG5MD.js → chunk-3D67XMAO.js} +10 -4
  3. package/dist/{chunk-NUMYG5MD.js.map → chunk-3D67XMAO.js.map} +1 -1
  4. package/dist/{chunk-VLBEFEIP.js → chunk-5WYDAQAK.js} +10 -4
  5. package/dist/{chunk-VLBEFEIP.js.map → chunk-5WYDAQAK.js.map} +1 -1
  6. package/dist/{chunk-GNDDPHTZ.js → chunk-NJQ5P6V7.js} +6 -4
  7. package/dist/chunk-NJQ5P6V7.js.map +1 -0
  8. package/dist/{chunk-TTWRFQPU.js → chunk-NZCQ5TG4.js} +43 -22
  9. package/dist/chunk-NZCQ5TG4.js.map +1 -0
  10. package/dist/{chunk-KI2TAU36.js → chunk-ZRZDSP2R.js} +6 -6
  11. package/dist/{chunk-KI2TAU36.js.map → chunk-ZRZDSP2R.js.map} +1 -1
  12. package/dist/{http-EVUZHBV4.js → http-HXDG3XBJ.js} +2 -2
  13. package/dist/{http-N3TK6ASX.js → http-OJLI4LKV.js} +2 -2
  14. package/dist/index.cjs +50 -23
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +26 -19
  17. package/dist/index.d.ts +26 -19
  18. package/dist/index.js +3 -3
  19. package/dist/node.cjs +50 -23
  20. package/dist/node.cjs.map +1 -1
  21. package/dist/node.js +3 -3
  22. package/dist/{replay-ZH6CNI22.js → replay-MIBLRJKS.js} +3 -3
  23. package/dist/replayCli.js +21 -10
  24. package/dist/replayCli.js.map +1 -1
  25. package/dist/seedCli.js +2 -2
  26. package/package.json +1 -1
  27. package/dist/chunk-GNDDPHTZ.js.map +0 -1
  28. package/dist/chunk-TTWRFQPU.js.map +0 -1
  29. /package/dist/{http-EVUZHBV4.js.map → http-HXDG3XBJ.js.map} +0 -0
  30. /package/dist/{http-N3TK6ASX.js.map → http-OJLI4LKV.js.map} +0 -0
  31. /package/dist/{replay-ZH6CNI22.js.map → replay-MIBLRJKS.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-VLBEFEIP.js";
10
+ } from "./chunk-5WYDAQAK.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-EVUZHBV4.js.map
21
+ //# sourceMappingURL=http-HXDG3XBJ.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-NUMYG5MD.js";
10
+ } from "./chunk-3D67XMAO.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-N3TK6ASX.js.map
22
+ //# sourceMappingURL=http-OJLI4LKV.js.map
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ var __version__, __packageName__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.63.0";
54
+ __version__ = "0.63.2";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -2904,7 +2904,7 @@ var init_http = __esm({
2904
2904
  * Start a replay session by fetching historical traces.
2905
2905
  * Blocking call - creates an experiment and returns lightweight item references.
2906
2906
  */
2907
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata) {
2907
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata, dryRun) {
2908
2908
  const payload = { traceFunctionKey };
2909
2909
  if (experimentalSelectiveReplay !== void 0) {
2910
2910
  payload.experimentalSelectiveReplay = experimentalSelectiveReplay;
@@ -2962,6 +2962,9 @@ var init_http = __esm({
2962
2962
  if (skipAssertionJudging !== true) {
2963
2963
  payload.judgeAssertions = true;
2964
2964
  }
2965
+ if (dryRun) {
2966
+ payload.dryRun = true;
2967
+ }
2965
2968
  const git = await resolvedGitState();
2966
2969
  if (git && !isEmptyGitState(git)) {
2967
2970
  payload.git = git;
@@ -2975,7 +2978,10 @@ var init_http = __esm({
2975
2978
  const { testRunId, testRunUrl, ...rest } = response;
2976
2979
  const experimentId = response.experimentId ?? testRunId;
2977
2980
  const experimentUrl = response.experimentUrl ?? testRunUrl;
2978
- if (experimentId === void 0 || experimentUrl === void 0) {
2981
+ if (dryRun && response.experimentId === null) {
2982
+ return { ...rest, experimentId: null, experimentUrl: null };
2983
+ }
2984
+ if (experimentId === void 0 || experimentId === null || experimentUrl === void 0 || experimentUrl === null) {
2979
2985
  throw new BitfabError(
2980
2986
  "Replay start response is missing the experiment ID or URL."
2981
2987
  );
@@ -4311,7 +4317,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4311
4317
  const originalTraceId = serverItem.originalTraceId ?? serverItem.sourceTraceId;
4312
4318
  const originalSpanId = serverItem.originalSpanId ?? serverItem.sourceSpanId;
4313
4319
  try {
4314
- if (includeDbBranchLease && !lease && !leaseError) {
4320
+ if (includeDbBranchLease && experimentId !== null && !lease && !leaseError) {
4315
4321
  let resolved2;
4316
4322
  try {
4317
4323
  resolved2 = await httpClient.resolveDbBranchLease(
@@ -4405,7 +4411,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4405
4411
  }
4406
4412
  return pending;
4407
4413
  } : void 0;
4408
- if (dryRun) {
4414
+ if (dryRun || experimentId === null) {
4409
4415
  return {
4410
4416
  traceId: null,
4411
4417
  originalTraceId,
@@ -4693,7 +4699,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4693
4699
  options?.skipAssertionJudging === true || options?.judgeAssertions === false,
4694
4700
  options?.experimentalSelectiveReplay,
4695
4701
  options?.notes,
4696
- options?.metadata
4702
+ options?.metadata,
4703
+ options?.dryRun === true
4697
4704
  );
4698
4705
  if (started.items.length === 0) {
4699
4706
  try {
@@ -4723,6 +4730,22 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4723
4730
  );
4724
4731
  }
4725
4732
  const { experimentId } = session;
4733
+ if (experimentId === null || session.experimentUrl === null) {
4734
+ return runReplaySession(
4735
+ httpClient,
4736
+ fn,
4737
+ session,
4738
+ null,
4739
+ maxConcurrency,
4740
+ () => {
4741
+ },
4742
+ () => {
4743
+ },
4744
+ () => false,
4745
+ options,
4746
+ registeredOverrides
4747
+ );
4748
+ }
4726
4749
  const fullExperimentUrl = `${serviceUrl}${session.experimentUrl}`;
4727
4750
  const heartbeat = startReplayHeartbeat(
4728
4751
  () => httpClient.heartbeatReplay(experimentId)
@@ -4784,12 +4807,14 @@ function throwIfInterrupted(interrupted, items, experimentId, experimentUrl) {
4784
4807
  async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxConcurrency, stopInterruptingOnSignal, markCompleteReturned, interrupted, options, registeredOverrides) {
4785
4808
  const { experimentId, attempts } = session;
4786
4809
  const mockStrategy = options?.mock ?? "marked";
4787
- try {
4788
- options?.onExperimentStart?.({
4789
- experimentId,
4790
- experimentUrl: fullExperimentUrl
4791
- });
4792
- } catch {
4810
+ if (experimentId !== null && fullExperimentUrl !== null) {
4811
+ try {
4812
+ options?.onExperimentStart?.({
4813
+ experimentId,
4814
+ experimentUrl: fullExperimentUrl
4815
+ });
4816
+ } catch {
4817
+ }
4793
4818
  }
4794
4819
  const resolvedOverrides = [
4795
4820
  ...normalizeMockOverrides(options?.mockOverride),
@@ -4931,17 +4956,18 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
4931
4956
  interrupted
4932
4957
  );
4933
4958
  const resultItems = [...carriedOverItems, ...ranItems];
4934
- throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4935
- if (options?.dryRun === true) {
4936
- throwIfInterrupted(
4937
- interrupted,
4938
- resultItems,
4939
- experimentId,
4940
- fullExperimentUrl
4941
- );
4942
- stopInterruptingOnSignal();
4943
- await httpClient.completeReplay(experimentId).catch(() => void 0);
4944
- markCompleteReturned();
4959
+ if (options?.dryRun === true || experimentId === null || fullExperimentUrl === null) {
4960
+ if (experimentId !== null && fullExperimentUrl !== null) {
4961
+ throwIfInterrupted(
4962
+ interrupted,
4963
+ resultItems,
4964
+ experimentId,
4965
+ fullExperimentUrl
4966
+ );
4967
+ stopInterruptingOnSignal();
4968
+ await httpClient.completeReplay(experimentId).catch(() => void 0);
4969
+ markCompleteReturned();
4970
+ }
4945
4971
  const dryResult = {
4946
4972
  items: resultItems,
4947
4973
  experimentId,
@@ -4953,6 +4979,7 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
4953
4979
  await writeReplayResultFile(dryResult);
4954
4980
  return dryResult;
4955
4981
  }
4982
+ throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4956
4983
  const deliveredTraceIds = await preserveReplayFailure(
4957
4984
  () => waitForReplayPersistence(httpClient, experimentId, replayedTraceIds),
4958
4985
  resultItems,