@quikit/quikpilot-runner 9.3.0-rc.45 → 9.3.0-rc.46

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
@@ -162,6 +162,8 @@ wrong (a field that arrives from a database row or a request), so it only warns
162
162
 
163
163
  **9.3.0-rc.45 — a changed test that still says the old behaviour is noted on the decision page (QUIKTR-1832).** On 25 Oct the approved proposal for the "logged-in users get 401" bug changed what a test expects (`toBe(401)` to `toBe(200)`) and left its title, "returns 401 when there's no bearer token at all", and a comment saying the old behaviour. The runner already lets a proposal change a test's title and comments, so it cannot refuse that; it now notices. For each changed test it takes the string and number values (numbers of three digits or more, or with a decimal point) that the edit removes, drops any the new test still uses in its own code or that the replacement itself writes, and checks whether one is still in the test's new title or in a comment inside it. When one is, the proposal commit gets a readable `Note:` line and an optional `stale` key (`tokens`, `inTitle`, `commentLines`, at most 4 values of 60 characters and 6 lines) on that test's machine-readable line; an older reader ignores it, and a line whose note is malformed is dropped like any other malformed line. It is a note for the person who approves, never a rejection, and nothing is added to the report back to QuikProjects. The AI Runtime of QUIKTR-1832 also asks the AI to change the title and comments in the same edit. Also in rc.45: everything in rc.44. Nothing else changes.
164
164
 
165
+ **9.3.0-rc.46 — the existing tests to read first include the ones that reach the code through one file in between (QUIKTR-1845).** On the live bug-6 run (QTRIA-17) the design changed `lib/services/issueFilters.ts`, and the two tests that assert the bug import `app/api/issues/route.ts`, which imports it, so the list of existing tests the AI reads before writing (`testsToCheck`, rc.44) was empty. When fewer than 3 test files are found by name or a direct import, the runner now takes one more step: of the files the tests import (code, not a test, not under a denied path; the 150 most shared first) it keeps the ones that import a changed file, and adds the tests that import them, after the others and up to 10 in all. A file in between imported by more than 12 tests only brings the tests named after it (a route by its folder) or after the changed file. Paths only, as before. With 3 or more found the list is exactly as in rc.45. Also in rc.46: everything in rc.45. Nothing else changes.
166
+
165
167
  **9.3.0-rc.42 — the review check runs only the related tests first (QUIKTR-1812).** After a change passes every check, each changed block is put back on its own to ask whether any test notices. Every one of those runs was the whole suite (on QuikIT about 4 min 50 s, so the 6-minute review checked one block in bug 5's run). Now, where the S4 planner trusts related tests (a suite of three minutes or more, a vitest project), a block's first run is only the tests related to its file: a related test that fails settles "needed" in tens of seconds; anything else goes on exactly as before (the whole suite, and once more before "unneeded"), so every verdict, warning and fix attempt is the same. Each related run gets no more than the time left before the review's deadline, a related run that took as long as the whole suite switches related runs off for the rest of the check, and the `hunk_check` line counts `relatedRuns` and `wholeRuns`. `QUIKPILOT_RELATED_TESTS=off` restores whole-suite runs. Nothing else changes.
166
168
 
167
169
  **9.3.0-rc.41 — a test written once for many rows is said plainly, and the run stops (QUIKTR-1823).** Live run QTRIA-12: after a person approved one test change, the fix broke `still rejects an unauthenticated request`, ONE test inside `describe.each` that runs for 11 routes. The AI reported it four times and was told `title_not_found` each time, because tests inside `describe.each` / `it.each` are left out of the title search on purpose (their names are made at run time); the AI had copied the title right, guessed the shape of its report was wrong, and gave up, and the run said only that the AI could not make the change. Now such a report is turned away with its own word, `generated_test`, whose message tells the AI to answer CANNOT_COMPLETE and name the test. However the loop then ends, it ends `test_conflict_unreportable`: no change is kept for the checks and no second attempt is made (it would meet the same test), and the run says where the test is and which case it contradicts (file, line, case id; never a title) and that a person must change that test or correct the case. If a report of another test stands, the run stops for a decision as before and warns about the generated test. A title in no test of the file is still `title_not_found`. Also in rc.41 (QUIKTR-1824): an answer the AI Service cut off at the output limit (`CODEGEN_OUTPUT_TOO_LARGE`, `OUTPUT_TRUNCATED`) ends the attempt `output_too_large`, "the AI's answer was too long and was cut off", in the code-writing and the targeting loops, instead of `runtime_failed`, "the AI service failed" (live run QTRIA-12: a turn wrote to the limit for 193 s). Every failed attempt keeps the AI Service's own error code in the run's record (`runtimeCode`, a closed word; `other` when it is not shaped like a code), and the run's message names it. Nothing else changes.
package/dist/index.js CHANGED
@@ -33697,6 +33697,9 @@ var MAX_TESTS_PER_TARGET = 3;
33697
33697
  var MAX_REVERSE_TEST_CHARS = 24e3;
33698
33698
  var MAX_TEST_FILE_CHARS = 2e5;
33699
33699
  var MAX_CORPUS_CHARS = 4e7;
33700
+ var MAX_FILES_IN_BETWEEN = 150;
33701
+ var COMMON_IMPORTER_LIMIT = 12;
33702
+ var ROUTE_FILE_NAMES = /* @__PURE__ */ new Set(["route", "page", "layout", "index", "default", "loading", "error"]);
33700
33703
  var TestCorpus = class {
33701
33704
  constructor(listing, readFile, deniedPaths, isTest = isTestTarget) {
33702
33705
  this.listing = listing;
@@ -33741,6 +33744,18 @@ function sharedPrefix(a, b) {
33741
33744
  while (n < x.length && n < y.length && x[n] === y[n]) n++;
33742
33745
  return n;
33743
33746
  }
33747
+ function namesOf(path) {
33748
+ const base = import_node_path7.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "").toLowerCase();
33749
+ const names = base.length >= 2 ? [base] : [];
33750
+ if (ROUTE_FILE_NAMES.has(base)) {
33751
+ const parts = import_node_path7.posix.dirname(path).split("/").filter(Boolean);
33752
+ while (parts.length > 0 && /^[[(]/.test(parts[parts.length - 1])) parts.pop();
33753
+ const folder = parts[parts.length - 1];
33754
+ if (folder && folder.length >= 3) names.push(folder.toLowerCase());
33755
+ }
33756
+ return names;
33757
+ }
33758
+ var namedAfter = (test, path) => namesOf(path).some((n) => import_node_path7.posix.basename(test).toLowerCase().startsWith(n));
33744
33759
  function testsImporting(p) {
33745
33760
  if (p.limit <= 0 || (p.isTest ?? isTestTarget)(p.target) || !supportsImportScan(p.target)) return [];
33746
33761
  const stem = stemOf(p.target);
@@ -33759,6 +33774,59 @@ function testsImporting(p) {
33759
33774
  hits.sort((a, b) => Number(b.named) - Number(a.named) || b.near - a.near || a.size - b.size || (a.path < b.path ? -1 : 1));
33760
33775
  return hits.slice(0, p.limit).map((h) => h.path);
33761
33776
  }
33777
+ function testsThroughOneFile(p) {
33778
+ const isTest = p.isTest ?? isTestTarget;
33779
+ if (p.limit <= 0 || isTest(p.target) || !supportsImportScan(p.target)) return [];
33780
+ const importsOf = /* @__PURE__ */ new Map();
33781
+ const shared = /* @__PURE__ */ new Map();
33782
+ for (const file of p.corpus.files()) {
33783
+ const seen = /* @__PURE__ */ new Set();
33784
+ for (const spec of extractImportSpecifiers(file.text)) {
33785
+ const r = resolveImport(file.path, spec, p.listing, p.mapSpecifier);
33786
+ if (r.kind === "repo" && r.path !== file.path) seen.add(r.path);
33787
+ }
33788
+ importsOf.set(file.path, seen);
33789
+ for (const q of seen) {
33790
+ if (q === p.target || isTest(q) || !supportsImportScan(q) || matchesDeniedPath(q, p.deniedPaths ?? [])) continue;
33791
+ shared.set(q, (shared.get(q) ?? 0) + 1);
33792
+ }
33793
+ }
33794
+ const between = [...shared.entries()].sort((a, b) => b[1] - a[1] || sharedPrefix(b[0], p.target) - sharedPrefix(a[0], p.target) || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)).slice(0, MAX_FILES_IN_BETWEEN).map(([q]) => q);
33795
+ const via = /* @__PURE__ */ new Set();
33796
+ for (const q of between) {
33797
+ let text2;
33798
+ try {
33799
+ text2 = p.readRel(q);
33800
+ } catch {
33801
+ text2 = null;
33802
+ }
33803
+ if (text2 === null || text2.length > MAX_TEST_FILE_CHARS) continue;
33804
+ const reaches = extractImportSpecifiers(text2).some((spec) => {
33805
+ const r = resolveImport(q, spec, p.listing, p.mapSpecifier);
33806
+ return r.kind === "repo" && r.path === p.target;
33807
+ });
33808
+ if (reaches) via.add(q);
33809
+ }
33810
+ if (via.size === 0) return [];
33811
+ const importers = /* @__PURE__ */ new Map();
33812
+ for (const [test, imports] of importsOf) {
33813
+ if (p.exclude?.has(test) || test === p.target || imports.has(p.target)) continue;
33814
+ for (const q of imports) if (via.has(q)) importers.set(q, [...importers.get(q) ?? [], test]);
33815
+ }
33816
+ const textOf = new Map(p.corpus.files().map((f) => [f.path, f.text]));
33817
+ const hits = /* @__PURE__ */ new Map();
33818
+ for (const [q, tests] of importers) {
33819
+ const common = tests.length > COMMON_IMPORTER_LIMIT;
33820
+ for (const test of tests) {
33821
+ const named = namedAfter(test, q) || namedAfter(test, p.target);
33822
+ if (common && !named) continue;
33823
+ const prev = hits.get(test);
33824
+ const near = sharedPrefix(test, q);
33825
+ hits.set(test, { path: test, named: named || (prev?.named ?? false), near: Math.max(near, prev?.near ?? 0), size: textOf.get(test)?.length ?? 0 });
33826
+ }
33827
+ }
33828
+ return [...hits.values()].sort((a, b) => Number(b.named) - Number(a.named) || b.near - a.near || a.size - b.size || (a.path < b.path ? -1 : 1)).slice(0, p.limit).map((h) => h.path);
33829
+ }
33762
33830
 
33763
33831
  // src/testAdapters.ts
33764
33832
  var import_node_fs9 = require("node:fs");
@@ -42430,6 +42498,7 @@ async function verifyOnOldCode(conflicts, run2, log = () => void 0) {
42430
42498
  var import_node_fs16 = require("node:fs");
42431
42499
  var import_node_path18 = require("node:path");
42432
42500
  var MAX_TESTS_TO_CHECK = 10;
42501
+ var SECOND_HOP_BELOW = 3;
42433
42502
  function testsToCheck(i2) {
42434
42503
  const limit = Math.min(MAX_TESTS_TO_CHECK, Math.max(0, i2.limit ?? MAX_TESTS_TO_CHECK));
42435
42504
  const world = buildTestWorld(i2);
@@ -42444,6 +42513,23 @@ function testsToCheck(i2) {
42444
42513
  for (const t of code) {
42445
42514
  for (const path of testsImporting({ target: t.path, listing: world.listing, corpus: world.corpus, mapSpecifier: world.mapSpecifier, limit, isTest: world.isTest })) add(path);
42446
42515
  }
42516
+ if (out.length < SECOND_HOP_BELOW) {
42517
+ for (const t of code) {
42518
+ const exclude = new Set(out);
42519
+ for (const path of testsThroughOneFile({
42520
+ target: t.path,
42521
+ listing: world.listing,
42522
+ corpus: world.corpus,
42523
+ mapSpecifier: world.mapSpecifier,
42524
+ limit,
42525
+ isTest: world.isTest,
42526
+ exclude,
42527
+ readRel: i2.readRel,
42528
+ deniedPaths: i2.deniedPaths
42529
+ }))
42530
+ add(path);
42531
+ }
42532
+ }
42447
42533
  return out;
42448
42534
  }
42449
42535
  var readFromRoot = (root) => (rel) => {
@@ -44725,7 +44811,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
44725
44811
  var REPORT_COPY = "final-test-report.xml";
44726
44812
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
44727
44813
  var MAX_FILES = 200;
44728
- var RUNNER_VERSION = true ? "9.3.0-rc.45" : "dev";
44814
+ var RUNNER_VERSION = true ? "9.3.0-rc.46" : "dev";
44729
44815
  function safeDestination(base, repoPath) {
44730
44816
  if (!repoPath || (0, import_node_path24.isAbsolute)(repoPath)) return null;
44731
44817
  const destination = (0, import_node_path24.resolve)(base, repoPath);