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
package/dist/index.d.cts CHANGED
@@ -697,7 +697,7 @@ declare class HttpClient {
697
697
  * Start a replay session by fetching historical traces.
698
698
  * Blocking call - creates an experiment and returns lightweight item references.
699
699
  */
700
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, skipAssertionJudging?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions, notes?: string, metadata?: Record<string, string>): Promise<StartReplayResponse>;
700
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, skipAssertionJudging?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions, notes?: string, metadata?: Record<string, string>, dryRun?: boolean): Promise<StartReplayResponse>;
701
701
  resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
702
702
  /**
703
703
  * Fetch an external span by ID.
@@ -774,8 +774,9 @@ interface CodeChangeFile {
774
774
  after: string;
775
775
  }
776
776
  interface StartReplayResponse {
777
- experimentId: string;
778
- experimentUrl: string;
777
+ /** Null for a dry run, which the server records no experiment for. */
778
+ experimentId: string | null;
779
+ experimentUrl: string | null;
779
780
  attempts?: number;
780
781
  items: Array<{
781
782
  selectiveReplayPlan?: SelectiveReplayPlan;
@@ -2251,7 +2252,9 @@ interface ReplayOptions {
2251
2252
  * Selection, span fetch, deserialization, and `adaptInputs` all run, so each
2252
2253
  * item reports the exact arguments the function would have received. Nothing
2253
2254
  * executes and no replay traces are produced, which is the cheap way to check
2254
- * that recorded inputs still fit the current signature.
2255
+ * that recorded inputs still fit the current signature. No experiment is
2256
+ * created either, so the result's `experimentId` and `experimentUrl` are null
2257
+ * and `onExperimentStart` is not called.
2255
2258
  */
2256
2259
  dryRun?: boolean;
2257
2260
  /**
@@ -2301,10 +2304,10 @@ interface ReplayExperiment {
2301
2304
  /** Emitted through {@link ReplayOptions.onItemStart} when a worker starts an item. */
2302
2305
  interface ReplayItemStartProgress {
2303
2306
  type: "started";
2304
- /** Experiment ID created for this replay. */
2305
- experimentId: string;
2307
+ /** Experiment ID created for this replay. Null for a dry run, which creates none. */
2308
+ experimentId: string | null;
2306
2309
  /** @deprecated Use {@link experimentId}. Same value. */
2307
- testRunId: string;
2310
+ testRunId: string | null;
2308
2311
  /** Items whose processing has started so far. */
2309
2312
  started: number;
2310
2313
  /** Items that have finished so far, whether they succeeded or errored. */
@@ -2330,10 +2333,10 @@ interface ReplayItemStartProgress {
2330
2333
  interface ReplayItemFinishProgress {
2331
2334
  /** Event kind, omitted for backward-compatible per-item events. */
2332
2335
  type?: "item";
2333
- /** Experiment ID created for this replay. */
2334
- experimentId: string;
2336
+ /** Experiment ID created for this replay. Null for a dry run, which creates none. */
2337
+ experimentId: string | null;
2335
2338
  /** @deprecated Use {@link experimentId}. Same value. */
2336
- testRunId: string;
2339
+ testRunId: string | null;
2337
2340
  /** Items that have finished so far, whether they succeeded or errored. */
2338
2341
  completed: number;
2339
2342
  /** Total number of items in this replay run. */
@@ -2401,9 +2404,10 @@ interface ReplayProgressItem {
2401
2404
  interface ReplayProgress {
2402
2405
  type?: "item" | "complete";
2403
2406
  result?: ReplayResult<unknown>;
2404
- experimentId?: string;
2407
+ /** Null for a dry run, which creates no experiment. */
2408
+ experimentId?: string | null;
2405
2409
  /** @deprecated Use {@link experimentId}. Same value. */
2406
- testRunId?: string;
2410
+ testRunId?: string | null;
2407
2411
  completed: number;
2408
2412
  total: number;
2409
2413
  succeeded: number;
@@ -2553,14 +2557,17 @@ interface ReplayItem<T> {
2553
2557
  interface ReplayResult<T> {
2554
2558
  /** Individual replay items with inputs, results, and comparison data. */
2555
2559
  items: ReplayItem<T>[];
2556
- /** The experiment ID created on the server. */
2557
- experimentId: string;
2558
- /** Full URL to view the experiment in the dashboard. */
2559
- experimentUrl: string;
2560
+ /**
2561
+ * The experiment ID created on the server. Null for a dry run, which
2562
+ * executes nothing and so creates no experiment.
2563
+ */
2564
+ experimentId: string | null;
2565
+ /** Full URL to view the experiment in the dashboard. Null for a dry run. */
2566
+ experimentUrl: string | null;
2560
2567
  /** @deprecated Use {@link experimentId}. Same value. */
2561
- testRunId: string;
2568
+ testRunId: string | null;
2562
2569
  /** @deprecated Use {@link experimentUrl}. Same value. */
2563
- testRunUrl: string;
2570
+ testRunUrl: string | null;
2564
2571
  attempts: number;
2565
2572
  }
2566
2573
  /**
@@ -3973,7 +3980,7 @@ interface CommitRef {
3973
3980
  /**
3974
3981
  * SDK version from package.json (injected at build time)
3975
3982
  */
3976
- declare const __version__ = "0.63.0";
3983
+ declare const __version__ = "0.63.2";
3977
3984
 
3978
3985
  /**
3979
3986
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -697,7 +697,7 @@ declare class HttpClient {
697
697
  * Start a replay session by fetching historical traces.
698
698
  * Blocking call - creates an experiment and returns lightweight item references.
699
699
  */
700
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, skipAssertionJudging?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions, notes?: string, metadata?: Record<string, string>): Promise<StartReplayResponse>;
700
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, skipAssertionJudging?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions, notes?: string, metadata?: Record<string, string>, dryRun?: boolean): Promise<StartReplayResponse>;
701
701
  resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
702
702
  /**
703
703
  * Fetch an external span by ID.
@@ -774,8 +774,9 @@ interface CodeChangeFile {
774
774
  after: string;
775
775
  }
776
776
  interface StartReplayResponse {
777
- experimentId: string;
778
- experimentUrl: string;
777
+ /** Null for a dry run, which the server records no experiment for. */
778
+ experimentId: string | null;
779
+ experimentUrl: string | null;
779
780
  attempts?: number;
780
781
  items: Array<{
781
782
  selectiveReplayPlan?: SelectiveReplayPlan;
@@ -2251,7 +2252,9 @@ interface ReplayOptions {
2251
2252
  * Selection, span fetch, deserialization, and `adaptInputs` all run, so each
2252
2253
  * item reports the exact arguments the function would have received. Nothing
2253
2254
  * executes and no replay traces are produced, which is the cheap way to check
2254
- * that recorded inputs still fit the current signature.
2255
+ * that recorded inputs still fit the current signature. No experiment is
2256
+ * created either, so the result's `experimentId` and `experimentUrl` are null
2257
+ * and `onExperimentStart` is not called.
2255
2258
  */
2256
2259
  dryRun?: boolean;
2257
2260
  /**
@@ -2301,10 +2304,10 @@ interface ReplayExperiment {
2301
2304
  /** Emitted through {@link ReplayOptions.onItemStart} when a worker starts an item. */
2302
2305
  interface ReplayItemStartProgress {
2303
2306
  type: "started";
2304
- /** Experiment ID created for this replay. */
2305
- experimentId: string;
2307
+ /** Experiment ID created for this replay. Null for a dry run, which creates none. */
2308
+ experimentId: string | null;
2306
2309
  /** @deprecated Use {@link experimentId}. Same value. */
2307
- testRunId: string;
2310
+ testRunId: string | null;
2308
2311
  /** Items whose processing has started so far. */
2309
2312
  started: number;
2310
2313
  /** Items that have finished so far, whether they succeeded or errored. */
@@ -2330,10 +2333,10 @@ interface ReplayItemStartProgress {
2330
2333
  interface ReplayItemFinishProgress {
2331
2334
  /** Event kind, omitted for backward-compatible per-item events. */
2332
2335
  type?: "item";
2333
- /** Experiment ID created for this replay. */
2334
- experimentId: string;
2336
+ /** Experiment ID created for this replay. Null for a dry run, which creates none. */
2337
+ experimentId: string | null;
2335
2338
  /** @deprecated Use {@link experimentId}. Same value. */
2336
- testRunId: string;
2339
+ testRunId: string | null;
2337
2340
  /** Items that have finished so far, whether they succeeded or errored. */
2338
2341
  completed: number;
2339
2342
  /** Total number of items in this replay run. */
@@ -2401,9 +2404,10 @@ interface ReplayProgressItem {
2401
2404
  interface ReplayProgress {
2402
2405
  type?: "item" | "complete";
2403
2406
  result?: ReplayResult<unknown>;
2404
- experimentId?: string;
2407
+ /** Null for a dry run, which creates no experiment. */
2408
+ experimentId?: string | null;
2405
2409
  /** @deprecated Use {@link experimentId}. Same value. */
2406
- testRunId?: string;
2410
+ testRunId?: string | null;
2407
2411
  completed: number;
2408
2412
  total: number;
2409
2413
  succeeded: number;
@@ -2553,14 +2557,17 @@ interface ReplayItem<T> {
2553
2557
  interface ReplayResult<T> {
2554
2558
  /** Individual replay items with inputs, results, and comparison data. */
2555
2559
  items: ReplayItem<T>[];
2556
- /** The experiment ID created on the server. */
2557
- experimentId: string;
2558
- /** Full URL to view the experiment in the dashboard. */
2559
- experimentUrl: string;
2560
+ /**
2561
+ * The experiment ID created on the server. Null for a dry run, which
2562
+ * executes nothing and so creates no experiment.
2563
+ */
2564
+ experimentId: string | null;
2565
+ /** Full URL to view the experiment in the dashboard. Null for a dry run. */
2566
+ experimentUrl: string | null;
2560
2567
  /** @deprecated Use {@link experimentId}. Same value. */
2561
- testRunId: string;
2568
+ testRunId: string | null;
2562
2569
  /** @deprecated Use {@link experimentUrl}. Same value. */
2563
- testRunUrl: string;
2570
+ testRunUrl: string | null;
2564
2571
  attempts: number;
2565
2572
  }
2566
2573
  /**
@@ -3973,7 +3980,7 @@ interface CommitRef {
3973
3980
  /**
3974
3981
  * SDK version from package.json (injected at build time)
3975
3982
  */
3976
- declare const __version__ = "0.63.0";
3983
+ declare const __version__ = "0.63.2";
3977
3984
 
3978
3985
  /**
3979
3986
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  getCurrentTrace,
37
37
  reseedFromRegistry,
38
38
  seedFromRegistry
39
- } from "./chunk-KI2TAU36.js";
39
+ } from "./chunk-ZRZDSP2R.js";
40
40
  import "./chunk-YWXQM6J3.js";
41
41
  import {
42
42
  BITFAB_PROGRESS_PREFIX,
@@ -45,7 +45,7 @@ import {
45
45
  ReplayError,
46
46
  reportReplayProgress,
47
47
  serializeReplayResult
48
- } from "./chunk-TTWRFQPU.js";
48
+ } from "./chunk-NZCQ5TG4.js";
49
49
  import {
50
50
  BitfabError,
51
51
  DEFAULT_SERVICE_URL,
@@ -53,7 +53,7 @@ import {
53
53
  MixedTracingError,
54
54
  __version__,
55
55
  flushTraces
56
- } from "./chunk-NUMYG5MD.js";
56
+ } from "./chunk-3D67XMAO.js";
57
57
  import "./chunk-MT36GJMW.js";
58
58
  export {
59
59
  AssertionCategoriesClient,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.63.0";
100
+ __version__ = "0.63.2";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -2911,7 +2911,7 @@ var init_http = __esm({
2911
2911
  * Start a replay session by fetching historical traces.
2912
2912
  * Blocking call - creates an experiment and returns lightweight item references.
2913
2913
  */
2914
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata) {
2914
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, skipAssertionJudging, experimentalSelectiveReplay, notes, metadata, dryRun) {
2915
2915
  const payload = { traceFunctionKey };
2916
2916
  if (experimentalSelectiveReplay !== void 0) {
2917
2917
  payload.experimentalSelectiveReplay = experimentalSelectiveReplay;
@@ -2969,6 +2969,9 @@ var init_http = __esm({
2969
2969
  if (skipAssertionJudging !== true) {
2970
2970
  payload.judgeAssertions = true;
2971
2971
  }
2972
+ if (dryRun) {
2973
+ payload.dryRun = true;
2974
+ }
2972
2975
  const git = await resolvedGitState();
2973
2976
  if (git && !isEmptyGitState(git)) {
2974
2977
  payload.git = git;
@@ -2982,7 +2985,10 @@ var init_http = __esm({
2982
2985
  const { testRunId, testRunUrl, ...rest } = response;
2983
2986
  const experimentId = response.experimentId ?? testRunId;
2984
2987
  const experimentUrl = response.experimentUrl ?? testRunUrl;
2985
- if (experimentId === void 0 || experimentUrl === void 0) {
2988
+ if (dryRun && response.experimentId === null) {
2989
+ return { ...rest, experimentId: null, experimentUrl: null };
2990
+ }
2991
+ if (experimentId === void 0 || experimentId === null || experimentUrl === void 0 || experimentUrl === null) {
2986
2992
  throw new BitfabError(
2987
2993
  "Replay start response is missing the experiment ID or URL."
2988
2994
  );
@@ -4318,7 +4324,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4318
4324
  const originalTraceId = serverItem.originalTraceId ?? serverItem.sourceTraceId;
4319
4325
  const originalSpanId = serverItem.originalSpanId ?? serverItem.sourceSpanId;
4320
4326
  try {
4321
- if (includeDbBranchLease && !lease && !leaseError) {
4327
+ if (includeDbBranchLease && experimentId !== null && !lease && !leaseError) {
4322
4328
  let resolved2;
4323
4329
  try {
4324
4330
  resolved2 = await httpClient.resolveDbBranchLease(
@@ -4412,7 +4418,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
4412
4418
  }
4413
4419
  return pending;
4414
4420
  } : void 0;
4415
- if (dryRun) {
4421
+ if (dryRun || experimentId === null) {
4416
4422
  return {
4417
4423
  traceId: null,
4418
4424
  originalTraceId,
@@ -4700,7 +4706,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4700
4706
  options?.skipAssertionJudging === true || options?.judgeAssertions === false,
4701
4707
  options?.experimentalSelectiveReplay,
4702
4708
  options?.notes,
4703
- options?.metadata
4709
+ options?.metadata,
4710
+ options?.dryRun === true
4704
4711
  );
4705
4712
  if (started.items.length === 0) {
4706
4713
  try {
@@ -4730,6 +4737,22 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4730
4737
  );
4731
4738
  }
4732
4739
  const { experimentId } = session;
4740
+ if (experimentId === null || session.experimentUrl === null) {
4741
+ return runReplaySession(
4742
+ httpClient,
4743
+ fn,
4744
+ session,
4745
+ null,
4746
+ maxConcurrency,
4747
+ () => {
4748
+ },
4749
+ () => {
4750
+ },
4751
+ () => false,
4752
+ options,
4753
+ registeredOverrides
4754
+ );
4755
+ }
4733
4756
  const fullExperimentUrl = `${serviceUrl}${session.experimentUrl}`;
4734
4757
  const heartbeat = startReplayHeartbeat(
4735
4758
  () => httpClient.heartbeatReplay(experimentId)
@@ -4791,12 +4814,14 @@ function throwIfInterrupted(interrupted, items, experimentId, experimentUrl) {
4791
4814
  async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxConcurrency, stopInterruptingOnSignal, markCompleteReturned, interrupted, options, registeredOverrides) {
4792
4815
  const { experimentId, attempts } = session;
4793
4816
  const mockStrategy = options?.mock ?? "marked";
4794
- try {
4795
- options?.onExperimentStart?.({
4796
- experimentId,
4797
- experimentUrl: fullExperimentUrl
4798
- });
4799
- } catch {
4817
+ if (experimentId !== null && fullExperimentUrl !== null) {
4818
+ try {
4819
+ options?.onExperimentStart?.({
4820
+ experimentId,
4821
+ experimentUrl: fullExperimentUrl
4822
+ });
4823
+ } catch {
4824
+ }
4800
4825
  }
4801
4826
  const resolvedOverrides = [
4802
4827
  ...normalizeMockOverrides(options?.mockOverride),
@@ -4938,17 +4963,18 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
4938
4963
  interrupted
4939
4964
  );
4940
4965
  const resultItems = [...carriedOverItems, ...ranItems];
4941
- throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4942
- if (options?.dryRun === true) {
4943
- throwIfInterrupted(
4944
- interrupted,
4945
- resultItems,
4946
- experimentId,
4947
- fullExperimentUrl
4948
- );
4949
- stopInterruptingOnSignal();
4950
- await httpClient.completeReplay(experimentId).catch(() => void 0);
4951
- markCompleteReturned();
4966
+ if (options?.dryRun === true || experimentId === null || fullExperimentUrl === null) {
4967
+ if (experimentId !== null && fullExperimentUrl !== null) {
4968
+ throwIfInterrupted(
4969
+ interrupted,
4970
+ resultItems,
4971
+ experimentId,
4972
+ fullExperimentUrl
4973
+ );
4974
+ stopInterruptingOnSignal();
4975
+ await httpClient.completeReplay(experimentId).catch(() => void 0);
4976
+ markCompleteReturned();
4977
+ }
4952
4978
  const dryResult = {
4953
4979
  items: resultItems,
4954
4980
  experimentId,
@@ -4960,6 +4986,7 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
4960
4986
  await writeReplayResultFile(dryResult);
4961
4987
  return dryResult;
4962
4988
  }
4989
+ throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4963
4990
  const deliveredTraceIds = await preserveReplayFailure(
4964
4991
  () => waitForReplayPersistence(httpClient, experimentId, replayedTraceIds),
4965
4992
  resultItems,