@quikit/quikpilot-runner 9.3.0-rc.60 → 9.3.0-rc.61

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
@@ -165,8 +165,10 @@ wrong (a field that arrives from a database row or a request), so it only warns
165
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
166
 
167
167
  **9.3.0-rc.59 - a throwaway test, run once, its output shown (QUIKTR-1702, contract section 44 `codegen-loop-9`).** Before it writes an expected value the AI sometimes needs to SEE what the code really returns. `call_function` could show it, but only for a plain .js file, one function and plain data, on our own repositories: nothing for a Go, Python or Java project. The new tool `run_scratch {path, content}` has the AI name a NEW test file (named the way the project names its tests, in a folder that exists, never a file that exists) and give its text. The runner writes it next to the AI's changes, runs the space's own "Test one file" command on it once (`commands.testFile`, the path quoted, the same environment allow-list, credential scrub and process-group kill as `run_tests`, 60 seconds), puts the checkout back exactly, and answers with ONE string: `exit N`, then the END of what the run printed (stdout and stderr together, colour codes removed, credentials scrubbed, at most 2,000 characters in all). The AI supplies a file and its text, never what runs it: no command, no interpreter, no flag. The scratch file goes to disk through the overlay window as one extra file and never through the loop's overlay, so the syntax guard, the hunk and scope checks, `show_changes`, the proof run and the proposal never see it, and a scratch answer is never evidence that a test fails. It shares the eight `functionCalls` with `call_function`, and a repeat of the same file on the same change is answered as a duplicate and spends nothing. Offered only when fix first is on (loop-9 is loop-8 plus the tool), the space has a one-file command, and the repository is ours (`deathvadeR-afk`, section 28.2 unchanged) or the workflow sets `QUIKPILOT_RUN_SCRATCH=on` (a trial space); `QUIKPILOT_RUN_SCRATCH=off` closes it everywhere. Needs the AI Runtime of QUIKTR-1702 (`codegen-loop-9`, its own flag); an AI Runtime that refuses it is asked again as `codegen-loop-8`, then `codegen-loop-7`. Logs and the run record carry counts and closed words only (`codegen.run_scratch`: status, reason, exit code, seconds, length), never the path, the text or the output. Also in rc.59: everything in rc.58. Nothing else changes.
168
+
169
+ **9.3.0-rc.60 - credential files of every language stay away from the AI (QUIKTR-1703).** QuikPilot hid the npm credential file (`.npmrc`) and a few other secret-shaped files, but a Python, Java, Rust, PHP, Ruby or .NET project's own login files were open to the AI, and the last-line scrubber knew only JavaScript-style secrets. (1) Files that hold nothing but logins or keys are never read, listed, searched, edited or created, whatever the project's Protected paths say: `.pypirc`, `pip.conf`, `.netrc`, `.yarnrc(.yml)`, `.cargo/credentials`, `.gem/credentials`, `.bundle/config`, Maven `settings-security.xml` and a `settings.xml` at the root or under `.mvn`/`.m2`, Composer `auth.json` at the root, `.aws/credentials`, `.docker/config.json`, `.kube/config`, Terraform state, `.htpasswd`, private keys and key stores. The names are exact and anchored, so `locales/en/auth.json` stays readable. Nothing under `.git` can be written. (2) The edit, write, show and revert tools use the read list as well: a file the AI may not see is not one it can probe through an edit answer (`ambiguous` quoted the line before each match; `no_match` against `ok` told a guess from a hit). A credential file or a file it may not read is no target and no context file either. (3) The file listing sent to the AI service leaves out every file the AI may not read (it was the raw list); the runner keeps the whole list for its own checks. (4) The scrubber has a `config` mode for configuration files (properties, ini, cfg, conf, toml, yaml, xml, `.env*`, `appsettings*.json`): `repoPassword=x`, `password = x`, `<password>x</password>`, `Password=x;` inside a connection string, a NuGet `ClearTextPassword` are redacted and the name stays; translation files and code are read as before. It also hides npm, PyPI, GitLab and Docker Hub token shapes in every mode. The recorded words do not change. (5) The command environment passes a few more settings with no secret in them (`GOPRIVATE`, `VIRTUAL_ENV`, `PYTHONPATH`, `NODE_ENV`, `RUSTFLAGS`, `CARGO_TARGET_DIR`, `NUGET_PACKAGES` and kin); `GOPROXY`, `PIP_INDEX_URL`, `UV_INDEX_URL`, `MAVEN_OPTS`, `JAVA_TOOL_OPTIONS`, `GRADLE_OPTS` and `RUSTFLAGS` pass only when their value carries no login; and npm's base64 login (`NPM_CONFIG__AUTH`) no longer slips through the allowed `NPM_CONFIG_` family. Never a wildcard: `BUNDLE_*`, `COMPOSER_AUTH` and the registry token variables stay withheld. No change to the contract with the AI service.
168
170
 
169
- **9.3.0-rc.60 - credential files of every language stay away from the AI (QUIKTR-1703).** QuikPilot hid the npm credential file (`.npmrc`) and a few other secret-shaped files, but a Python, Java, Rust, PHP, Ruby or .NET project's own login files were open to the AI, and the last-line scrubber knew only JavaScript-style secrets. (1) Files that hold nothing but logins or keys are never read, listed, searched, edited or created, whatever the project's Protected paths say: `.pypirc`, `pip.conf`, `.netrc`, `.yarnrc(.yml)`, `.cargo/credentials`, `.gem/credentials`, `.bundle/config`, Maven `settings-security.xml` and a `settings.xml` at the root or under `.mvn`/`.m2`, Composer `auth.json` at the root, `.aws/credentials`, `.docker/config.json`, `.kube/config`, Terraform state, `.htpasswd`, private keys and key stores. The names are exact and anchored, so `locales/en/auth.json` stays readable. Nothing under `.git` can be written. (2) The edit, write, show and revert tools use the read list as well: a file the AI may not see is not one it can probe through an edit answer (`ambiguous` quoted the line before each match; `no_match` against `ok` told a guess from a hit). A credential file or a file it may not read is no target and no context file either. (3) The file listing sent to the AI service leaves out every file the AI may not read (it was the raw list); the runner keeps the whole list for its own checks. (4) The scrubber has a `config` mode for configuration files (properties, ini, cfg, conf, toml, yaml, xml, `.env*`, `appsettings*.json`): `repoPassword=x`, `password = x`, `<password>x</password>`, `Password=x;` inside a connection string, a NuGet `ClearTextPassword` are redacted and the name stays; translation files and code are read as before. It also hides npm, PyPI, GitLab and Docker Hub token shapes in every mode. The recorded words do not change. (5) The command environment passes a few more settings with no secret in them (`GOPRIVATE`, `VIRTUAL_ENV`, `PYTHONPATH`, `NODE_ENV`, `RUSTFLAGS`, `CARGO_TARGET_DIR`, `NUGET_PACKAGES` and kin); `GOPROXY`, `PIP_INDEX_URL`, `UV_INDEX_URL`, `MAVEN_OPTS`, `JAVA_TOOL_OPTIONS`, `GRADLE_OPTS` and `RUSTFLAGS` pass only when their value carries no login; and npm's base64 login (`NPM_CONFIG__AUTH`) no longer slips through the allowed `NPM_CONFIG_` family. Never a wildcard: `BUNDLE_*`, `COMPOSER_AUTH` and the registry token variables stay withheld. No change to the contract with the AI service.
171
+ **9.3.0-rc.61 - the AI sees why its own test failed in every language, and is told when what still fails was already failing (QUIKTR-1950, QUIKTR-1962).** (1) `run_tests` and the final test check show the first line (the whole failure under the harness version) of a failing test THIS run wrote. Until now that worked only where the report names a test by its file path (JavaScript); a pytest module, a Java class, a C# namespace and a Go package are not paths, so the AI saw only the test's name and guessed (the sqlparse trial logged `messages: 0` on every run). Such a test now counts as the run's own when its module or package lines up with a file the run changed (the rule that links a declared test to its report entry) AND the test, with any row suffix cut off, is defined in that file's text as a whole word. With no file text nothing is added; a JUnit 5 display name is never linked; an existing test that now fails stays names-only. (2) When no test that passed before fails now and no test that is new in this run fails, but tests are still red, the answer says that every failing test was already failing before the change, and the "same as last run" wording and the `no_progress` stop no longer apply to it (a clean change on a repository with old failures could never reach `tests_passed`). The status stays `tests_failed`; the final gate and the regression check are unchanged. The `codegen.run_tests` log event gains `own` (how many failing tests were shown to be the run's own) and `clean` (a flag), counts only. No change to the contract with the AI service.
170
172
 
171
173
  **9.3.0-rc.58 - write the fix first, then ask once about every existing test it breaks, with proof (QUIKTR-1851, absorbing QUIKTR-1850; release 1).** Until now, when an existing test expected the bug, the run stopped BEFORE any code was written and a person approved a change to that test with nothing to show it could ever pass, and the tests were found one at a time: QTRIA-23 approved a change that moved the status line off 401 and left `expect(body).toEqual({ ..., error: "Unauthorized" })`, which no fix can satisfy, and spent all three stops. Now, when the project switches it on (`packet.fixFirst`; `QUIKPILOT_FIX_FIRST=off` turns it off without a rebuild) the run speaks `codegen-loop-8`: a `report_test_conflict` is a PROPOSAL that does not end the run, the AI writes the tests and the fix and reports every existing test its fix breaks, and at its DONE the runner proves the proposals (`proofCheck.ts`): it runs the project's WHOLE suite (the related-tests planner off, a fresh tool, outside the AI's run allowance) with the fix and every proposed change written over the old code. A proposal whose test still fails is sent back with its name ("change EVERY expectation of it"), and an existing test the fix broke that no proposal covers is sent back by name (never a failure message: QUIKTR-1474), at most twice; one that still fails after that is not offered to a person. Then ONE stop, as before, whose proposals carry `oldCodeChecked` (fails on the old code with the change alone), `newCode` (`passes` / `fails` / `not_checked`) and `newEndLine` (where the changed test now ends, for showing the whole test); no time, no answer or a list of failures cut to fit is `not_checked`, never proven. The tests phase hands its proposals to the code phase. An AI Runtime that refuses `codegen-loop-8` is asked again as loop-7 (nothing else changes), a fix turn stays loop-7, and a project that did not switch it on sends and receives exactly what it did. Release 2 (keeping the fix across the stop) is not in this version: the next job still writes the code again. Also in rc.58: everything in rc.57.
172
174
 
package/dist/index.js CHANGED
@@ -41330,6 +41330,7 @@ function moreFailSentence(before, now) {
41330
41330
  return `More tests fail than in your last run (${before} then, ${now} now): look at your changes with show_changes and put back the file that made it worse with revert_file.`;
41331
41331
  }
41332
41332
  var HARNESS_TESTS_FAILED = "Some tests failed. output lists their names, regressions first: a regression passed before your change. For a test you wrote in this run, messages gives the whole failure: what was expected and what was received.";
41333
+ var TESTS_FAILED_ONLY_OLD = "Some tests failed, and every one of them was already failing before your change. No test that passed before your change fails now, and no test that is new in this run fails.";
41333
41334
  var HARNESS_TESTS_FAILED_NO_OLD_TEST_BROKE = "Some tests failed. No test that passed before your change fails now: the failures counted in newFailures are tests that were not in the test run before your change. For a test you wrote in this run, messages gives the whole failure: what was expected and what was received.";
41334
41335
  var MAX_RESULT_MESSAGE_CHARS = 500;
41335
41336
  function withRelatedNote(message, related) {
@@ -41364,7 +41365,13 @@ function samePlace(a, b) {
41364
41365
  const y = normalisePath2(b);
41365
41366
  return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
41366
41367
  }
41367
- function ownFailureIds(newFailures, changedPaths, requiredIds) {
41368
+ function definesTest(text3, name2) {
41369
+ const base = rowBase(name2);
41370
+ if (base === "" || base === PARAMETERIZED_ROWS) return false;
41371
+ if (!/^[A-Za-z0-9_]+$/.test(base)) return text3.includes(base);
41372
+ return new RegExp(`(^|[^A-Za-z0-9_])${base}([^A-Za-z0-9_]|$)`).test(text3);
41373
+ }
41374
+ function ownFailureIds(newFailures, changedPaths, requiredIds, changedText) {
41368
41375
  const own = /* @__PURE__ */ new Set();
41369
41376
  for (const id of newFailures) {
41370
41377
  const sep = id.indexOf("::");
@@ -41372,7 +41379,11 @@ function ownFailureIds(newFailures, changedPaths, requiredIds) {
41372
41379
  const name2 = sep >= 0 ? id.slice(sep + 2) : id;
41373
41380
  const inChangedFile = file !== "" && changedPaths.some((p) => samePlace(file, p));
41374
41381
  const hasToken = requiredIds.some((t) => name2.includes(`[${t}]`));
41375
- if (inChangedFile || hasToken) own.add(id);
41382
+ if (inChangedFile || hasToken) {
41383
+ own.add(id);
41384
+ continue;
41385
+ }
41386
+ if (file !== "" && changedText && changedPaths.some((p) => idPlaceMatches(file, p) && definesTest(changedText(p) ?? "", name2))) own.add(id);
41376
41387
  }
41377
41388
  return own;
41378
41389
  }
@@ -41408,7 +41419,7 @@ function testAnswerFrom(args2) {
41408
41419
  regressions = approvedFirst(check.regressions);
41409
41420
  newFailures = approvedFirst(check.newFailures);
41410
41421
  alreadyFailing = check.preExisting;
41411
- own = ownFailureIds(newFailures, [...args2.changedPaths], args2.requiredIds);
41422
+ own = ownFailureIds(newFailures, [...args2.changedPaths], args2.requiredIds, args2.changedText);
41412
41423
  failureText = check.failureText;
41413
41424
  failureWhere = check.failureWhere ?? /* @__PURE__ */ new Map();
41414
41425
  failureDetail = check.failureDetail ?? /* @__PURE__ */ new Map();
@@ -41456,7 +41467,7 @@ function testAnswerFrom(args2) {
41456
41467
  timedOut: false,
41457
41468
  truncated: ordered.length > names.length
41458
41469
  };
41459
- return { output, failingKey: failingKeyOf(ordered, messages, failed), messageCount, comparable: Boolean(args2.baseline?.results) };
41470
+ return { output, failingKey: failingKeyOf(ordered, messages, failed), messageCount, comparable: Boolean(args2.baseline?.results), ownCount: own.size };
41460
41471
  }
41461
41472
  var RunTestsTool = class {
41462
41473
  constructor(deps) {
@@ -41510,7 +41521,7 @@ var RunTestsTool = class {
41510
41521
  }
41511
41522
  answer(id, status, parts2 = {}) {
41512
41523
  const harness = this.deps.harness === true;
41513
- const failedSentence = parts2.ownOnly === true ? harness ? HARNESS_TESTS_FAILED_NO_OLD_TEST_BROKE : TESTS_FAILED_NO_OLD_TEST_BROKE : null;
41524
+ const failedSentence = parts2.ownOnly === true ? harness ? HARNESS_TESTS_FAILED_NO_OLD_TEST_BROKE : TESTS_FAILED_NO_OLD_TEST_BROKE : parts2.clean === true ? TESTS_FAILED_ONLY_OLD : null;
41514
41525
  const result = {
41515
41526
  id,
41516
41527
  name: RUN_TESTS_TOOL,
@@ -41548,8 +41559,12 @@ var RunTestsTool = class {
41548
41559
  newFailures: entry.newFailures,
41549
41560
  // How many failure messages the AI was shown: a COUNT, never the text.
41550
41561
  messages: parts2.messageCount ?? 0,
41562
+ // QUIKTR-1950: how many failing tests were shown to be this run's own (a COUNT): an empty set is visible in the log.
41563
+ own: parts2.ownCount ?? 0,
41551
41564
  // Whether the answer said that no old test broke (a flag, never a name): so the effect of saying it can be counted.
41552
41565
  ownOnly: parts2.ownOnly === true,
41566
+ // QUIKTR-1962: whether the answer said that every failing test was failing before (a flag, never a name).
41567
+ clean: parts2.clean === true,
41553
41568
  // QUIKTR-1606: the same failures as the last whole-suite run, told instead of ending the runs (a flag).
41554
41569
  ...parts2.sameAsLast ? { sameAsLast: true } : {},
41555
41570
  // S4: which tests this whole-suite run ran, only when the planner was in play (a project below the threshold logs exactly what it did).
@@ -41689,17 +41704,22 @@ var RunTestsTool = class {
41689
41704
  after: ran.snapshot,
41690
41705
  changedPaths: files.map((f) => f.path),
41691
41706
  requiredIds: d.requiredAutomationIds ?? [],
41692
- harness: d.harness === true
41707
+ harness: d.harness === true,
41708
+ changedText: (p) => {
41709
+ const f = files.find((x) => x.path === p);
41710
+ return f === void 0 ? void 0 : typeof f.content === "string" ? f.content : f.content.toString("utf8");
41711
+ }
41693
41712
  });
41694
41713
  const { failingKey, messageCount, comparable } = answer;
41695
41714
  const output = scope ? { ...answer.output, scope } : answer.output;
41696
41715
  const { passed, failed } = output;
41716
+ const cleanOld = comparable && output.regressions === 0 && output.newFailures === 0 && output.alreadyFailing > 0 && failed > 0;
41697
41717
  const counts = { passed, failed, regressions: output.regressions, newFailures: output.newFailures, alreadyFailing: output.alreadyFailing };
41698
41718
  const green = failed === 0 && ran.run.outcome === "success";
41699
41719
  let extra;
41700
41720
  let sameAsLast = false;
41701
41721
  if (file === void 0) {
41702
- const same = !green && failingKey !== null && failingKey === this.lastFailingKey;
41722
+ const same = !green && !cleanOld && failingKey !== null && failingKey === this.lastFailingKey;
41703
41723
  if (same && d.harness !== true) {
41704
41724
  this.locked = true;
41705
41725
  return this.answer(callId, "no_progress", { output, counts, seconds, messageCount });
@@ -41720,7 +41740,9 @@ var RunTestsTool = class {
41720
41740
  counts,
41721
41741
  seconds,
41722
41742
  messageCount,
41743
+ ownCount: answer.ownCount,
41723
41744
  ownOnly,
41745
+ clean: cleanOld,
41724
41746
  scope,
41725
41747
  ...extra ? { extra } : {},
41726
41748
  ...sameAsLast ? { sameAsLast } : {},
@@ -50809,6 +50831,7 @@ async function verifyChange(ctx, results, undoable) {
50809
50831
  changedPaths: results.map((r) => r.targetPath),
50810
50832
  requiredIds: ctx.requiredAutomationIds,
50811
50833
  harness: ctx.harness === true,
50834
+ changedText: (p) => results.find((r) => r.targetPath === p)?.newContent,
50812
50835
  ...approvedIds.size > 0 ? { approvedIds } : {}
50813
50836
  }) : null;
50814
50837
  const wording = describeRegressions(check, {
@@ -51418,7 +51441,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
51418
51441
  var REPORT_COPY = "final-test-report.xml";
51419
51442
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
51420
51443
  var MAX_FILES = 200;
51421
- var RUNNER_VERSION = true ? "9.3.0-rc.60" : "dev";
51444
+ var RUNNER_VERSION = true ? "9.3.0-rc.61" : "dev";
51422
51445
  function safeDestination(base, repoPath) {
51423
51446
  if (!repoPath || (0, import_node_path26.isAbsolute)(repoPath)) return null;
51424
51447
  const destination = (0, import_node_path26.resolve)(base, repoPath);