@quikit/quikpilot-runner 9.3.0-rc.24 → 9.3.0-rc.25

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.
package/README.md CHANGED
@@ -150,6 +150,8 @@ it, the callback carries it as `unsuppliedInputs` (at most 10 functions, 5 names
150
150
  noticed" as a check. This is the shape of a change whose new tests pass only because they hand the function the field themselves. It can be
151
151
  wrong (a field that arrives from a database row or a request), so it only warns and never blocks. TypeScript is not covered (QUIKTR-1547).
152
152
 
153
+ **9.3.0-rc.25 — a corrected test must still show the bug (QUIKTR-1608, live run QUIKSPL-220).** On rc.24 the code phase of Bug 4 could not fix the bug and gave up with exactly one frozen test failing: the one test that proved the bug. The one correction, kept to that test's expected value as rc.24 requires, made it expect what the old code returns, so every test passed and PR #118 fixed nothing. After the correction the runner now runs the tests twice on the code before any change, once with the test as phase 1 froze it and once corrected (its own check, outside the AI's allowances; log `codegen.amend_old_code`). A test that failed there before its correction and passes after it no longer shows the bug: the run fails `test_case_disagree` and no pull request is opened. A test that passed on the old code by design is not held to it, and when either run gives no answer the correction stands. Runner only.
154
+
153
155
  **9.3.0-rc.24 — cases that must keep working, a tighter amendment, and a stop for loops that change nothing (QUIKTR-1608, live batch of 15 Oct).** On rc.23 no pull request of bugs 1 to 7 was fully right. Six bugs had an approved case that passes on the old code by design ("splits that already divide cleanly must not change"); the red check told the AI to make it fail, and the AI broke a correct test. (1) Phase 1's DONE is sent back once, not twice, and the sentence says a case that must keep working may stay as it is; the second DONE is accepted and the reviewer warned about the cases seen passing. A phase-1 give-up with at least one own test failing on the untouched code is phase 1 done, the passing ones warned the same way. (2) A phase-2 DONE whose latest run still fails a frozen test is handed over as a give-up (live run QUIKSPL-210). (3) The amendment runs only when exactly one frozen test fails (QUIKSPL-209 rewrote three to match wrong code), and afterwards the runner checks that only that test's expected values changed: its set-up, its inputs and the rest of the file must be as phase 2 left them, or the run fails `test_case_disagree`. (4) Under the harness version, three replies in a row that change nothing (repeats, no-op or missed edits, unchanged test runs) make the next turn the last (`no_progress`). The AI Runtime's three phase paragraphs (contract §33.6) say the same; deploy them first.
154
156
 
155
157
  **9.3.0-rc.23 — the red check counts one-file runs (QUIKTR-1608, live run QUIKSPL-208).** On rc.22 the first two-phase run opened a correct pull request (#112), but phase 1 proved the bug with a run of its test file (4 failing on the old code), the red check counted whole-suite runs only, sent the DONE back twice and ended phase 1 marked 5 cases unproven, so the reviewer was wrongly warned. Every run of phase 1 is now evidence, with the change it ran on: a case is FAILING when a run on the change as it stands lists its test failing; PASSING when such a run covered its test (the whole suite, or the one file that holds its `[QP-...]` token) and it did not fail; NOT RUN when nothing covered it. A test seen passing is sent back as before; one not run is sent back with a sentence naming it, and if phase 1 ends anyway it is logged (`ended_unrun`) but never shown to the reviewer as unproven: only a test seen passing on the old code is. A cut failing list still cannot tell. The next phase is told about the latest run on the change as it stands, a one-file run included. Runner only.
package/dist/index.js CHANGED
@@ -14812,11 +14812,31 @@ async function runPhases(i2) {
14812
14812
  disagree.summary = d3.summary;
14813
14813
  return { failure: recorded(disagree, "amend"), tests, phases, final: true };
14814
14814
  }
14815
+ const stillShowsBug = await oldCodeVerdict(i2, tests.results, path, textOf(d3.results), token);
14816
+ if (stillShowsBug === false) {
14817
+ phases.push(record("amend", "failed", d3.summary));
14818
+ i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "amend", outcome: "failed", why: "passes_on_old_code" });
14819
+ const disagree = new CodegenLoopFailure("test_case_disagree", void 0, void 0, `after its correction ${token} passes on the code before the change, so it no longer shows the bug`);
14820
+ disagree.summary = d3.summary;
14821
+ return { failure: recorded(disagree, "amend"), tests, phases, final: true };
14822
+ }
14815
14823
  phases.push(record("amend", "finished", d3.summary));
14816
14824
  summaries.push({ phase: "amend", summary: d3.summary });
14817
14825
  i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "amend", outcome: "finished" });
14818
14826
  return { done: d3, tests, phases, summaries, amended: amend };
14819
14827
  }
14828
+ async function oldCodeVerdict(i2, frozenTests, path, corrected, token) {
14829
+ if (!i2.onOldCode) return null;
14830
+ const fails = (answer) => answer === null || answer.timedOut || answer.truncated ? null : answer.failingTests.some((name) => name.includes(token));
14831
+ const before = fails(await i2.onOldCode(frozenTests));
14832
+ if (before !== true) {
14833
+ i2.log({ event: "codegen.amend_old_code", attempt: i2.attempt, before, after: null });
14834
+ return null;
14835
+ }
14836
+ const after = fails(await i2.onOldCode(frozenTests.map((r) => r.targetPath === path ? { targetPath: path, newContent: corrected } : r)));
14837
+ i2.log({ event: "codegen.amend_old_code", attempt: i2.attempt, before, after });
14838
+ return after === null ? null : after;
14839
+ }
14820
14840
  function mergePhaseSummaries(parts, phases) {
14821
14841
  const last = parts[parts.length - 1].summary;
14822
14842
  const edits = /* @__PURE__ */ new Map();
@@ -15278,6 +15298,22 @@ function lose(p, summary, attempts, stop) {
15278
15298
  p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop, attempts });
15279
15299
  return new CodegenAttemptsExhausted(attempts, stop);
15280
15300
  }
15301
+ function oldCodeRunner(args, log, now) {
15302
+ return async (files) => {
15303
+ const disk = files.map((r) => ({ path: r.targetPath, content: r.newContent }));
15304
+ const tool = new RunTestsTool({
15305
+ ...args.tests,
15306
+ requiredAutomationIds: args.requiredAutomationIds,
15307
+ harness: true,
15308
+ overlayFiles: () => disk,
15309
+ overlayVersion: () => versionOfFiles(disk),
15310
+ log: (e) => log({ ...e, event: "codegen.old_code_run" }),
15311
+ now
15312
+ });
15313
+ const answer = await tool.execute("old-code");
15314
+ return isTestAnswer(answer.output) ? answer.output : null;
15315
+ };
15316
+ }
15281
15317
  async function runCodegenStep(p) {
15282
15318
  if (p.mode !== "loop" && p.mode !== "loop-tests") return perFile(p);
15283
15319
  const testSetup = p.mode === "loop-tests" ? p.tests : void 0;
@@ -15321,6 +15357,7 @@ async function runCodegenStep(p) {
15321
15357
  testPaths: testTargetPaths(p.targets),
15322
15358
  redCheckIds: checkableIds(args.requiredAutomationIds, p.requiredTestTypes),
15323
15359
  run: (a) => runCodegenLoop(a, loopDeps),
15360
+ ...args.tests ? { onOldCode: oldCodeRunner(args, log, now) } : {},
15324
15361
  log
15325
15362
  });
15326
15363
  if ("failure" in phased) {
@@ -16639,7 +16676,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
16639
16676
  var REPORT_COPY = "final-test-report.xml";
16640
16677
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
16641
16678
  var MAX_FILES = 200;
16642
- var RUNNER_VERSION = true ? "9.3.0-rc.24" : "dev";
16679
+ var RUNNER_VERSION = true ? "9.3.0-rc.25" : "dev";
16643
16680
  function safeDestination(base, repoPath) {
16644
16681
  if (!repoPath || (0, import_node_path15.isAbsolute)(repoPath)) return null;
16645
16682
  const destination = (0, import_node_path15.resolve)(base, repoPath);