@quikit/quikpilot-runner 9.3.0-rc.80 → 9.3.0-rc.81
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 +8 -0
- package/dist/index.js +141 -29
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -186,6 +186,14 @@ wrong (a field that arrives from a database row or a request), so it only warns
|
|
|
186
186
|
|
|
187
187
|
**9.3.0-rc.79 - plain SQL files are no evidence for the table names of a proposed database change (QUIKTR-2450).** In the live rerun of 9 Nov 2026 (F8, QTRIA-57, rc.78) the draft pull request's SQL read `ALTER TABLE app_quiktrack."QtIssueComment"`: the schema (`app_quikprojects`) and the table (`QptIssueComment`) are both different, and the name check of rc.77 (QUIKTR-2448) said `namesUnchecked: 0`. The repository still holds an old dump (`packages/database/scripts/qt-schema.sql`, `CREATE TABLE app_quiktrack."QtIssueComment"`) and a manual check script that name exactly that pair; they are neither documentation nor read-denied, so the pair "appeared together in one readable file". `nameEvidence.ts` now counts a file as evidence only if it is not documentation and not a SQL file (`.sql`, `.dump`, `.psql`, `.ddl`, any letter case, wherever it sits): dumps, history and checks live there as often as the live schema, while the model definition (Prisma, a Python, Go or Ruby model, a JSON or YAML schema) and the application code say what the product uses now. A name found only in SQL files is reported as not checked: the AI is sent back once and the pull request says so. Run on the real trial repository, both statements of the two F8 runs are now flagged and the right one (`app_quikprojects."QptIssueComment"`) passes. Known cost: a repository whose only schema is plain SQL migrations gets the "could not check" sentence on every database proposal (one send-back, then a warning); a person checks the names, as the pull request already asks. Switched off, a bug run, and every other path: unchanged. New tests in `nameEvidence.test.ts` (the F8 repository in miniature, every SQL kind and case, the other languages' models, a bare table); six mutations turn tests red.
|
|
188
188
|
|
|
189
|
+
**9.3.0-rc.81 - a refusal on a later turn ends the attempt, never the version or the feature rules (QUIKTR-2468 item 3).** A version or key the AI Runtime does not know is refused on the first request of a loop, before any model call. A refusal on a later turn is about that request (QTRIA-62: a message over 500 characters), yet it used to drop `featureTestUpdates` and restart the code phase, or walk the whole version chain down to the per-file calls. Now it (and any refusal in the code phase of a change written in phases, whose tests phase already spoke the version) is logged `codegen.contract_rejected` with `late: true` and fails the attempt like any failure (the second attempt runs). A later refusal whose reason names the key is still the key's refusal.
|
|
190
|
+
|
|
191
|
+
**9.3.0-rc.81 (also) - the same-failure hint says to name a test that looks wrong (QUIKTR-2468 item 5).** It ended "compare its set-up with the tests around it", which the code phase cannot do (its tests are frozen). It now says: if the test itself looks wrong, name it in CANNOT_COMPLETE. Both forms are shorter than before, so every rc.80 fit budget holds.
|
|
192
|
+
|
|
193
|
+
**9.3.0-rc.81 (also) - a source file frozen only because phase 1 wrote cases into it says why (QUIKTR-2464 item 5).** Instead of "change the code, not the tests", such a file (no test by the project's rule, not an existing test) is named with the reason and the way out: answer CANNOT_COMPLETE naming it. Real test files keep today's sentence. Item 4 (an early send-back of targeting) is not built: rc.80 already keeps a file that only claimed the cases as code (`codegen.claim_only_source` in the log).
|
|
194
|
+
|
|
195
|
+
**9.3.0-rc.81 (also) - pytest and go test reports place their tests on files (QUIKTR-2465 item 3).** The Python and Go trial repositories' reports placed no test on a file, so the test-file list was empty and the AI Runtime's early check was off. pytest tests are placed by the longest dotted prefix that is a `.py` file of the listing; Go tests by go.mod's module and the one `_test.go` file of the package's folder that declares the function. Real reports: sqlparse 454 tests on 9 files, decimal 145 tests on 3 files, 0 unmapped each. A report that places none of its tests says so in the run's notes. JavaScript reports are unchanged.
|
|
196
|
+
|
|
189
197
|
**9.3.0-rc.80 - a feature's new data must reach the screen that shows it (QUIKTR-2458).** In the live F7 rerun of 10 Nov 2026 (QTRIA-61, "Show the number of comments on each task card on the board", rc.79) the card was changed and the count was added to `GET /api/projects/[id]/grouped-board`, a route only the grouped-kanban screen loads. The board's cards come from `GET /api/issues` (`board-column.tsx`), so on the main board the count never showed, while the parts check said all three parts were built (since rc.73 a part is built when any file planned for it changed, and it cannot tell a right file from a plausible wrong one). New `dataPathCheck.ts`, run only where the parts check already runs (a feature with a design that lists parts, `QUIKPILOT_PARTS_CHECK=on`): it takes the screen files the change touched (a `screen` part's planned files, tsx, jsx, vue, svelte or html), the files that import them (found with `git grep` for a line that imports the module, confirmed by the file's import specifiers; a module named `index`, `page`, `layout`, `route` and the like is not searched for), the files that import those, and what all of these import (up to 60 files, never a test file, a denied path or a file outside the read listing), reads the server addresses they call (the first string address on or just after a client-call line, and any `/api/...` string), and takes the server routes the change touched for the `data` part, by the address their file layout gives (Next.js app and pages routes). If the screen's loading calls go to addresses none of those routes answers (segment by segment, `*` for one segment, `**` for anything below, a call written relative to a base path counts), that is a gap. At a code-phase finish the AI is sent back once (its own counter, `done_rule`, one sentence naming the screen, the file that loads its data and the address it calls, and the route that was changed instead; log `codegen.data_path` `sent`, then `kept`); at the last gate before the commit a gap that is still there adds one run note through the existing `warnings` (log `parts_check.data_path` `warned`) and never stops the run: the check reads the layout and the calls, it cannot be certain. The log lines carry the numbers of the scan (`files`, `calls`, `ms`), never text. The scan gives up after 8 seconds and works with what it has. Checked on the real F7 pull request (quikit1926 `QTRIA-61`): flagged in about one second, naming `board-column.tsx` and `/api/issues` against the grouped-board route; silent when `GET /api/issues` is the route that was changed, and silent when both were. Silent when it cannot tell: no calls found, no changed data route with a known address, a language other than JavaScript or TypeScript, a screen shown only by a server component, git not running. Switched off, a bug run, a design with no parts and one-phase paths: every request, log line and callback is what it was. No site, AI Runtime or callback change. New tests in `dataPathCheck.test.ts` (the F7 repository in miniature on a real git checkout), `codegenLoopDataPath.test.ts` and `run.parts.test.ts`; thirty mutations turn tests red (one more only changes how long the scan takes).
|
|
190
198
|
|
|
191
199
|
**9.3.0-rc.80 (also) - the data-path advice and the parts check no longer contradict each other (QUIKTR-2469).** Found reviewing rc.80 before its release. Targeting can plan only the wrong route for a feature's data part (the F7 case: `grouped-board` alone). The data-path send-back told the AI to put the data where the screen loads it, while the parts check counts a data part as built only when a file planned for it changed, so an AI that moved the data (undoing the planned route) was refused again ("Part P1 (data) ... is not built") and the attempt failed `part_missing`; only "add it there and keep the planned change" passed both, and nothing said so. Now the sentence says exactly that ("Add it where <address> is answered too and keep that change, or say why <route> alone is right"; the names give way to fit 300 characters, never the advice), and `withoutMovedData` (`dataPathCheck.ts`) counts a data part the plan left unchanged as built when a changed route that no part planned answers an address the changed screens' loading files call. One such route excuses at most one part; a part of another kind is never excused; a test file is never a route. The data-path check itself accepts such a route too, so following the advice ends the gap instead of leaving a note at the last gate. The code loop and the last gate use the same rule, and the last gate now also reads the other files the AI changed (`allChangesAgainstBase`, `finalChange.ts`, limited to the files the code step and the fixes wrote, so a route that only the project's Format or Lint command reformatted is not counted), not only the plan's marked ones. Log: `codegen.parts_check` `ok` carries `moved` (a count) when a part was counted that way. Bug runs, a switch that is off and a design without parts: nothing changes. Tests first for both outcomes (moved, kept), an unrelated route, one route for one part, the last gate and the git helper; twelve mutations of the new rules, all caught.
|
package/dist/index.js
CHANGED
|
@@ -40684,6 +40684,7 @@ function parseJUnitOutcomes(xml) {
|
|
|
40684
40684
|
const discoveredFiles = /* @__PURE__ */ new Set();
|
|
40685
40685
|
const discoveredAutomationIds = /* @__PURE__ */ new Set();
|
|
40686
40686
|
let unmappedEntries = 0;
|
|
40687
|
+
const unmappedCases = [];
|
|
40687
40688
|
TESTSUITE_OPEN_RE.lastIndex = 0;
|
|
40688
40689
|
let suiteMatch;
|
|
40689
40690
|
while (suiteMatch = TESTSUITE_OPEN_RE.exec(xml)) {
|
|
@@ -40726,7 +40727,10 @@ function parseJUnitOutcomes(xml) {
|
|
|
40726
40727
|
const file = FILE_ATTR_RE.exec(attrs)?.[1];
|
|
40727
40728
|
if (file) discoveredFiles.add(normalizeSlashes(file));
|
|
40728
40729
|
if (classname && looksLikeFilePath(classname.trim())) discoveredFiles.add(normalizeSlashes(classname));
|
|
40729
|
-
if (!file?.trim() && !(classname && looksLikeFilePath(classname.trim())))
|
|
40730
|
+
if (!file?.trim() && !(classname && looksLikeFilePath(classname.trim()))) {
|
|
40731
|
+
unmappedEntries += 1;
|
|
40732
|
+
unmappedCases.push({ ...classname !== void 0 ? { classname } : {}, name: c.name });
|
|
40733
|
+
}
|
|
40730
40734
|
const bracket = QP_TOKEN_BRACKET_RE.exec(name2)?.[1];
|
|
40731
40735
|
if (bracket) {
|
|
40732
40736
|
discoveredAutomationIds.add(bracket);
|
|
@@ -40735,7 +40739,7 @@ function parseJUnitOutcomes(xml) {
|
|
|
40735
40739
|
if (!seen || RESULT_RANK[result] > RESULT_RANK[seen]) automationIdResults.set(bracket, result);
|
|
40736
40740
|
}
|
|
40737
40741
|
}
|
|
40738
|
-
return { outcomes, automationIdResults, failureText, failureWhere, failureDetail, discoveredFiles, discoveredAutomationIds, unmappedEntries };
|
|
40742
|
+
return { outcomes, automationIdResults, failureText, failureWhere, failureDetail, discoveredFiles, discoveredAutomationIds, unmappedEntries, unmappedCases };
|
|
40739
40743
|
}
|
|
40740
40744
|
var FRESH_SLACK_MS = 2e3;
|
|
40741
40745
|
function readJUnitOutcomes(cwd, freshSinceMs) {
|
|
@@ -40759,7 +40763,8 @@ function mergeParsed(all) {
|
|
|
40759
40763
|
failureDetail: /* @__PURE__ */ new Map(),
|
|
40760
40764
|
discoveredFiles: /* @__PURE__ */ new Set(),
|
|
40761
40765
|
discoveredAutomationIds: /* @__PURE__ */ new Set(),
|
|
40762
|
-
unmappedEntries: 0
|
|
40766
|
+
unmappedEntries: 0,
|
|
40767
|
+
unmappedCases: []
|
|
40763
40768
|
};
|
|
40764
40769
|
for (const p of all) {
|
|
40765
40770
|
for (const [id, passed] of p.outcomes) out2.outcomes.set(id, (out2.outcomes.get(id) ?? true) && passed);
|
|
@@ -40773,6 +40778,7 @@ function mergeParsed(all) {
|
|
|
40773
40778
|
for (const f of p.discoveredFiles) out2.discoveredFiles.add(f);
|
|
40774
40779
|
for (const id of p.discoveredAutomationIds) out2.discoveredAutomationIds.add(id);
|
|
40775
40780
|
out2.unmappedEntries += p.unmappedEntries;
|
|
40781
|
+
out2.unmappedCases.push(...p.unmappedCases);
|
|
40776
40782
|
}
|
|
40777
40783
|
return out2;
|
|
40778
40784
|
}
|
|
@@ -40788,7 +40794,8 @@ function snapshotOf(outcome, parsed) {
|
|
|
40788
40794
|
failureDetail: parsed?.failureDetail,
|
|
40789
40795
|
discoveredFiles: parsed?.discoveredFiles ?? null,
|
|
40790
40796
|
discoveredAutomationIds: parsed?.discoveredAutomationIds ?? null,
|
|
40791
|
-
unmappedEntries: parsed?.unmappedEntries
|
|
40797
|
+
unmappedEntries: parsed?.unmappedEntries,
|
|
40798
|
+
unmappedCases: parsed?.unmappedCases
|
|
40792
40799
|
};
|
|
40793
40800
|
}
|
|
40794
40801
|
async function captureLimited(command, cwd, limitMs) {
|
|
@@ -40811,7 +40818,8 @@ function captureTestSnapshot(command, cwd = process.cwd(), opts) {
|
|
|
40811
40818
|
failureDetail: parsed?.failureDetail,
|
|
40812
40819
|
discoveredFiles: parsed?.discoveredFiles ?? null,
|
|
40813
40820
|
discoveredAutomationIds: parsed?.discoveredAutomationIds ?? null,
|
|
40814
|
-
unmappedEntries: parsed?.unmappedEntries
|
|
40821
|
+
unmappedEntries: parsed?.unmappedEntries,
|
|
40822
|
+
unmappedCases: parsed?.unmappedCases
|
|
40815
40823
|
};
|
|
40816
40824
|
}
|
|
40817
40825
|
function readTestSnapshot(outcome, cwd = process.cwd(), freshSinceMs) {
|
|
@@ -40824,7 +40832,8 @@ function readTestSnapshot(outcome, cwd = process.cwd(), freshSinceMs) {
|
|
|
40824
40832
|
failureDetail: parsed?.failureDetail,
|
|
40825
40833
|
discoveredFiles: parsed?.discoveredFiles ?? null,
|
|
40826
40834
|
discoveredAutomationIds: parsed?.discoveredAutomationIds ?? null,
|
|
40827
|
-
unmappedEntries: parsed?.unmappedEntries
|
|
40835
|
+
unmappedEntries: parsed?.unmappedEntries,
|
|
40836
|
+
unmappedCases: parsed?.unmappedCases
|
|
40828
40837
|
};
|
|
40829
40838
|
}
|
|
40830
40839
|
function readTestSnapshotAt(outcome, reportPath) {
|
|
@@ -40850,7 +40859,8 @@ async function captureBaselineSnapshot(command, cwd = process.cwd(), opts) {
|
|
|
40850
40859
|
failureDetail: parsed?.failureDetail,
|
|
40851
40860
|
discoveredFiles: parsed?.discoveredFiles ?? null,
|
|
40852
40861
|
discoveredAutomationIds: parsed?.discoveredAutomationIds ?? null,
|
|
40853
|
-
unmappedEntries: parsed?.unmappedEntries
|
|
40862
|
+
unmappedEntries: parsed?.unmappedEntries,
|
|
40863
|
+
unmappedCases: parsed?.unmappedCases
|
|
40854
40864
|
};
|
|
40855
40865
|
}
|
|
40856
40866
|
function checkForRegressions(baseline, after) {
|
|
@@ -47261,7 +47271,17 @@ function createCodegenWorkspace(args2) {
|
|
|
47261
47271
|
if (amendable.has(path) && tool === "edit_file") return null;
|
|
47262
47272
|
return { fail: { status: "protected", reason: isTestPath(path) ? "test_frozen" : "code_locked", message: "Only the named failing test may change in this step, and only by edit_file." } };
|
|
47263
47273
|
}
|
|
47264
|
-
|
|
47274
|
+
if (!isTestPath(path)) return null;
|
|
47275
|
+
if (frozen.has(path) && !looksLikeTest(path) && !protectedTests.has(path)) {
|
|
47276
|
+
return {
|
|
47277
|
+
fail: {
|
|
47278
|
+
status: "protected",
|
|
47279
|
+
reason: "test_frozen",
|
|
47280
|
+
message: `If the code must change in ${path}, answer CANNOT_COMPLETE and name it: it is frozen in this phase because phase 1 wrote this change's test cases into it.`
|
|
47281
|
+
}
|
|
47282
|
+
};
|
|
47283
|
+
}
|
|
47284
|
+
return { fail: { status: "protected", reason: "test_frozen", message: "The tests are frozen in this phase: change the code, not the tests." } };
|
|
47265
47285
|
};
|
|
47266
47286
|
const edits = /* @__PURE__ */ new Map();
|
|
47267
47287
|
const created = /* @__PURE__ */ new Map();
|
|
@@ -49418,8 +49438,8 @@ function partMissingSentence(missing, opts = {}) {
|
|
|
49418
49438
|
var MAX_NAMES = 2;
|
|
49419
49439
|
var MAX_HINT_CHARS = 300;
|
|
49420
49440
|
var MIN_NAME_CHARS = 8;
|
|
49421
|
-
var SAME_FAILURE_TAIL = " If it should now pass, check the code; if
|
|
49422
|
-
var SAME_FAILURE_TAIL_SHORT = " If it should now pass, check the code; if
|
|
49441
|
+
var SAME_FAILURE_TAIL = " If it should now pass, check the code; if the test itself looks wrong (say, a 500 from set-up it lacks), name it in CANNOT_COMPLETE.";
|
|
49442
|
+
var SAME_FAILURE_TAIL_SHORT = " If it should now pass, check the code; if the test itself looks wrong, name it in CANNOT_COMPLETE.";
|
|
49423
49443
|
var collapse = (text3) => text3.replace(/\s+/g, " ").trim();
|
|
49424
49444
|
var line = (text3) => collapse(
|
|
49425
49445
|
(text3.split("\n").find((l) => l.trim() !== "") ?? "").replace(/\s*\[at [^\]]*\]/g, "")
|
|
@@ -49519,6 +49539,8 @@ var CodegenLoopFailure = class extends Error {
|
|
|
49519
49539
|
featureKey;
|
|
49520
49540
|
/** QUIKTR-2445: the AI Runtime refused a request that carried `databaseChange` (the step then stops `needs_database_change`). */
|
|
49521
49541
|
databaseKey;
|
|
49542
|
+
/** QUIKTR-2468: the refusal came on a later turn, not the loop's first request: about that request, never the version. */
|
|
49543
|
+
late;
|
|
49522
49544
|
constructor(reason, runtimeCode, cause, detail, told) {
|
|
49523
49545
|
super(`pilot.codegen loop failed: ${reason}${runtimeCode ? ` (${runtimeCode})` : ""}`);
|
|
49524
49546
|
this.name = "CodegenLoopFailure";
|
|
@@ -50097,16 +50119,21 @@ async function runCodegenLoop(args2, deps) {
|
|
|
50097
50119
|
checkHardFailure(envelope, "pilot.codegen");
|
|
50098
50120
|
} catch (err2) {
|
|
50099
50121
|
if (code === "CONTRACT_REJECTED") {
|
|
50100
|
-
const
|
|
50101
|
-
const rule = typeof
|
|
50102
|
-
const text3 = rule || (typeof
|
|
50122
|
+
const said2 = envelope;
|
|
50123
|
+
const rule = typeof said2?.normalizedText === "string" && said2.normalizedText.trim() ? said2.normalizedText : "";
|
|
50124
|
+
const text3 = rule || (typeof said2?.error === "string" ? said2.error : "");
|
|
50103
50125
|
const reason = text3.trim() ? firstLine(scrub(text3), void 0, 300) : "";
|
|
50104
50126
|
const version2 = contextData.contractVersion;
|
|
50105
|
-
log({ event: "codegen.contract_rejected", turn, ...typeof version2 === "string" ? { version: version2 } : {}, ...reason ? { reason } : {} });
|
|
50127
|
+
log({ event: "codegen.contract_rejected", turn, ...typeof version2 === "string" ? { version: version2 } : {}, ...reason ? { reason } : {}, ...turn > 1 || args2.lane?.kind === "code" ? { late: true } : {} });
|
|
50106
50128
|
}
|
|
50107
50129
|
const failure = new CodegenLoopFailure(code === "CONTRACT_REJECTED" ? "contract_rejected" : "semantic_mismatch", String(code), err2);
|
|
50108
|
-
|
|
50109
|
-
if (
|
|
50130
|
+
const late = code === "CONTRACT_REJECTED" && (turn > 1 || args2.lane?.kind === "code");
|
|
50131
|
+
if (late) failure.late = true;
|
|
50132
|
+
const said = envelope;
|
|
50133
|
+
const refusalText = `${typeof said?.normalizedText === "string" ? said.normalizedText : ""} ${typeof said?.error === "string" ? said.error : ""}`;
|
|
50134
|
+
const blames = (key) => !late || refusalText.includes(key);
|
|
50135
|
+
if (code === "CONTRACT_REJECTED" && contextData[FEATURE_TEST_UPDATES_KEY] === true && blames(FEATURE_TEST_UPDATES_KEY)) failure.featureKey = true;
|
|
50136
|
+
if (code === "CONTRACT_REJECTED" && contextData[DATABASE_CHANGE_KEY] !== void 0 && blames(DATABASE_CHANGE_KEY)) failure.databaseKey = true;
|
|
50110
50137
|
throw failure;
|
|
50111
50138
|
}
|
|
50112
50139
|
if (envelope?.success === false) {
|
|
@@ -52038,37 +52065,37 @@ async function runCodegenStep(p) {
|
|
|
52038
52065
|
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.databaseKey === true && p.databaseChange && p.databaseChange.length > 0) {
|
|
52039
52066
|
throw databaseStop(first.failure, "key_refused");
|
|
52040
52067
|
}
|
|
52041
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.runScratch && args2?.runScratch) {
|
|
52068
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.runScratch && args2?.runScratch) {
|
|
52042
52069
|
log({ event: "codegen.version_fallback", from: "codegen-loop-9", to: "codegen-loop-8" });
|
|
52043
52070
|
p.runScratch = void 0;
|
|
52044
52071
|
args2 = buildCodegenLoopArgs(p, context);
|
|
52045
52072
|
first = await attempt2();
|
|
52046
52073
|
}
|
|
52047
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.fixFirst === true && args2?.fixFirst === true) {
|
|
52074
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.fixFirst === true && args2?.fixFirst === true) {
|
|
52048
52075
|
log({ event: "codegen.version_fallback", from: "codegen-loop-8", to: "codegen-loop-7" });
|
|
52049
52076
|
p.fixFirst = false;
|
|
52050
52077
|
args2 = buildCodegenLoopArgs(p, context);
|
|
52051
52078
|
first = await attempt2();
|
|
52052
52079
|
}
|
|
52053
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.conflicts && args2?.conflicts) {
|
|
52080
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.conflicts && args2?.conflicts) {
|
|
52054
52081
|
log({ event: "codegen.version_fallback", from: "codegen-loop-7", to: "codegen-loop-6" });
|
|
52055
52082
|
p.conflicts = void 0;
|
|
52056
52083
|
args2 = buildCodegenLoopArgs(p, context);
|
|
52057
52084
|
first = await attempt2();
|
|
52058
52085
|
}
|
|
52059
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.tools2?.notes === true && args2?.harness === true) {
|
|
52086
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.tools2?.notes === true && args2?.harness === true) {
|
|
52060
52087
|
log({ event: "codegen.version_fallback", from: "codegen-loop-6", to: "codegen-loop-5" });
|
|
52061
52088
|
p.tools2 = { ...p.tools2, notes: false };
|
|
52062
52089
|
args2 = buildCodegenLoopArgs(p, context);
|
|
52063
52090
|
first = await attempt2();
|
|
52064
52091
|
}
|
|
52065
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.tools2 && args2?.harness === true) {
|
|
52092
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.tools2 && args2?.harness === true) {
|
|
52066
52093
|
log({ event: "codegen.version_fallback", from: "codegen-loop-5", to: p.scope?.view === "map" ? "codegen-loop-4" : "codegen-loop-3" });
|
|
52067
52094
|
p.tools2 = void 0;
|
|
52068
52095
|
args2 = buildCodegenLoopArgs(p, context);
|
|
52069
52096
|
first = await attempt2();
|
|
52070
52097
|
}
|
|
52071
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && p.scope?.view === "map") {
|
|
52098
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && p.scope?.view === "map") {
|
|
52072
52099
|
const view = repoViewOf(p.scope);
|
|
52073
52100
|
p.out.loop = buildCodegenLoopRecord({
|
|
52074
52101
|
...first.failure.summary ?? NO_SUMMARY,
|
|
@@ -52078,7 +52105,7 @@ async function runCodegenStep(p) {
|
|
|
52078
52105
|
log({ event: "codegen.map_failed", reason: "contract_rejected" });
|
|
52079
52106
|
throw new MapModeError("codegen", "contract_rejected");
|
|
52080
52107
|
}
|
|
52081
|
-
if ("failure" in first && first.failure.reason === "contract_rejected" && args2?.harness === true) {
|
|
52108
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.late !== true && args2?.harness === true) {
|
|
52082
52109
|
if (p.databaseChange && p.databaseChange.length > 0) throw databaseStop(first.failure, "no_harness");
|
|
52083
52110
|
log({ event: "codegen.version_fallback", from: "codegen-loop-3", to: "codegen-loop-2" });
|
|
52084
52111
|
p.harness = false;
|
|
@@ -52098,7 +52125,7 @@ async function runCodegenStep(p) {
|
|
|
52098
52125
|
const f1 = first.failure;
|
|
52099
52126
|
log({ event: "codegen.attempt_end", attempt: 1, outcome: "failed", reason: f1.reason, ...f1.afterRecovery ? { afterRecovery: true } : {}, turns: f1.summary?.turns ?? 0, toolCalls: f1.summary?.toolCalls ?? 0, durationMs: firstMs });
|
|
52100
52127
|
const said = f1.detail ? `: ${f1.detail}` : "";
|
|
52101
|
-
if (f1.reason === "contract_rejected") {
|
|
52128
|
+
if (f1.reason === "contract_rejected" && f1.late !== true) {
|
|
52102
52129
|
p.out.loop = buildCodegenLoopRecord({ ...f1.summary ?? NO_SUMMARY, stopReason: "fallback", fellBack: true, fallbackReason: f1.reason });
|
|
52103
52130
|
warn(p, `The code-writing loop could not finish (${f1.reason}${said}), so the files were written one at a time instead.`);
|
|
52104
52131
|
await guardTree();
|
|
@@ -54117,7 +54144,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
54117
54144
|
var REPORT_COPY = "final-test-report.xml";
|
|
54118
54145
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
54119
54146
|
var MAX_FILES = 200;
|
|
54120
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
54147
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.81" : "dev";
|
|
54121
54148
|
function safeDestination(base, repoPath) {
|
|
54122
54149
|
if (!repoPath || (0, import_node_path28.isAbsolute)(repoPath)) return null;
|
|
54123
54150
|
const destination = (0, import_node_path28.resolve)(base, repoPath);
|
|
@@ -54383,7 +54410,9 @@ function buildTestDiscovery(i3) {
|
|
|
54383
54410
|
if (match) found.add(match);
|
|
54384
54411
|
else dropped.add(withoutDotSlash(slashes(raw.trim())));
|
|
54385
54412
|
}
|
|
54386
|
-
const
|
|
54413
|
+
const placed = placeUnmapped(snapshot.unmappedCases ?? [], listing, i3.workspaceRoot, i3.readText);
|
|
54414
|
+
for (const f of placed.files) found.add(f);
|
|
54415
|
+
const unmapped = snapshot.unmappedEntries - placed.count + dropped.size;
|
|
54387
54416
|
const files = [...found].sort();
|
|
54388
54417
|
return {
|
|
54389
54418
|
value: { report: "PRESENT", discoveredTestFiles: files, unmappedEntries: unmapped },
|
|
@@ -54393,6 +54422,76 @@ function buildTestDiscovery(i3) {
|
|
|
54393
54422
|
unmapped
|
|
54394
54423
|
};
|
|
54395
54424
|
}
|
|
54425
|
+
function placeUnmapped(cases, listing, workspaceRoot, readText) {
|
|
54426
|
+
const files = /* @__PURE__ */ new Set();
|
|
54427
|
+
let count3 = 0;
|
|
54428
|
+
if (cases.length === 0) return { files, count: count3 };
|
|
54429
|
+
const root = workspaceRoot ? withoutDotSlash(slashes(workspaceRoot)).replace(/\/+$/, "") : "";
|
|
54430
|
+
const inListing2 = (p) => listing.has(p) ? p : root && listing.has(`${root}/${p}`) ? `${root}/${p}` : null;
|
|
54431
|
+
const isTest = testRule(null);
|
|
54432
|
+
const pythonFile = (classname) => {
|
|
54433
|
+
if (!/^[A-Za-z_][\w.]*$/.test(classname)) return null;
|
|
54434
|
+
const parts2 = classname.split(".");
|
|
54435
|
+
for (let k = parts2.length; k > 0; k--) {
|
|
54436
|
+
const hit = inListing2(`${parts2.slice(0, k).join("/")}.py`);
|
|
54437
|
+
if (hit) return isTest(hit) ? hit : null;
|
|
54438
|
+
}
|
|
54439
|
+
return null;
|
|
54440
|
+
};
|
|
54441
|
+
const texts = /* @__PURE__ */ new Map();
|
|
54442
|
+
const text3 = (p) => {
|
|
54443
|
+
if (!texts.has(p)) texts.set(p, readText ? readText(p) : null);
|
|
54444
|
+
return texts.get(p) ?? null;
|
|
54445
|
+
};
|
|
54446
|
+
const dirOf3 = (p) => p.includes("/") ? p.slice(0, p.lastIndexOf("/")) : "";
|
|
54447
|
+
let modules = null;
|
|
54448
|
+
const goModules = () => {
|
|
54449
|
+
if (modules) return modules;
|
|
54450
|
+
const found = [];
|
|
54451
|
+
for (const p of listing) {
|
|
54452
|
+
if (p !== "go.mod" && !p.endsWith("/go.mod")) continue;
|
|
54453
|
+
const m = /^\s*module\s+"?([^"\s]+)"?/m.exec(text3(p) ?? "");
|
|
54454
|
+
if (m) found.push({ module: m[1], dir: dirOf3(p) });
|
|
54455
|
+
}
|
|
54456
|
+
found.sort((a, b) => b.module.length - a.module.length);
|
|
54457
|
+
modules = found;
|
|
54458
|
+
return found;
|
|
54459
|
+
};
|
|
54460
|
+
let goTests = null;
|
|
54461
|
+
const goTestsIn = (dir) => {
|
|
54462
|
+
if (!goTests) {
|
|
54463
|
+
goTests = /* @__PURE__ */ new Map();
|
|
54464
|
+
for (const p of listing) {
|
|
54465
|
+
if (!p.endsWith("_test.go")) continue;
|
|
54466
|
+
const d = dirOf3(p);
|
|
54467
|
+
goTests.set(d, [...goTests.get(d) ?? [], p]);
|
|
54468
|
+
}
|
|
54469
|
+
}
|
|
54470
|
+
return goTests.get(dir) ?? [];
|
|
54471
|
+
};
|
|
54472
|
+
const goFile = (pkg, name2) => {
|
|
54473
|
+
if (!readText) return null;
|
|
54474
|
+
const owner = goModules().find((m) => pkg === m.module || pkg.startsWith(`${m.module}/`));
|
|
54475
|
+
if (!owner) return null;
|
|
54476
|
+
const rest = pkg === owner.module ? "" : pkg.slice(owner.module.length + 1);
|
|
54477
|
+
const dir = [owner.dir, rest].filter(Boolean).join("/");
|
|
54478
|
+
const fn = name2.split("/")[0] ?? "";
|
|
54479
|
+
if (!/^\w+$/.test(fn)) return null;
|
|
54480
|
+
const declares = new RegExp(`^func\\s+${fn}\\s*\\(`, "m");
|
|
54481
|
+
const hits = goTestsIn(dir).filter((p) => declares.test(text3(p) ?? ""));
|
|
54482
|
+
return hits.length === 1 ? hits[0] : null;
|
|
54483
|
+
};
|
|
54484
|
+
for (const c of cases) {
|
|
54485
|
+
const classname = c.classname?.trim();
|
|
54486
|
+
if (!classname) continue;
|
|
54487
|
+
const hit = pythonFile(classname) ?? goFile(classname, c.name);
|
|
54488
|
+
if (hit) {
|
|
54489
|
+
files.add(hit);
|
|
54490
|
+
count3 += 1;
|
|
54491
|
+
}
|
|
54492
|
+
}
|
|
54493
|
+
return { files, count: count3 };
|
|
54494
|
+
}
|
|
54396
54495
|
var DEFAULT_DISCOVERY_WAIT_MS = 9e4;
|
|
54397
54496
|
var MAX_DISCOVERY_WAIT_MS = 36e5;
|
|
54398
54497
|
function discoveryWaitMs(env2 = process.env) {
|
|
@@ -54416,10 +54515,13 @@ var TIMEOUT_WARNING = "QuikPilot could not list the project's test files in time
|
|
|
54416
54515
|
function lateReportWarning(waitedSeconds, namedTestFiles) {
|
|
54417
54516
|
return `The project's test report was not ready after ${waitedSeconds} seconds, so QuikPilot skipped the early check of where tests are placed. ${namedTestFiles} files look like tests by their names; the names were counted, not used for that check.`;
|
|
54418
54517
|
}
|
|
54518
|
+
function unplacedWarning(tests) {
|
|
54519
|
+
return `The project's test report named ${tests} tests, but QuikPilot could not place any of them on a file, so it skipped the early check of where tests are placed.`;
|
|
54520
|
+
}
|
|
54419
54521
|
async function resolveTestDiscovery(i3) {
|
|
54420
54522
|
const now = i3.now ?? Date.now;
|
|
54421
54523
|
const started = now();
|
|
54422
|
-
const base = { command: i3.command, listing: i3.listing, workspaceRoot: i3.workspaceRoot, cwd: i3.cwd };
|
|
54524
|
+
const base = { command: i3.command, listing: i3.listing, workspaceRoot: i3.workspaceRoot, cwd: i3.cwd, ...i3.readText ? { readText: i3.readText } : {} };
|
|
54423
54525
|
const done = (result, warning) => {
|
|
54424
54526
|
const waitedMs = now() - started;
|
|
54425
54527
|
const named2 = i3.namedTestFiles ?? 0;
|
|
@@ -54442,7 +54544,9 @@ async function resolveTestDiscovery(i3) {
|
|
|
54442
54544
|
const named2 = i3.namedTestFiles ?? 0;
|
|
54443
54545
|
return done(absent("timeout"), named2 > 0 ? lateReportWarning(Math.round(i3.waitMs / 1e3), named2) : TIMEOUT_WARNING);
|
|
54444
54546
|
}
|
|
54445
|
-
|
|
54547
|
+
const built = buildTestDiscovery({ ...base, snapshot: first });
|
|
54548
|
+
const unplaced = first?.unmappedCases?.length ?? 0;
|
|
54549
|
+
return done(built, built.source === "live" && built.files === 0 && unplaced > 0 ? unplacedWarning(unplaced) : void 0);
|
|
54446
54550
|
} finally {
|
|
54447
54551
|
if (timer !== void 0) clearTimeout(timer);
|
|
54448
54552
|
}
|
|
@@ -55021,7 +55125,15 @@ async function run2(env2) {
|
|
|
55021
55125
|
waitMs: discoveryWaitMs(),
|
|
55022
55126
|
// QUIKTR-1854 - how many files look like tests by their names, so a late report is described as what it was.
|
|
55023
55127
|
namedTestFiles: workspaceListing.filter(testRule(null)).length,
|
|
55024
|
-
log: (e) => console.log(JSON.stringify(e))
|
|
55128
|
+
log: (e) => console.log(JSON.stringify(e)),
|
|
55129
|
+
// QUIKTR-2465 item 3: Go's tests are placed by the file that declares them (and go.mod's module). Listing paths are relative to the checkout.
|
|
55130
|
+
readText: (p) => {
|
|
55131
|
+
try {
|
|
55132
|
+
return (0, import_node_fs29.readFileSync)(p, "utf8");
|
|
55133
|
+
} catch {
|
|
55134
|
+
return null;
|
|
55135
|
+
}
|
|
55136
|
+
}
|
|
55025
55137
|
});
|
|
55026
55138
|
const settledBaseline = discovery.result.reason === "timeout" || discovery.result.reason === "no_command" ? void 0 : await baselineRun.then((b) => b.snapshot, () => null);
|
|
55027
55139
|
const twoPhaseSkip = twoPhaseSkipReason(discovery.result.reason, settledBaseline);
|