@feigi/fleet-ctl 3.20.0 → 3.21.0

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.
@@ -57,17 +57,26 @@ export const vote = (refuted) => ({ refuted, reason: "measured. CWD-AUDIT: clean
57
57
  // 2 of their label, and a re-dispatched pair is calls 3 and 4. A script with
58
58
  // no `test-run` entry gets `[SHARED]` for it; every other unscripted label
59
59
  // throws. `prompts` records each dispatch's prompt under its label.
60
+ //
61
+ // Every label review-core.mjs dispatches ends in `:pr<N>`; scripts, `calls`
62
+ // and `prompts` key on the label WITHOUT it (`review:correctness`), so a case
63
+ // reads the same whatever PR it reviews. `labels` keeps each label as
64
+ // dispatched, in order.
60
65
  export function scriptedHost(script) {
61
66
  const calls = {};
62
67
  const prompts = {};
68
+ const labels = [];
63
69
  return {
64
70
  calls,
65
71
  prompts,
72
+ labels,
66
73
  host: {
67
74
  agent: async (prompt, opts) => {
68
- const n = (calls[opts.label] = (calls[opts.label] ?? 0) + 1);
69
- (prompts[opts.label] ??= []).push(prompt);
70
- const seq = script[opts.label] ?? (opts.label === "test-run" ? [SHARED] : undefined);
75
+ labels.push(opts.label);
76
+ const label = opts.label.replace(/:pr\d+$/, "");
77
+ const n = (calls[label] = (calls[label] ?? 0) + 1);
78
+ (prompts[label] ??= []).push(prompt);
79
+ const seq = script[label] ?? (label === "test-run" ? [SHARED] : undefined);
71
80
  if (!seq) throw new Error(`scriptedHost: unexpected dispatch ${opts.label}`);
72
81
  const answer = seq[Math.min(n, seq.length) - 1];
73
82
  if (answer instanceof Error) throw answer;
@@ -128,10 +128,10 @@ for (const [name, run] of COPIES) {
128
128
  const calls = { crashing: 0, surviving: 0 };
129
129
  const host = {
130
130
  agent: async (prompt, opts) => {
131
- if (opts.label === "snapshot") return structuredClone(SNAP);
132
- if (opts.label === "test-run") return structuredClone(SHARED);
133
- if (opts.label === "review:correctness") return structuredClone(review([crashing, surviving]));
134
- if (opts.label === "verify:correctness") {
131
+ if (opts.label === "snapshot:pr7") return structuredClone(SNAP);
132
+ if (opts.label === "test-run:pr7") return structuredClone(SHARED);
133
+ if (opts.label === "review:correctness:pr7") return structuredClone(review([crashing, surviving]));
134
+ if (opts.label === "verify:correctness:pr7") {
135
135
  if (prompt.includes(crashing.claim)) {
136
136
  calls.crashing++;
137
137
  throw new Error(`refuter crash ${calls.crashing}`);
@@ -567,8 +567,8 @@ test("an unresolvable override is refused before the snapshot agent is dispatche
567
567
  // dispatch. Comment lines are stripped so a commented-out option cannot satisfy
568
568
  // it, and the slice is the review dispatch's options object alone.
569
569
  function reviewDispatchOptions() {
570
- const m = SOURCE.match(/\{ label: `review:\$\{d\.key\}`[^\n]*\},/);
571
- assert.ok(m, "review-core.mjs no longer passes an options object labelled review:${d.key} — update this test");
570
+ const m = SOURCE.match(/\{ label: `review:\$\{d\.key\}\$\{forPr\}`[^\n]*\},/);
571
+ assert.ok(m, "review-core.mjs no longer passes an options object labelled review:${d.key}${forPr} — update this test");
572
572
  return m[0]
573
573
  .split("\n")
574
574
  .filter((l) => !/^\s*\/\//.test(l))