@quikit/quikpilot-runner 9.3.0-rc.41 → 9.3.0-rc.43
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 +4 -0
- package/dist/index.js +185 -84
- package/dist/index.js.map +4 -4
- package/package.json +30 -30
package/README.md
CHANGED
|
@@ -156,6 +156,10 @@ wrong (a field that arrives from a database row or a request), so it only warns
|
|
|
156
156
|
|
|
157
157
|
**9.3.0-rc.38 — a loop turn waits as long as its own clock says (QUIKTR-1582, S7).** Node's built-in `fetch` gives up on any reply whose headers take longer than 300 seconds, whatever limit the caller passes ("fetch failed", cause `UND_ERR_HEADERS_TIMEOUT`; measured on Node 20 and 24). So the 420 seconds a loop's first turn was given (9.3.0-rc.34) never happened: when the AI service's first answer of the day took more than 300 seconds, the call failed as "transport", and in map mode that ended the run (S7 trial QTRIA-8). Now every AI call that brings its own clock (each turn of the targeting, code-writing and early-look loops) goes through Node's own `http`/`https` client, which has no such limit, with TCP keep-alive as `fetch` sets it; the clock is the only thing that ends it, and a timed-out turn still reads as `turn_timeout`. Calls without a clock (the single targeting and code-writing calls) keep `fetch` exactly as before, 300 seconds included, and the retry rules are unchanged. No new dependency.
|
|
158
158
|
|
|
159
|
+
**9.3.0-rc.43 — the report back is tried again after a server error (QUIKTR-1826).** The report back to QuikProjects is the job's last act, and it was tried once: on 25 Oct two runs that had stopped for a test decision lost it to one 500 (QuikProjects could not get a database connection in time, P2028), so each job's work was thrown away and the run stayed stuck at RUNNING. Now a 500, 502, 503 or 504, or a dropped connection (`ECONNRESET`, `ETIMEDOUT`), is tried again up to three times, after 2, 5 and 10 seconds, with the same body each time; each retry is a `::warning::` line in the job log with the reason code, and a report that still fails says "after 4 tries". A refusal (any other status, 4xx and 429 included) is never tried again. A repeat is safe: QuikProjects saves the report all-or-nothing, answers one it already saved as already recorded, and finds the pull request it opened the first time. Also in rc.43: everything in rc.42, which was not published on its own. Nothing else changes.
|
|
160
|
+
|
|
161
|
+
**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.
|
|
162
|
+
|
|
159
163
|
**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.
|
|
160
164
|
|
|
161
165
|
**9.3.0-rc.40 — the early look is allowed to finish.** The look's first AI call now waits up to 420 seconds (it was 150) and the whole look up to 10 minutes (it was 210 seconds), the same first-call allowance every other loop already has. Measured 22 Oct: a cold first look call took 219 seconds, so the look was cut off whenever the AI service was cold, the service never kept the response format, and the next run started cold again; a specification written without the code carried a wrong criterion far more often (9 of 24 benchmark samples, against 1 of 24 with the code). QuikProjects now keeps findings that arrive after its own wait ran out, so the later steps of the run read the code. Nothing else changes.
|
package/dist/index.js
CHANGED
|
@@ -33091,9 +33091,82 @@ async function describeQuikTrackFailure(res) {
|
|
|
33091
33091
|
return `${res.status} ${res.statusText}`;
|
|
33092
33092
|
}
|
|
33093
33093
|
|
|
33094
|
+
// src/fetchOnOwnClock.ts
|
|
33095
|
+
var import_node_http = __toESM(require("node:http"));
|
|
33096
|
+
var import_node_https = __toESM(require("node:https"));
|
|
33097
|
+
var NATIVE_FETCH = globalThis.fetch;
|
|
33098
|
+
var KEEP_ALIVE_INITIAL_DELAY_MS = 6e4;
|
|
33099
|
+
var NULL_BODY_STATUSES = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
33100
|
+
async function fetchOnOwnClock(url, init) {
|
|
33101
|
+
if (!init.signal || globalThis.fetch !== NATIVE_FETCH) return globalThis.fetch(url, init);
|
|
33102
|
+
return requestWithoutHeadersLimit(url, init, init.signal);
|
|
33103
|
+
}
|
|
33104
|
+
async function requestWithoutHeadersLimit(url, init, signal) {
|
|
33105
|
+
if (init.body != null && typeof init.body !== "string") throw new TypeError("fetchOnOwnClock sends a string body only");
|
|
33106
|
+
const target = new URL(url);
|
|
33107
|
+
const client = target.protocol === "http:" ? import_node_http.default : import_node_https.default;
|
|
33108
|
+
const headers = Object.fromEntries(new Headers(init.headers).entries());
|
|
33109
|
+
return new Promise((resolve6, reject) => {
|
|
33110
|
+
const fail = (err) => reject(signal.aborted ? signal.reason : err);
|
|
33111
|
+
const req = client.request(target, { method: init.method ?? "GET", headers, signal }, (res) => {
|
|
33112
|
+
const chunks = [];
|
|
33113
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
33114
|
+
res.on("error", fail);
|
|
33115
|
+
res.on("end", () => {
|
|
33116
|
+
const status = res.statusCode ?? 0;
|
|
33117
|
+
const responseHeaders = new Headers();
|
|
33118
|
+
for (const [name, value] of Object.entries(res.headers)) {
|
|
33119
|
+
for (const one of Array.isArray(value) ? value : value === void 0 ? [] : [value]) responseHeaders.append(name, one);
|
|
33120
|
+
}
|
|
33121
|
+
try {
|
|
33122
|
+
resolve6(new Response(NULL_BODY_STATUSES.has(status) ? null : Buffer.concat(chunks), { status, statusText: res.statusMessage ?? "", headers: responseHeaders }));
|
|
33123
|
+
} catch (err) {
|
|
33124
|
+
reject(err);
|
|
33125
|
+
}
|
|
33126
|
+
});
|
|
33127
|
+
});
|
|
33128
|
+
req.on("socket", (socket) => socket.setKeepAlive(true, KEEP_ALIVE_INITIAL_DELAY_MS));
|
|
33129
|
+
req.on("error", fail);
|
|
33130
|
+
req.end(typeof init.body === "string" ? init.body : void 0);
|
|
33131
|
+
});
|
|
33132
|
+
}
|
|
33133
|
+
|
|
33134
|
+
// src/retryFetch.ts
|
|
33135
|
+
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
33136
|
+
var RETRYABLE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "ETIMEDOUT"]);
|
|
33137
|
+
function networkErrorCode(err) {
|
|
33138
|
+
const code = err?.cause?.code ?? err?.code;
|
|
33139
|
+
return typeof code === "string" ? code : void 0;
|
|
33140
|
+
}
|
|
33141
|
+
function isRetryableNetworkError(err) {
|
|
33142
|
+
const code = networkErrorCode(err);
|
|
33143
|
+
return code !== void 0 && RETRYABLE_NETWORK_ERROR_CODES.has(code);
|
|
33144
|
+
}
|
|
33145
|
+
async function fetchWithRetry(url, init, { retries = 2, backoffMs = 250 } = {}) {
|
|
33146
|
+
for (let attempt2 = 0; ; attempt2++) {
|
|
33147
|
+
try {
|
|
33148
|
+
const res = await fetchOnOwnClock(url, init);
|
|
33149
|
+
if (RETRYABLE_STATUS_CODES.has(res.status) && attempt2 < retries) {
|
|
33150
|
+
await new Promise((r) => setTimeout(r, backoffMs));
|
|
33151
|
+
continue;
|
|
33152
|
+
}
|
|
33153
|
+
return res;
|
|
33154
|
+
} catch (err) {
|
|
33155
|
+
if (isRetryableNetworkError(err) && attempt2 < retries) {
|
|
33156
|
+
await new Promise((r) => setTimeout(r, backoffMs));
|
|
33157
|
+
continue;
|
|
33158
|
+
}
|
|
33159
|
+
throw err;
|
|
33160
|
+
}
|
|
33161
|
+
}
|
|
33162
|
+
}
|
|
33163
|
+
|
|
33094
33164
|
// src/callback.ts
|
|
33165
|
+
var REPORT_RETRY_STATUSES = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
33166
|
+
var REPORT_RETRY_WAITS_MS = [2e3, 5e3, 1e4];
|
|
33095
33167
|
async function reportBack(params) {
|
|
33096
33168
|
const { callbackUrl, runToken, status, branch, warnings, targeting, baselineFindings, vanishedTests, unsuppliedInputs, changesNoTestDependsOn, testsCorrected, codegenLoop, unresolved, aiCostUsd, testConflicts, approvedTestsApplied } = params;
|
|
33169
|
+
const sleep = params.sleep ?? ((ms) => new Promise((resolve6) => setTimeout(resolve6, ms)));
|
|
33097
33170
|
const body = { status };
|
|
33098
33171
|
if (branch) body.branch = branch;
|
|
33099
33172
|
if (warnings && warnings.length > 0) body.warnings = warnings;
|
|
@@ -33108,13 +33181,34 @@ async function reportBack(params) {
|
|
|
33108
33181
|
if (typeof aiCostUsd === "number" && Number.isFinite(aiCostUsd) && aiCostUsd > 0) body.aiCostUsd = Math.round(aiCostUsd * 1e6) / 1e6;
|
|
33109
33182
|
if (testConflicts) body.testConflicts = testConflicts;
|
|
33110
33183
|
if (approvedTestsApplied && approvedTestsApplied.length > 0) body.approvedTestsApplied = approvedTestsApplied;
|
|
33111
|
-
const
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33184
|
+
const payload = JSON.stringify(body);
|
|
33185
|
+
const tries = REPORT_RETRY_WAITS_MS.length + 1;
|
|
33186
|
+
for (let attempt2 = 1; ; attempt2++) {
|
|
33187
|
+
let failure;
|
|
33188
|
+
let res;
|
|
33189
|
+
try {
|
|
33190
|
+
res = await fetch(callbackUrl, {
|
|
33191
|
+
method: "POST",
|
|
33192
|
+
headers: { Authorization: `Bearer ${runToken}`, "Content-Type": "application/json" },
|
|
33193
|
+
body: payload
|
|
33194
|
+
});
|
|
33195
|
+
} catch (err) {
|
|
33196
|
+
if (!isRetryableNetworkError(err)) throw err;
|
|
33197
|
+
failure = `the connection failed (${networkErrorCode(err)})`;
|
|
33198
|
+
if (attempt2 === tries) throw new Error(`Report back to QuikTrack failed: ${failure} after ${tries} tries`);
|
|
33199
|
+
await waitBeforeRetry(failure, attempt2);
|
|
33200
|
+
continue;
|
|
33201
|
+
}
|
|
33202
|
+
if (res.ok) return;
|
|
33203
|
+
failure = await describeQuikTrackFailure(res);
|
|
33204
|
+
if (!REPORT_RETRY_STATUSES.has(res.status)) throw new Error(`Report back to QuikTrack failed: ${failure}`);
|
|
33205
|
+
if (attempt2 === tries) throw new Error(`Report back to QuikTrack failed: ${failure} after ${tries} tries`);
|
|
33206
|
+
await waitBeforeRetry(failure, attempt2);
|
|
33207
|
+
}
|
|
33208
|
+
async function waitBeforeRetry(failure, attempt2) {
|
|
33209
|
+
const waitMs = REPORT_RETRY_WAITS_MS[attempt2 - 1];
|
|
33210
|
+
console.warn(`::warning::Report back to QuikTrack failed: ${failure}; trying again in ${waitMs / 1e3} s (try ${attempt2 + 1} of ${tries})`);
|
|
33211
|
+
await sleep(waitMs);
|
|
33118
33212
|
}
|
|
33119
33213
|
}
|
|
33120
33214
|
|
|
@@ -34792,72 +34886,6 @@ function scrubEntriesForModel(entries, secrets, keep) {
|
|
|
34792
34886
|
});
|
|
34793
34887
|
}
|
|
34794
34888
|
|
|
34795
|
-
// src/fetchOnOwnClock.ts
|
|
34796
|
-
var import_node_http = __toESM(require("node:http"));
|
|
34797
|
-
var import_node_https = __toESM(require("node:https"));
|
|
34798
|
-
var NATIVE_FETCH = globalThis.fetch;
|
|
34799
|
-
var KEEP_ALIVE_INITIAL_DELAY_MS = 6e4;
|
|
34800
|
-
var NULL_BODY_STATUSES = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
34801
|
-
async function fetchOnOwnClock(url, init) {
|
|
34802
|
-
if (!init.signal || globalThis.fetch !== NATIVE_FETCH) return globalThis.fetch(url, init);
|
|
34803
|
-
return requestWithoutHeadersLimit(url, init, init.signal);
|
|
34804
|
-
}
|
|
34805
|
-
async function requestWithoutHeadersLimit(url, init, signal) {
|
|
34806
|
-
if (init.body != null && typeof init.body !== "string") throw new TypeError("fetchOnOwnClock sends a string body only");
|
|
34807
|
-
const target = new URL(url);
|
|
34808
|
-
const client = target.protocol === "http:" ? import_node_http.default : import_node_https.default;
|
|
34809
|
-
const headers = Object.fromEntries(new Headers(init.headers).entries());
|
|
34810
|
-
return new Promise((resolve6, reject) => {
|
|
34811
|
-
const fail = (err) => reject(signal.aborted ? signal.reason : err);
|
|
34812
|
-
const req = client.request(target, { method: init.method ?? "GET", headers, signal }, (res) => {
|
|
34813
|
-
const chunks = [];
|
|
34814
|
-
res.on("data", (chunk) => chunks.push(chunk));
|
|
34815
|
-
res.on("error", fail);
|
|
34816
|
-
res.on("end", () => {
|
|
34817
|
-
const status = res.statusCode ?? 0;
|
|
34818
|
-
const responseHeaders = new Headers();
|
|
34819
|
-
for (const [name, value] of Object.entries(res.headers)) {
|
|
34820
|
-
for (const one of Array.isArray(value) ? value : value === void 0 ? [] : [value]) responseHeaders.append(name, one);
|
|
34821
|
-
}
|
|
34822
|
-
try {
|
|
34823
|
-
resolve6(new Response(NULL_BODY_STATUSES.has(status) ? null : Buffer.concat(chunks), { status, statusText: res.statusMessage ?? "", headers: responseHeaders }));
|
|
34824
|
-
} catch (err) {
|
|
34825
|
-
reject(err);
|
|
34826
|
-
}
|
|
34827
|
-
});
|
|
34828
|
-
});
|
|
34829
|
-
req.on("socket", (socket) => socket.setKeepAlive(true, KEEP_ALIVE_INITIAL_DELAY_MS));
|
|
34830
|
-
req.on("error", fail);
|
|
34831
|
-
req.end(typeof init.body === "string" ? init.body : void 0);
|
|
34832
|
-
});
|
|
34833
|
-
}
|
|
34834
|
-
|
|
34835
|
-
// src/retryFetch.ts
|
|
34836
|
-
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
34837
|
-
var RETRYABLE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "ETIMEDOUT"]);
|
|
34838
|
-
function isRetryableNetworkError(err) {
|
|
34839
|
-
const code = err?.cause?.code ?? err?.code;
|
|
34840
|
-
return typeof code === "string" && RETRYABLE_NETWORK_ERROR_CODES.has(code);
|
|
34841
|
-
}
|
|
34842
|
-
async function fetchWithRetry(url, init, { retries = 2, backoffMs = 250 } = {}) {
|
|
34843
|
-
for (let attempt2 = 0; ; attempt2++) {
|
|
34844
|
-
try {
|
|
34845
|
-
const res = await fetchOnOwnClock(url, init);
|
|
34846
|
-
if (RETRYABLE_STATUS_CODES.has(res.status) && attempt2 < retries) {
|
|
34847
|
-
await new Promise((r) => setTimeout(r, backoffMs));
|
|
34848
|
-
continue;
|
|
34849
|
-
}
|
|
34850
|
-
return res;
|
|
34851
|
-
} catch (err) {
|
|
34852
|
-
if (isRetryableNetworkError(err) && attempt2 < retries) {
|
|
34853
|
-
await new Promise((r) => setTimeout(r, backoffMs));
|
|
34854
|
-
continue;
|
|
34855
|
-
}
|
|
34856
|
-
throw err;
|
|
34857
|
-
}
|
|
34858
|
-
}
|
|
34859
|
-
}
|
|
34860
|
-
|
|
34861
34889
|
// src/codegen.ts
|
|
34862
34890
|
var FILE_TOO_LARGE_CODE = "CODEGEN_FILE_TOO_LARGE";
|
|
34863
34891
|
var CONTEXT_TOO_LARGE_CODE = "CODEGEN_CONTEXT_TOO_LARGE";
|
|
@@ -42910,6 +42938,7 @@ var DEFAULT_MAX_HUNKS = 8;
|
|
|
42910
42938
|
var MAX_FILE_BYTES = 1e6;
|
|
42911
42939
|
var FRESH_SLACK_MS3 = 2e3;
|
|
42912
42940
|
var SAFETY_MS = 6e4;
|
|
42941
|
+
var MIN_RELATED_RUN_MS = 3e4;
|
|
42913
42942
|
var CODE_EXTENSIONS = /\.(?:[cm]?[jt]sx?|py|go|java|rb|rs|cs|php|kt)$/i;
|
|
42914
42943
|
function eligibleForHunkCheck(path) {
|
|
42915
42944
|
return CODE_EXTENSIONS.test(path) && !isTestFile(path);
|
|
@@ -42935,7 +42964,14 @@ async function runHunkCheck(input) {
|
|
|
42935
42964
|
const now = input.now ?? Date.now;
|
|
42936
42965
|
const log = input.log ?? (() => {
|
|
42937
42966
|
});
|
|
42938
|
-
const result = {
|
|
42967
|
+
const result = {
|
|
42968
|
+
unnecessary: [],
|
|
42969
|
+
checked: 0,
|
|
42970
|
+
total: 0,
|
|
42971
|
+
skipped: { whitespace: 0, tooBig: 0, cap: 0, time: 0, unknown: 0, files: 0 },
|
|
42972
|
+
relatedRuns: 0,
|
|
42973
|
+
wholeRuns: 0
|
|
42974
|
+
};
|
|
42939
42975
|
if (!input.baseline.results || input.baseline.results.size === 0) return { ...result, stopped: "no_baseline" };
|
|
42940
42976
|
const limit = testTimeLimitMs(input.baselineMs);
|
|
42941
42977
|
if (limit === "too_slow") return { ...result, stopped: "too_slow" };
|
|
@@ -42966,6 +43002,7 @@ async function runHunkCheck(input) {
|
|
|
42966
43002
|
const findReport = input.findReport ?? findJUnitReport;
|
|
42967
43003
|
const readSnapshot = input.readSnapshot ?? readTestSnapshot;
|
|
42968
43004
|
const runCommand2 = input.runCommand ?? runTestCommandWithLimit;
|
|
43005
|
+
const readAt = input.readSnapshotAt ?? readTestSnapshotAt;
|
|
42969
43006
|
let slowestRunMs = input.baselineMs ?? 3e4;
|
|
42970
43007
|
const runOnce = async (c) => {
|
|
42971
43008
|
const reportBefore = findReport(input.root);
|
|
@@ -42973,6 +43010,7 @@ async function runHunkCheck(input) {
|
|
|
42973
43010
|
const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
|
|
42974
43011
|
const startedWall = Date.now();
|
|
42975
43012
|
const startedAt = now();
|
|
43013
|
+
result.wholeRuns += 1;
|
|
42976
43014
|
try {
|
|
42977
43015
|
const verdict = await withOverlayOnDisk(
|
|
42978
43016
|
input.root,
|
|
@@ -43002,20 +43040,72 @@ async function runHunkCheck(input) {
|
|
|
43002
43040
|
throw err;
|
|
43003
43041
|
}
|
|
43004
43042
|
};
|
|
43043
|
+
const runRelated = async (c, plan, limitMs) => {
|
|
43044
|
+
const reportBefore = findReport(input.root);
|
|
43045
|
+
const preserve = reportBefore ? [(0, import_node_path18.relative)(input.root, reportBefore).split("\\").join("/")] : [];
|
|
43046
|
+
const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
|
|
43047
|
+
const startedAt = now();
|
|
43048
|
+
result.relatedRuns += 1;
|
|
43049
|
+
try {
|
|
43050
|
+
const verdict = await withOverlayOnDisk(
|
|
43051
|
+
input.root,
|
|
43052
|
+
[{ path: c.file, content }],
|
|
43053
|
+
async () => {
|
|
43054
|
+
(0, import_node_fs18.rmSync)(plan.report, { force: true });
|
|
43055
|
+
try {
|
|
43056
|
+
const run2 = await runCommand2(plan.command, limitMs, plan.cwd);
|
|
43057
|
+
if (!run2.started || run2.timedOut) return "unknown";
|
|
43058
|
+
const after = readAt(run2.outcome, plan.report);
|
|
43059
|
+
if (!after.results || after.results.size === 0) return "unknown";
|
|
43060
|
+
return checkForRegressions(input.baseline, after).blocked ? "needed" : "unneeded";
|
|
43061
|
+
} finally {
|
|
43062
|
+
(0, import_node_fs18.rmSync)(plan.report, { force: true });
|
|
43063
|
+
}
|
|
43064
|
+
},
|
|
43065
|
+
{ ...input.tree, preserve }
|
|
43066
|
+
);
|
|
43067
|
+
input.planner?.ran({ plan, wallMs: now() - startedAt, baselineMs: input.baselineMs });
|
|
43068
|
+
return verdict;
|
|
43069
|
+
} catch (err) {
|
|
43070
|
+
if (err instanceof DiskWriteRefused) return "unknown";
|
|
43071
|
+
throw err;
|
|
43072
|
+
}
|
|
43073
|
+
};
|
|
43005
43074
|
const queue = candidates.slice(0, input.maxHunks ?? DEFAULT_MAX_HUNKS);
|
|
43006
43075
|
result.skipped.cap = candidates.length - queue.length;
|
|
43007
43076
|
let handled = 0;
|
|
43008
43077
|
try {
|
|
43009
43078
|
for (const c of queue) {
|
|
43010
|
-
|
|
43011
|
-
|
|
43012
|
-
|
|
43079
|
+
const relatedLeftMs = input.deadlineAtMs - now() - SAFETY_MS;
|
|
43080
|
+
const plan = input.planner && relatedLeftMs >= MIN_RELATED_RUN_MS ? input.planner.plan({ overlayPaths: [c.file], baselineMs: input.baselineMs }) : null;
|
|
43081
|
+
let verdict = "unknown";
|
|
43082
|
+
let via = "whole";
|
|
43083
|
+
let started = false;
|
|
43084
|
+
if (plan?.scope === "related") {
|
|
43085
|
+
handled += 1;
|
|
43086
|
+
result.checked += 1;
|
|
43087
|
+
started = true;
|
|
43088
|
+
via = "related";
|
|
43089
|
+
verdict = await runRelated(c, plan, Math.min(plan.limitMs, relatedLeftMs));
|
|
43090
|
+
}
|
|
43091
|
+
if (verdict !== "needed") {
|
|
43092
|
+
if (now() + slowestRunMs + SAFETY_MS > input.deadlineAtMs) {
|
|
43093
|
+
result.stopped = "out_of_time";
|
|
43094
|
+
if (started) {
|
|
43095
|
+
result.skipped.unknown += 1;
|
|
43096
|
+
log({ event: "hunk_check.block", verdict: "unknown", via });
|
|
43097
|
+
}
|
|
43098
|
+
break;
|
|
43099
|
+
}
|
|
43100
|
+
if (!started) {
|
|
43101
|
+
handled += 1;
|
|
43102
|
+
result.checked += 1;
|
|
43103
|
+
}
|
|
43104
|
+
via = "whole";
|
|
43105
|
+
verdict = await runOnce(c);
|
|
43106
|
+
if (verdict === "unneeded") verdict = await runOnce(c);
|
|
43013
43107
|
}
|
|
43014
|
-
|
|
43015
|
-
result.checked += 1;
|
|
43016
|
-
let verdict = await runOnce(c);
|
|
43017
|
-
if (verdict === "unneeded") verdict = await runOnce(c);
|
|
43018
|
-
log({ event: "hunk_check.block", verdict });
|
|
43108
|
+
log({ event: "hunk_check.block", verdict, via });
|
|
43019
43109
|
if (verdict === "unknown") result.skipped.unknown += 1;
|
|
43020
43110
|
else if (verdict === "unneeded") {
|
|
43021
43111
|
const { startLine, endLine } = hunkLines(c.hunk, c.totalLines);
|
|
@@ -44311,7 +44401,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
44311
44401
|
var REPORT_COPY = "final-test-report.xml";
|
|
44312
44402
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
44313
44403
|
var MAX_FILES = 200;
|
|
44314
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
44404
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.43" : "dev";
|
|
44315
44405
|
function safeDestination(base, repoPath) {
|
|
44316
44406
|
if (!repoPath || (0, import_node_path23.isAbsolute)(repoPath)) return null;
|
|
44317
44407
|
const destination = (0, import_node_path23.resolve)(base, repoPath);
|
|
@@ -45176,6 +45266,15 @@ async function run(env2) {
|
|
|
45176
45266
|
const healCalls = [];
|
|
45177
45267
|
let healStop;
|
|
45178
45268
|
const testCommand = packet.commands.test;
|
|
45269
|
+
const reviewPlanner = createRelatedPlanner({
|
|
45270
|
+
root: process.cwd(),
|
|
45271
|
+
command: testCommand,
|
|
45272
|
+
listing: workspaceListing,
|
|
45273
|
+
deniedPaths: packet.guardrails.deniedPaths,
|
|
45274
|
+
writeRoot,
|
|
45275
|
+
discoveredTests: discoveredTestsOf(packet.testDiscovery),
|
|
45276
|
+
log: (e) => console.log(JSON.stringify(e))
|
|
45277
|
+
});
|
|
45179
45278
|
const hunkCheckOver = async (changed, testCount) => {
|
|
45180
45279
|
if (codegenMode !== "loop-tests" || process.env.QUIKPILOT_HUNK_CHECK?.trim().toLowerCase() === "off") return null;
|
|
45181
45280
|
const deadlineAtMs = Math.min(jobStopAtMs - HUNK_CHECK_END_BEFORE_STOP_MS, Date.now() + HUNK_CHECK_MAX_MS);
|
|
@@ -45185,6 +45284,8 @@ async function run(env2) {
|
|
|
45185
45284
|
return runHunkCheck({
|
|
45186
45285
|
root: process.cwd(),
|
|
45187
45286
|
command: testCommand,
|
|
45287
|
+
// QUIKTR-1812: each block's first run is only the related tests where the planner trusts them (its own instance, its own state).
|
|
45288
|
+
planner: reviewPlanner,
|
|
45188
45289
|
baseline,
|
|
45189
45290
|
baselineMs: timedBaseline.durationMs,
|
|
45190
45291
|
finalTestCount: testCount,
|
|
@@ -45257,7 +45358,7 @@ async function run(env2) {
|
|
|
45257
45358
|
const reused = fixed.review && fixed.review.results === fixed.results ? fixed.review.raw : void 0;
|
|
45258
45359
|
const checked = reused ?? await hunkCheckOver(fixed.results, final.outputs.testCount ?? 0);
|
|
45259
45360
|
if (checked) {
|
|
45260
|
-
if (!reused) console.log(JSON.stringify({ event: "hunk_check", checked: checked.checked, total: checked.total, flagged: checked.unnecessary.length, skipped: checked.skipped, stopped: checked.stopped ?? null }));
|
|
45361
|
+
if (!reused) console.log(JSON.stringify({ event: "hunk_check", checked: checked.checked, total: checked.total, flagged: checked.unnecessary.length, skipped: checked.skipped, stopped: checked.stopped ?? null, relatedRuns: checked.relatedRuns, wholeRuns: checked.wholeRuns }));
|
|
45261
45362
|
changesNoTestDependsOn = toFinding(checked);
|
|
45262
45363
|
if (checked.unnecessary.length > 0) {
|
|
45263
45364
|
const w = describeHunkCheck(checked);
|