bitfab 0.62.6 → 0.62.7

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BitfabError
3
- } from "./chunk-PIEBUHL2.js";
3
+ } from "./chunk-ALEQLDHW.js";
4
4
 
5
5
  // src/codeChange.ts
6
6
  var NUL = String.fromCharCode(0);
@@ -101,6 +101,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
101
101
  "--no-db-branch",
102
102
  "--no-code-change",
103
103
  "--dry-run",
104
+ "--fail-on-error",
104
105
  "--force"
105
106
  ]);
106
107
  var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
@@ -195,6 +196,7 @@ Options:
195
196
  --mock none|all|marked
196
197
  --db-branch, --no-db-branch
197
198
  --dry-run (resolve inputs, run nothing)
199
+ --fail-on-error (exit 1 after printing the result when any replayed item errored; under --dry-run, items whose inputs failed to resolve count)
198
200
  --resume EXPERIMENT_ID (finish an experiment that stopped partway, running only the items it did not finish, with the traces, attempts, and graders it started with)
199
201
  --force (with --resume, resume even when the experiment may still be running or the code changed since it started)
200
202
  --params PATH
@@ -277,7 +279,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
277
279
  sessionId: seedCase.sessionId
278
280
  })
279
281
  );
280
- const { flushTraces: flushTraces2 } = await import("./http-OF2227WS.js");
282
+ const { flushTraces: flushTraces2 } = await import("./http-M63AQ3XH.js");
281
283
  await flushTraces2(3e4);
282
284
  return { pipeline, traceFunctionKey, traceIds };
283
285
  }
@@ -400,6 +402,9 @@ function parseReplayCliArgs(registry, argv) {
400
402
  case "--dry-run":
401
403
  parsed.dryRun = true;
402
404
  break;
405
+ case "--fail-on-error":
406
+ parsed.failOnError = true;
407
+ break;
403
408
  case "--force":
404
409
  parsed.force = true;
405
410
  break;
@@ -652,6 +657,13 @@ function renderSummary(pipeline, result, stderr) {
652
657
  stderr(`
653
658
  ${result.experimentUrl}`);
654
659
  }
660
+ function countErroredItems(result) {
661
+ const replayed = result.items.filter((item) => item.carriedOver !== true);
662
+ return {
663
+ errored: replayed.filter((item) => item.error !== null).length,
664
+ replayed: replayed.length
665
+ };
666
+ }
655
667
  function renderDryRun(pipeline, result, stderr) {
656
668
  stderr("\n\u2500\u2500\u2500 Dry run \u2500\u2500\u2500");
657
669
  stderr(` Pipeline: ${pipeline}`);
@@ -825,6 +837,14 @@ async function runReplayCli(registry, argv = typeof process === "undefined" ? []
825
837
  `No traces matched "${traceFunctionKey}", so nothing was replayed. Seed cases with --seed, or capture a trace first.`
826
838
  );
827
839
  }
840
+ if (args.failOnError === true) {
841
+ const { errored, replayed } = countErroredItems(result);
842
+ if (errored > 0) {
843
+ throw new BitfabError(
844
+ `[replay] ${errored} of ${replayed} ${args.dryRun === true ? "resolved" : "replayed"} items errored; exiting 1 because of --fail-on-error`
845
+ );
846
+ }
847
+ }
828
848
  return result;
829
849
  }
830
850
 
@@ -920,4 +940,4 @@ export {
920
940
  runRegistryMain,
921
941
  runIfEntrypoint
922
942
  };
923
- //# sourceMappingURL=chunk-LXTDXWNK.js.map
943
+ //# sourceMappingURL=chunk-DAHOCXKQ.js.map