@quikit/quikpilot-runner 9.3.0-rc.44 → 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 +4 -0
- package/dist/index.js +213 -7
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,10 @@ wrong (a field that arrives from a database row or a request), so it only warns
|
|
|
160
160
|
|
|
161
161
|
**9.3.0-rc.44 — every existing test that pins the bug is found and asked about in one decision (QUIKTR-1827).** On 25 Oct the AI wrote the right fix for the "logged-in users get 401" bug, and the run still failed: two existing tests said the bug was correct, and QuikPilot could ask about one. (A) A test written once for every row of a table (`describe.each`, `it.each`, tagged-template tables too) is now reported by its title as written. It is checked against every row of the test run made before the change, the edit must stay inside the test's function, the report says how many rows there are, and one approval changes the test for every row; `generated_test` now means none of its rows was in that run. (B) An answer that gives up (CANNOT_COMPLETE) while existing tests the change broke are neither reported nor explained is sent back once, as a refused turn with the rule `give_up_rule` that names them by file and test (rows of a table as one line, never a failure message); if it gives up again, the failure names them as existing tests that may expect the old behaviour. (C) In the tests phase the AI is given up to 10 existing test files that import the code to change (`testsToCheck`), to read before it writes anything. (D) A fix that starts from existing tests the change broke may report them and stop for a person, as the first attempt does. Needs the AI Runtime of QUIKTR-1827 (`testsToCheck`, `give_up_rule`) and QuikProjects with the optional `rows` field of a test conflict; with an older AI Runtime the new key and word are refused and the attempt steps back as it always did. Also in rc.44: everything in rc.43. Nothing else changes.
|
|
162
162
|
|
|
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
|
+
|
|
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
|
+
|
|
163
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.
|
|
164
168
|
|
|
165
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
|
@@ -24773,6 +24773,106 @@ function readTestHistory(input) {
|
|
|
24773
24773
|
}
|
|
24774
24774
|
}
|
|
24775
24775
|
|
|
24776
|
+
// src/staleExpectations.ts
|
|
24777
|
+
var MAX_TOKENS = 4;
|
|
24778
|
+
var MAX_TOKEN_CHARS = 60;
|
|
24779
|
+
var MAX_COMMENT_LINES = 6;
|
|
24780
|
+
var MIN_STRING_CHARS = 3;
|
|
24781
|
+
function expectationTokens(code) {
|
|
24782
|
+
const out = /* @__PURE__ */ new Set();
|
|
24783
|
+
for (const m of code.matchAll(/(["'`])((?:\\.|(?!\1)[^\\\n]){3,200})\1/g)) {
|
|
24784
|
+
const value = (m[2] ?? "").trim();
|
|
24785
|
+
if (value.length >= MIN_STRING_CHARS) out.add(value);
|
|
24786
|
+
}
|
|
24787
|
+
for (const m of code.matchAll(/(?<![\w.])(?:\d{3,}|\d+\.\d+)(?![\w.])/g)) out.add(m[0]);
|
|
24788
|
+
return out;
|
|
24789
|
+
}
|
|
24790
|
+
function commentsOf(text2) {
|
|
24791
|
+
const comments = [];
|
|
24792
|
+
let code = "";
|
|
24793
|
+
let line = 0;
|
|
24794
|
+
let i2 = 0;
|
|
24795
|
+
let quote = null;
|
|
24796
|
+
while (i2 < text2.length) {
|
|
24797
|
+
const c = text2[i2];
|
|
24798
|
+
if (quote) {
|
|
24799
|
+
code += c;
|
|
24800
|
+
if (c === "\\" && i2 + 1 < text2.length) {
|
|
24801
|
+
code += text2[i2 + 1];
|
|
24802
|
+
if (text2[i2 + 1] === "\n") line += 1;
|
|
24803
|
+
i2 += 2;
|
|
24804
|
+
continue;
|
|
24805
|
+
}
|
|
24806
|
+
if (c === quote) quote = null;
|
|
24807
|
+
if (c === "\n") line += 1;
|
|
24808
|
+
i2 += 1;
|
|
24809
|
+
continue;
|
|
24810
|
+
}
|
|
24811
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
24812
|
+
quote = c;
|
|
24813
|
+
code += c;
|
|
24814
|
+
i2 += 1;
|
|
24815
|
+
continue;
|
|
24816
|
+
}
|
|
24817
|
+
if (c === "/" && text2[i2 + 1] === "/") {
|
|
24818
|
+
let end = i2;
|
|
24819
|
+
while (end < text2.length && text2[end] !== "\n") end += 1;
|
|
24820
|
+
comments.push({ line, text: text2.slice(i2 + 2, end) });
|
|
24821
|
+
i2 = end;
|
|
24822
|
+
continue;
|
|
24823
|
+
}
|
|
24824
|
+
if (c === "/" && text2[i2 + 1] === "*") {
|
|
24825
|
+
const close = text2.indexOf("*/", i2 + 2);
|
|
24826
|
+
const stop = close === -1 ? text2.length : close + 2;
|
|
24827
|
+
const body = text2.slice(i2 + 2, close === -1 ? text2.length : close);
|
|
24828
|
+
body.split("\n").forEach((part, k) => comments.push({ line: line + k, text: part }));
|
|
24829
|
+
for (const ch of text2.slice(i2, stop)) if (ch === "\n") {
|
|
24830
|
+
code += "\n";
|
|
24831
|
+
line += 1;
|
|
24832
|
+
}
|
|
24833
|
+
i2 = stop;
|
|
24834
|
+
continue;
|
|
24835
|
+
}
|
|
24836
|
+
code += c;
|
|
24837
|
+
if (c === "\n") line += 1;
|
|
24838
|
+
i2 += 1;
|
|
24839
|
+
}
|
|
24840
|
+
return { comments, code };
|
|
24841
|
+
}
|
|
24842
|
+
var escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24843
|
+
function appearsIn(text2, token) {
|
|
24844
|
+
const isWord = (ch) => ch !== void 0 && /\w/.test(ch);
|
|
24845
|
+
const left = isWord(token[0]) ? "(?<!\\w|\\d\\.)" : "";
|
|
24846
|
+
const right = isWord(token[token.length - 1]) ? "(?!\\w|\\.\\d)" : "";
|
|
24847
|
+
return new RegExp(`${left}${escapeRegExp(token)}${right}`, "i").test(text2);
|
|
24848
|
+
}
|
|
24849
|
+
function staleExpectations(input) {
|
|
24850
|
+
const removed = [...expectationTokens(input.find)].filter((t) => !expectationTokens(input.replace).has(t));
|
|
24851
|
+
if (removed.length === 0) return null;
|
|
24852
|
+
const { comments, code } = commentsOf(input.newTestText);
|
|
24853
|
+
const codeOnly = input.newTitle ? code.replace(input.newTitle, "") : code;
|
|
24854
|
+
const stale = removed.filter((t) => !appearsIn(codeOnly, t));
|
|
24855
|
+
const hits = [];
|
|
24856
|
+
const lines = /* @__PURE__ */ new Set();
|
|
24857
|
+
let inTitle = false;
|
|
24858
|
+
for (const token of stale) {
|
|
24859
|
+
let hit = false;
|
|
24860
|
+
if (input.newTitle && appearsIn(input.newTitle, token)) {
|
|
24861
|
+
inTitle = true;
|
|
24862
|
+
hit = true;
|
|
24863
|
+
}
|
|
24864
|
+
for (const c of comments) {
|
|
24865
|
+
if (appearsIn(c.text, token)) {
|
|
24866
|
+
lines.add(input.firstLine + c.line);
|
|
24867
|
+
hit = true;
|
|
24868
|
+
}
|
|
24869
|
+
}
|
|
24870
|
+
if (hit) hits.push(token.length > MAX_TOKEN_CHARS ? `${token.slice(0, MAX_TOKEN_CHARS - 1)}\u2026` : token);
|
|
24871
|
+
}
|
|
24872
|
+
if (hits.length === 0) return null;
|
|
24873
|
+
return { tokens: hits.slice(0, MAX_TOKENS), inTitle, commentLines: [...lines].sort((a, b) => a - b).slice(0, MAX_COMMENT_LINES) };
|
|
24874
|
+
}
|
|
24875
|
+
|
|
24776
24876
|
// ../../../qp-slim-runner/node_modules/acorn/dist/acorn.mjs
|
|
24777
24877
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
24778
24878
|
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
|
|
@@ -30596,14 +30696,14 @@ function allTests(file) {
|
|
|
30596
30696
|
return [...file.tests, ...file.generated];
|
|
30597
30697
|
}
|
|
30598
30698
|
var PLACEHOLDER = /%[sdifjoOp#%]|\$(?:#|[A-Za-z_]\w*(?:\.\w+)*)/g;
|
|
30599
|
-
var
|
|
30699
|
+
var escapeRegExp2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30600
30700
|
function titlePattern(title) {
|
|
30601
30701
|
let source = "";
|
|
30602
30702
|
let placeholders = false;
|
|
30603
30703
|
let at2 = 0;
|
|
30604
30704
|
for (const m of title.matchAll(PLACEHOLDER)) {
|
|
30605
30705
|
const index = m.index ?? 0;
|
|
30606
|
-
source +=
|
|
30706
|
+
source += escapeRegExp2(title.slice(at2, index));
|
|
30607
30707
|
if (m[0] === "%%") {
|
|
30608
30708
|
source += "%";
|
|
30609
30709
|
} else {
|
|
@@ -30612,7 +30712,7 @@ function titlePattern(title) {
|
|
|
30612
30712
|
}
|
|
30613
30713
|
at2 = index + m[0].length;
|
|
30614
30714
|
}
|
|
30615
|
-
return { source: source +
|
|
30715
|
+
return { source: source + escapeRegExp2(title.slice(at2)), placeholders };
|
|
30616
30716
|
}
|
|
30617
30717
|
function nameEndsWithTitle(name, title) {
|
|
30618
30718
|
return new RegExp(`(?:^|(?: > | \u203A | ))${titlePattern(title).source}$`, "s").test(name);
|
|
@@ -32804,6 +32904,14 @@ function buildProposalFiles(conflicts) {
|
|
|
32804
32904
|
dropped.push(...kept);
|
|
32805
32905
|
continue;
|
|
32806
32906
|
}
|
|
32907
|
+
const after = allTests(located);
|
|
32908
|
+
const stale = /* @__PURE__ */ new Map();
|
|
32909
|
+
for (const c of kept) {
|
|
32910
|
+
const t = after[c.index];
|
|
32911
|
+
if (!t) continue;
|
|
32912
|
+
const found = staleExpectations({ find: c.find, replace: c.replace, newTitle: t.title, newTestText: located.code.slice(t.start, t.end), firstLine: t.startLine });
|
|
32913
|
+
if (found) stale.set(c.index, found);
|
|
32914
|
+
}
|
|
32807
32915
|
files.push({
|
|
32808
32916
|
path,
|
|
32809
32917
|
originalLf: first.originalLf,
|
|
@@ -32811,7 +32919,8 @@ function buildProposalFiles(conflicts) {
|
|
|
32811
32919
|
ending: first.ending,
|
|
32812
32920
|
bom: first.bom,
|
|
32813
32921
|
conflicts: kept,
|
|
32814
|
-
newTitles: new Map(kept.map((c) => [c.index,
|
|
32922
|
+
newTitles: new Map(kept.map((c) => [c.index, after[c.index]?.title ?? c.testTitle])),
|
|
32923
|
+
stale
|
|
32815
32924
|
});
|
|
32816
32925
|
}
|
|
32817
32926
|
return { files, dropped };
|
|
@@ -32855,9 +32964,14 @@ function lineOf2(c, file) {
|
|
|
32855
32964
|
correction: c.correction,
|
|
32856
32965
|
history: c.history,
|
|
32857
32966
|
oldCodeChecked: c.oldCodeChecked === true,
|
|
32858
|
-
...c.rows !== void 0 ? { rows: c.rows } : {}
|
|
32967
|
+
...c.rows !== void 0 ? { rows: c.rows } : {},
|
|
32968
|
+
...file.stale.get(c.index) ? { stale: file.stale.get(c.index) } : {}
|
|
32859
32969
|
};
|
|
32860
32970
|
}
|
|
32971
|
+
function staleNote(s) {
|
|
32972
|
+
const where = [s.inTitle ? "the title" : null, s.commentLines.length > 0 ? `a comment (line${s.commentLines.length === 1 ? "" : "s"} ${s.commentLines.join(", ")})` : null].filter((x) => x !== null).join(" and ");
|
|
32973
|
+
return `Note: ${where} of this test still ${s.inTitle || s.commentLines.length === 1 ? "says" : "say"} ${s.tokens.map((t) => `"${oneLine(t)}"`).join(", ")}, which this change replaces. Fix the wording in the repository, or reject the change.`;
|
|
32974
|
+
}
|
|
32861
32975
|
function oneLine(s) {
|
|
32862
32976
|
return s.replace(/\s+/g, " ").trim();
|
|
32863
32977
|
}
|
|
@@ -32877,6 +32991,7 @@ function buildProposalMessage(input) {
|
|
|
32877
32991
|
...l.history.available ? [` Added ${l.history.addedAt ?? ""} in ${l.history.addedBySha?.slice(0, 10) ?? "a commit"}${l.history.subject ? `: ${oneLine(l.history.subject)}` : ""}`] : [],
|
|
32878
32992
|
...l.history.sameCommitPaths && l.history.sameCommitPaths.length > 0 ? [` The same change also touched: ${l.history.sameCommitPaths.slice(0, 5).join(", ")}${l.history.sameCommitPaths.length > 5 || l.history.sameCommitMore ? ", ..." : ""}`] : [],
|
|
32879
32993
|
...l.oldCodeChecked ? [" With this change the test fails on the code as it is today, so it shows the bug."] : [],
|
|
32994
|
+
...l.stale ? [` ${staleNote(l.stale)}`] : [],
|
|
32880
32995
|
""
|
|
32881
32996
|
]),
|
|
32882
32997
|
"Machine-readable (read back by QuikPilot; do not edit):",
|
|
@@ -32889,6 +33004,11 @@ ${body.join("\n")}
|
|
|
32889
33004
|
}
|
|
32890
33005
|
var isStr = (v, max, min = 1) => typeof v === "string" && v.length >= min && v.length <= max;
|
|
32891
33006
|
var isLine = (v) => typeof v === "number" && Number.isInteger(v) && v >= 1 && v <= 1e7;
|
|
33007
|
+
function isStale(v) {
|
|
33008
|
+
if (typeof v !== "object" || v === null) return false;
|
|
33009
|
+
const s = v;
|
|
33010
|
+
return Array.isArray(s.tokens) && s.tokens.length >= 1 && s.tokens.length <= 4 && s.tokens.every((t) => isStr(t, 60)) && typeof s.inTitle === "boolean" && Array.isArray(s.commentLines) && s.commentLines.length <= 6 && s.commentLines.every(isLine) && (s.inTitle === true || s.commentLines.length > 0);
|
|
33011
|
+
}
|
|
32892
33012
|
function parseProposalMessage(message) {
|
|
32893
33013
|
const out = [];
|
|
32894
33014
|
for (const raw of message.split("\n")) {
|
|
@@ -32903,7 +33023,7 @@ function parseProposalMessage(message) {
|
|
|
32903
33023
|
const o = j;
|
|
32904
33024
|
const c = o.correction;
|
|
32905
33025
|
const h = o.history;
|
|
32906
|
-
if (o.v !== 1 || !isStr(o.path, 300) || !isStr(o.title, 300) || o.newTitle !== void 0 && !isStr(o.newTitle, 300) || !isStr(o.caseId, 64) || !CONFLICT_READINGS.includes(o.reading) || !isLine(o.startLine) || !isLine(o.endLine) || !isLine(o.changeLine) || !isStr(o.reason, 300) || typeof c !== "object" || c === null || !CONFLICT_CASE_FIELDS.includes(c.field) || !isStr(c.text, 1e3) || !isStr(c.why, 300) || typeof h !== "object" || h === null || typeof h.available !== "boolean" || typeof o.oldCodeChecked !== "boolean" || o.rows !== void 0 && !(typeof o.rows === "number" && Number.isInteger(o.rows) && o.rows >= 1 && o.rows <= 1e4)) {
|
|
33026
|
+
if (o.v !== 1 || !isStr(o.path, 300) || !isStr(o.title, 300) || o.newTitle !== void 0 && !isStr(o.newTitle, 300) || !isStr(o.caseId, 64) || !CONFLICT_READINGS.includes(o.reading) || !isLine(o.startLine) || !isLine(o.endLine) || !isLine(o.changeLine) || !isStr(o.reason, 300) || typeof c !== "object" || c === null || !CONFLICT_CASE_FIELDS.includes(c.field) || !isStr(c.text, 1e3) || !isStr(c.why, 300) || typeof h !== "object" || h === null || typeof h.available !== "boolean" || typeof o.oldCodeChecked !== "boolean" || o.rows !== void 0 && !(typeof o.rows === "number" && Number.isInteger(o.rows) && o.rows >= 1 && o.rows <= 1e4) || o.stale !== void 0 && !isStale(o.stale)) {
|
|
32907
33027
|
continue;
|
|
32908
33028
|
}
|
|
32909
33029
|
out.push(o);
|
|
@@ -33577,6 +33697,9 @@ var MAX_TESTS_PER_TARGET = 3;
|
|
|
33577
33697
|
var MAX_REVERSE_TEST_CHARS = 24e3;
|
|
33578
33698
|
var MAX_TEST_FILE_CHARS = 2e5;
|
|
33579
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"]);
|
|
33580
33703
|
var TestCorpus = class {
|
|
33581
33704
|
constructor(listing, readFile, deniedPaths, isTest = isTestTarget) {
|
|
33582
33705
|
this.listing = listing;
|
|
@@ -33621,6 +33744,18 @@ function sharedPrefix(a, b) {
|
|
|
33621
33744
|
while (n < x.length && n < y.length && x[n] === y[n]) n++;
|
|
33622
33745
|
return n;
|
|
33623
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));
|
|
33624
33759
|
function testsImporting(p) {
|
|
33625
33760
|
if (p.limit <= 0 || (p.isTest ?? isTestTarget)(p.target) || !supportsImportScan(p.target)) return [];
|
|
33626
33761
|
const stem = stemOf(p.target);
|
|
@@ -33639,6 +33774,59 @@ function testsImporting(p) {
|
|
|
33639
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));
|
|
33640
33775
|
return hits.slice(0, p.limit).map((h) => h.path);
|
|
33641
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
|
+
}
|
|
33642
33830
|
|
|
33643
33831
|
// src/testAdapters.ts
|
|
33644
33832
|
var import_node_fs9 = require("node:fs");
|
|
@@ -42310,6 +42498,7 @@ async function verifyOnOldCode(conflicts, run2, log = () => void 0) {
|
|
|
42310
42498
|
var import_node_fs16 = require("node:fs");
|
|
42311
42499
|
var import_node_path18 = require("node:path");
|
|
42312
42500
|
var MAX_TESTS_TO_CHECK = 10;
|
|
42501
|
+
var SECOND_HOP_BELOW = 3;
|
|
42313
42502
|
function testsToCheck(i2) {
|
|
42314
42503
|
const limit = Math.min(MAX_TESTS_TO_CHECK, Math.max(0, i2.limit ?? MAX_TESTS_TO_CHECK));
|
|
42315
42504
|
const world = buildTestWorld(i2);
|
|
@@ -42324,6 +42513,23 @@ function testsToCheck(i2) {
|
|
|
42324
42513
|
for (const t of code) {
|
|
42325
42514
|
for (const path of testsImporting({ target: t.path, listing: world.listing, corpus: world.corpus, mapSpecifier: world.mapSpecifier, limit, isTest: world.isTest })) add(path);
|
|
42326
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
|
+
}
|
|
42327
42533
|
return out;
|
|
42328
42534
|
}
|
|
42329
42535
|
var readFromRoot = (root) => (rel) => {
|
|
@@ -44605,7 +44811,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
44605
44811
|
var REPORT_COPY = "final-test-report.xml";
|
|
44606
44812
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
44607
44813
|
var MAX_FILES = 200;
|
|
44608
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
44814
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.46" : "dev";
|
|
44609
44815
|
function safeDestination(base, repoPath) {
|
|
44610
44816
|
if (!repoPath || (0, import_node_path24.isAbsolute)(repoPath)) return null;
|
|
44611
44817
|
const destination = (0, import_node_path24.resolve)(base, repoPath);
|