@quikit/quikpilot-runner 9.3.0-rc.84 → 9.3.0-rc.85
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 +3 -1
- package/dist/index.js +197 -41
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,8 +194,10 @@ wrong (a field that arrives from a database row or a request), so it only warns
|
|
|
194
194
|
|
|
195
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
196
|
|
|
197
|
-
**9.3.0-rc.
|
|
197
|
+
**9.3.0-rc.85 - the person's own request reaches targeting and the code loop (QUIKTR-2509).** A coding agent's ticket names files, routes and tests; capture, questions, spec and design read it, targeting and the code loop never did (F7: the ticket ruled out a route and targeting chose it). QuikProjects can now send two optional packet keys (its switch `QUIKPILOT_TICKET_HINTS`, off by default). `ticketHints`: the paths, server addresses, code names and test names the request names, pulled out with no AI. The runner keeps a path only if its checkout lists it and it is not protected, maps each address to the route files of the checkout that answer it (at most 3), passes names and test names with their caps, and sends `ticketHints` last of every targeting request (single call, loop and map mode) only when something is left; log `targeting.ticket_hints` with counts only. `criteriaWording`: the approved criteria with the person's own quote, last of the task on every code-loop request. An AI Runtime that does not know a key refuses it; the runner asks once more without it (targeting keeps the early look's findings; the code loop keeps its version) and says so in the run's notes. Without the keys every request is today's byte for byte. New tests in `ticketHints.test.ts` and `codegenStepConflicts.more.test.ts`.
|
|
198
198
|
|
|
199
|
+
**9.3.0-rc.84 - targeting is told where a screen's data is loaded from (QUIKTR-2508).** In F7 (QTRIA-61, 10 Nov 2026) targeting never opened `board-column.tsx`, the file the board's cards are loaded from, and planned the data in a route only another screen uses; rc.80 catches that after the code is written, this tells targeting while it looks. Two additions, both off or silent by default. (1) Log only: after targeting answers, in a feature run with design parts, the data-path check of rc.80 is asked of the planned files and one line is logged, `targeting.data_path` with `outcome` `gap`, `ok` or `silent` and the counts `files`, `calls`, `ms`. Nothing uses it. (2) With `QUIKPILOT_SCREEN_TRACE=on`, and only where the loop already has the version-2 look tools (a large repository or map mode), the first `read_file` of a screen file (tsx, jsx, vue, svelte or html; never a test or a denied file) carries one extra key, `shownBy`: the files that show it (two hops, found as the data-path check does) and the server routes they call, for example `[{file: board-column.tsx, loads: [{call: /api/issues, route: app/api/issues/route.ts}]}]`. File names and addresses only, at most 4 files, 2 routes each and 600 characters; the route file is one the AI can list; a file that calls nothing is left out; no result means no key. It costs no tool call and needs no AI Runtime change (the runtime checks that a look answer is an object under its size cap). The scan gives up after 3 seconds. The log line `targeting.screen_trace` carries the outcome, the number of entries and `ms`. Switch off or no version-2 tools: every answer, request and log line is what it was. Not built, on purpose: tags in the file listing (the listing is compared letter for letter by the runner and the AI Runtime) and a new lookup tool (a new contract version with the AI Runtime). New tests in `screenTrace.test.ts`, `screenTrace.loop.test.ts` and `dataPathTargeting.test.ts`, written first; four mutations turn tests red (skip the render-site step, return the wrong route, count test files, drop the size cap).
|
|
200
|
+
|
|
199
201
|
**9.3.0-rc.83 - a `find` that matches nowhere in a test-conflict report says which line differs and how (QUIKTR-2630, second part).** The two G4 runs on rc.82 (11 Nov 2026, QTGO-23 and QTGO-24) followed the new rc.82 advice for an ambiguous `find` and added the following lines, but the retry was rejected `no_match` and the second contradicting test row stayed unreported. A replay on the real test file shows the rows the advice points to match when copied with their tabs, and fail with spaces or a different number of tabs. The reply to `no_match` now finds the place in the file where the most lines of `find` agree once spaces and tabs at the start and end of each line are ignored (of equal places, the one inside the named test) and says: when only whitespace differs, the lines it matches and the first line that differs, with how its start differs (for example `Line 1 of find starts with 8 space(s); line 3597 of the file starts with 2 tab(s)`), or that it differs only after the indent (spaces at the end, line endings); when a line differs for real, the first line of `find` that does not agree and the file line it was compared with; when no line equals the first line, that. Only line numbers, counts and kinds of whitespace are in the reply, never the file's text or the AI's own. A `find` that matches, the `ambiguous` reply of rc.82 and every other rejection word are unchanged; a test helper file (feature mode) keeps the plain sentence. New tests in `testConflict.nomatch.test.ts`, written first (five of seven were red): spaces for tabs, one tab too few, trailing space, a line that really differs, no first line, no echo of text, an exact find still recorded, and the copy inside the named test preferred.
|
|
200
202
|
|
|
201
203
|
**9.3.0-rc.82 - an ambiguous `find` in a test-conflict report says where the copies are and how to make it unique (QUIKTR-2630).** The bench bug G4 (decimal, `ExpHullAbrham`) failed every time, in the rc.79 round and in both rc.81 runs, for one reason: the AI fixed the code, but could not report the second existing test row that asserts the bug (`{"-26.1", 2, "0"}`). That row stands in two tests (`TestDecimal_ExpHullAbrham` and `TestDecimal_ExpTaylor`) with the same rows around it, `find` must match once in the whole file, and the reply to "ambiguous" only said to make it longer. The AI tried one-row spans, then guessed, got `no_match`, and ran out of attempts; the frozen row then blocked the change. Now the reply to an ambiguous `report_test_conflict` lists the lines of every copy, names the copy that is in the named test, and says how many of the next lines (or, when those do not tell the copies apart, the lines before it) of that test make the text unique, for example: copies at lines 3597 and 3664, add the next 2 lines after it (up to line 3599). On the real G4 test file this is exactly the span that matches once. Only line numbers and counts are in the reply, never the file's text or the AI's own. A `find` that matches once, or nowhere, and every other rejection word, are unchanged; a test helper file (feature mode) keeps the plain sentence. Not built: an optional line argument to pick a copy by line (the argument list is the AI Runtime's). New tests in `testConflict.ambiguous.test.ts`, written first (the F8-style duplicated rows in miniature: advice after, advice before, two copies inside one test, no echo of text, unchanged unique and not-found).
|
package/dist/index.js
CHANGED
|
@@ -49621,6 +49621,92 @@ function partMissingSentence(missing, opts = {}) {
|
|
|
49621
49621
|
return `${start3} ${missing[0] ? item(missing[0], true) : ""}`.slice(0, MAX_REFUSED_SENTENCE_CHARS);
|
|
49622
49622
|
}
|
|
49623
49623
|
|
|
49624
|
+
// src/ticketHints.ts
|
|
49625
|
+
var CRITERIA_WORDING_KEY = "criteriaWording";
|
|
49626
|
+
var MAX_HINT_FILES = 20;
|
|
49627
|
+
var MAX_HINT_ROUTES = 10;
|
|
49628
|
+
var MAX_ROUTE_FILES = 3;
|
|
49629
|
+
var MAX_ADDRESS_CHARS = 200;
|
|
49630
|
+
var MAX_HINT_NAMES = 20;
|
|
49631
|
+
var MAX_NAME_CHARS4 = 120;
|
|
49632
|
+
var MAX_HINT_TESTS = 10;
|
|
49633
|
+
var MAX_TEST_CHARS = 200;
|
|
49634
|
+
var MAX_CRITERIA = 20;
|
|
49635
|
+
var MAX_CRITERION_ID_CHARS = 40;
|
|
49636
|
+
var MAX_STATEMENT_CHARS = 500;
|
|
49637
|
+
var MAX_QUOTE_CHARS2 = 200;
|
|
49638
|
+
var METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
49639
|
+
var isRecord5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
49640
|
+
var strings = (v) => Array.isArray(v) ? v.filter((s) => typeof s === "string") : [];
|
|
49641
|
+
var oneLine2 = (s, max) => s.trim() !== "" && s.length <= max && !/[\r\n]/.test(s);
|
|
49642
|
+
var unique3 = (xs) => [...new Set(xs)];
|
|
49643
|
+
var MAX_PATH_CHARS5 = 300;
|
|
49644
|
+
function cleanPath2(p) {
|
|
49645
|
+
return p !== "" && p.length <= MAX_PATH_CHARS5 && !p.startsWith("/") && !p.includes("\\") && !/[\u0000-\u001f\u007f]/.test(p) && p.split("/").every((seg) => seg !== "" && seg !== "." && seg !== "..");
|
|
49646
|
+
}
|
|
49647
|
+
function cleanAddress(a) {
|
|
49648
|
+
return oneLine2(a, MAX_ADDRESS_CHARS) && a.startsWith("/") && !a.startsWith("//") && !/\s/.test(a);
|
|
49649
|
+
}
|
|
49650
|
+
function prepareTicketHints(raw, listing, deniedPaths) {
|
|
49651
|
+
const counts = { files: 0, routes: 0, routeFiles: 0, names: 0, tests: 0, dropped: 0 };
|
|
49652
|
+
if (!isRecord5(raw)) return { counts };
|
|
49653
|
+
const listed = listing instanceof Set ? listing : new Set(listing);
|
|
49654
|
+
const denied = [...deniedPaths];
|
|
49655
|
+
const usable = (p) => cleanPath2(p) && listed.has(p) && matchesDeniedPath(p, denied) === null;
|
|
49656
|
+
const named2 = unique3(strings(raw.paths).map((p) => p.trim()));
|
|
49657
|
+
const files = named2.filter(usable).slice(0, MAX_HINT_FILES);
|
|
49658
|
+
counts.dropped = named2.filter((p) => !usable(p)).length;
|
|
49659
|
+
const routeFiles = [];
|
|
49660
|
+
for (const file of [...listed].sort()) {
|
|
49661
|
+
const address = routeAddressOf(file);
|
|
49662
|
+
if (address !== null && usable(file)) routeFiles.push({ file, address });
|
|
49663
|
+
}
|
|
49664
|
+
const routes = [];
|
|
49665
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49666
|
+
for (const r of Array.isArray(raw.routes) ? raw.routes : []) {
|
|
49667
|
+
if (routes.length >= MAX_HINT_ROUTES) break;
|
|
49668
|
+
if (!isRecord5(r) || typeof r.address !== "string") continue;
|
|
49669
|
+
const address = r.address.trim();
|
|
49670
|
+
if (!cleanAddress(address)) continue;
|
|
49671
|
+
const method = typeof r.method === "string" && METHODS.has(r.method.toUpperCase()) ? r.method.toUpperCase() : void 0;
|
|
49672
|
+
const key = `${method ?? ""} ${address}`;
|
|
49673
|
+
if (seen.has(key)) continue;
|
|
49674
|
+
seen.add(key);
|
|
49675
|
+
const answering = routeFiles.filter((f) => addressMatches(f.address, address));
|
|
49676
|
+
answering.sort((a, b) => Number(b.address === address) - Number(a.address === address) || a.file.localeCompare(b.file));
|
|
49677
|
+
const filesOf = answering.slice(0, MAX_ROUTE_FILES).map((f) => f.file);
|
|
49678
|
+
routes.push({ address, ...method ? { method } : {}, files: filesOf });
|
|
49679
|
+
}
|
|
49680
|
+
const names = unique3(strings(raw.names).map((s) => s.trim())).filter((s) => oneLine2(s, MAX_NAME_CHARS4)).slice(0, MAX_HINT_NAMES);
|
|
49681
|
+
const tests = unique3(strings(raw.tests).map((s) => s.trim())).filter((s) => oneLine2(s, MAX_TEST_CHARS)).slice(0, MAX_HINT_TESTS);
|
|
49682
|
+
counts.files = files.length;
|
|
49683
|
+
counts.routes = routes.length;
|
|
49684
|
+
counts.routeFiles = routes.reduce((n, r) => n + r.files.length, 0);
|
|
49685
|
+
counts.names = names.length;
|
|
49686
|
+
counts.tests = tests.length;
|
|
49687
|
+
const hints = {
|
|
49688
|
+
...files.length > 0 ? { files } : {},
|
|
49689
|
+
...routes.length > 0 ? { routes } : {},
|
|
49690
|
+
...names.length > 0 ? { names } : {},
|
|
49691
|
+
...tests.length > 0 ? { tests } : {}
|
|
49692
|
+
};
|
|
49693
|
+
return Object.keys(hints).length > 0 ? { hints, counts } : { counts };
|
|
49694
|
+
}
|
|
49695
|
+
function prepareCriteriaWording(raw) {
|
|
49696
|
+
if (!Array.isArray(raw)) return void 0;
|
|
49697
|
+
const out2 = [];
|
|
49698
|
+
for (const c of raw) {
|
|
49699
|
+
if (out2.length >= MAX_CRITERIA) break;
|
|
49700
|
+
if (!isRecord5(c) || typeof c.id !== "string" || typeof c.statement !== "string") continue;
|
|
49701
|
+
const id = c.id.trim();
|
|
49702
|
+
const statement = c.statement.trim().slice(0, MAX_STATEMENT_CHARS).trim();
|
|
49703
|
+
if (!oneLine2(id, MAX_CRITERION_ID_CHARS) || statement === "") continue;
|
|
49704
|
+
const quote = typeof c.quote === "string" ? c.quote.trim().slice(0, MAX_QUOTE_CHARS2).trim() : "";
|
|
49705
|
+
out2.push({ id, statement, ...quote !== "" ? { quote } : {} });
|
|
49706
|
+
}
|
|
49707
|
+
return out2.length > 0 ? out2 : void 0;
|
|
49708
|
+
}
|
|
49709
|
+
|
|
49624
49710
|
// src/sameFailureHint.ts
|
|
49625
49711
|
var MAX_NAMES = 2;
|
|
49626
49712
|
var MAX_HINT_CHARS = 300;
|
|
@@ -49726,6 +49812,8 @@ var CodegenLoopFailure = class extends Error {
|
|
|
49726
49812
|
featureKey;
|
|
49727
49813
|
/** QUIKTR-2445: the AI Runtime refused a request that carried `databaseChange` (the step then stops `needs_database_change`). */
|
|
49728
49814
|
databaseKey;
|
|
49815
|
+
/** QUIKTR-2509: the AI Runtime refused a request that carried `criteriaWording` (the step then asks again without it). Wire only. */
|
|
49816
|
+
criteriaKey;
|
|
49729
49817
|
/** QUIKTR-2468: the refusal came on a later turn, not the loop's first request: about that request, never the version. */
|
|
49730
49818
|
late;
|
|
49731
49819
|
constructor(reason, runtimeCode, cause, detail, told) {
|
|
@@ -50321,6 +50409,7 @@ async function runCodegenLoop(args2, deps) {
|
|
|
50321
50409
|
const blames = (key) => !late || refusalText.includes(key);
|
|
50322
50410
|
if (code === "CONTRACT_REJECTED" && contextData[FEATURE_TEST_UPDATES_KEY] === true && blames(FEATURE_TEST_UPDATES_KEY)) failure.featureKey = true;
|
|
50323
50411
|
if (code === "CONTRACT_REJECTED" && contextData[DATABASE_CHANGE_KEY] !== void 0 && blames(DATABASE_CHANGE_KEY)) failure.databaseKey = true;
|
|
50412
|
+
if (code === "CONTRACT_REJECTED" && contextData[CRITERIA_WORDING_KEY] !== void 0 && blames(CRITERIA_WORDING_KEY)) failure.criteriaKey = true;
|
|
50324
50413
|
throw failure;
|
|
50325
50414
|
}
|
|
50326
50415
|
if (envelope?.success === false) {
|
|
@@ -52023,6 +52112,7 @@ function buildCodegenLoopArgs(p, context = collectLoopContext({
|
|
|
52023
52112
|
);
|
|
52024
52113
|
}
|
|
52025
52114
|
if (p.outOfScope.length > 0) baseContext.outOfScope = p.outOfScope;
|
|
52115
|
+
if (p.criteriaWording && p.criteriaWording.length > 0) baseContext[CRITERIA_WORDING_KEY] = p.criteriaWording;
|
|
52026
52116
|
return {
|
|
52027
52117
|
baseContext,
|
|
52028
52118
|
targets: p.targets,
|
|
@@ -52236,6 +52326,13 @@ async function runCodegenStep(p) {
|
|
|
52236
52326
|
log({ event: "codegen.attempt_start", attempt: 1 });
|
|
52237
52327
|
const firstStarted = now();
|
|
52238
52328
|
let first = await attempt2();
|
|
52329
|
+
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.criteriaKey === true && p.criteriaWording) {
|
|
52330
|
+
log({ event: "codegen.version_fallback", from: "criteria_wording" });
|
|
52331
|
+
p.criteriaWording = void 0;
|
|
52332
|
+
const kept = "tests" in first ? first.tests : void 0;
|
|
52333
|
+
args2 = buildCodegenLoopArgs(p, context);
|
|
52334
|
+
first = await attempt2(void 0, 1, kept);
|
|
52335
|
+
}
|
|
52239
52336
|
if ("failure" in first && first.failure.reason === "contract_rejected" && first.failure.featureKey === true && p.featureTestUpdates === true) {
|
|
52240
52337
|
log({ event: "codegen.version_fallback", from: "feature_test_updates" });
|
|
52241
52338
|
p.featureTestUpdates = false;
|
|
@@ -53307,7 +53404,7 @@ function describeAutomationCoverageViolations(check) {
|
|
|
53307
53404
|
var estraverse5 = __toESM2(require_estraverse());
|
|
53308
53405
|
var MAX_UNSUPPLIED_ENTRIES = 10;
|
|
53309
53406
|
var MAX_UNSUPPLIED_NAMES = 5;
|
|
53310
|
-
var
|
|
53407
|
+
var MAX_NAME_CHARS5 = 80;
|
|
53311
53408
|
var MAX_FUNCTION_CHARS = 120;
|
|
53312
53409
|
var FUNCTION_TYPES = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]);
|
|
53313
53410
|
var IDENTIFIER_NAME = /^[A-Za-z_$][\w$]*$/;
|
|
@@ -53448,7 +53545,7 @@ function findUnsuppliedInputs(input) {
|
|
|
53448
53545
|
if (isCallback(site)) continue;
|
|
53449
53546
|
const names = [];
|
|
53450
53547
|
for (const { name: name2 } of readsOf(site)) {
|
|
53451
|
-
if (!IDENTIFIER_NAME.test(name2) || name2.length >
|
|
53548
|
+
if (!IDENTIFIER_NAME.test(name2) || name2.length > MAX_NAME_CHARS5) continue;
|
|
53452
53549
|
if (known.has(name2) || supplied.has(name2) || names.includes(name2)) continue;
|
|
53453
53550
|
names.push(name2);
|
|
53454
53551
|
}
|
|
@@ -54331,7 +54428,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
54331
54428
|
var REPORT_COPY = "final-test-report.xml";
|
|
54332
54429
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
54333
54430
|
var MAX_FILES = 200;
|
|
54334
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
54431
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.85" : "dev";
|
|
54335
54432
|
function safeDestination(base, repoPath) {
|
|
54336
54433
|
if (!repoPath || (0, import_node_path28.isAbsolute)(repoPath)) return null;
|
|
54337
54434
|
const destination = (0, import_node_path28.resolve)(base, repoPath);
|
|
@@ -54740,12 +54837,12 @@ async function resolveTestDiscovery(i3) {
|
|
|
54740
54837
|
}
|
|
54741
54838
|
|
|
54742
54839
|
// src/targetingFindings.ts
|
|
54743
|
-
var
|
|
54840
|
+
var isRecord6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
54744
54841
|
function prepareTargetingFindings(raw, listing, deniedPaths) {
|
|
54745
|
-
if (!
|
|
54842
|
+
if (!isRecord6(raw)) return void 0;
|
|
54746
54843
|
const { verdict, files, callPath, evidence, searches } = raw;
|
|
54747
54844
|
if (typeof verdict !== "string" || !Array.isArray(files) || !Array.isArray(callPath) || !Array.isArray(evidence)) return void 0;
|
|
54748
|
-
const keep = (entry) =>
|
|
54845
|
+
const keep = (entry) => isRecord6(entry) && typeof entry.path === "string" && listing.has(entry.path) && matchesDeniedPath(entry.path, deniedPaths) === null;
|
|
54749
54846
|
const kept = {
|
|
54750
54847
|
files: files.filter(keep),
|
|
54751
54848
|
callPath: callPath.filter(keep),
|
|
@@ -54799,7 +54896,7 @@ function validateTarget(target, workspaceRoot, workspaceListing, deniedPaths) {
|
|
|
54799
54896
|
);
|
|
54800
54897
|
}
|
|
54801
54898
|
}
|
|
54802
|
-
function buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck = false, storedProposals = false) {
|
|
54899
|
+
function buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck = false, storedProposals = false, ticketHints) {
|
|
54803
54900
|
const contextData = {
|
|
54804
54901
|
// NESTED, NOT FLATTENED — a second vocabulary for the design shape is exactly what
|
|
54805
54902
|
// QUIKTR-1034 cost.
|
|
@@ -54828,6 +54925,9 @@ function buildContextData(design, workspaceListing, requiredTests, deniedPaths,
|
|
|
54828
54925
|
if (partsCheck && storedProposals) {
|
|
54829
54926
|
contextData[STORED_PROPOSALS_KEY] = true;
|
|
54830
54927
|
}
|
|
54928
|
+
if (ticketHints) {
|
|
54929
|
+
contextData.ticketHints = ticketHints;
|
|
54930
|
+
}
|
|
54831
54931
|
return contextData;
|
|
54832
54932
|
}
|
|
54833
54933
|
async function postTargeting(gateway, contextData, signal) {
|
|
@@ -54877,16 +54977,24 @@ function finalizeTargeting(body2, workspaceRoot, workspaceListing, deniedPaths)
|
|
|
54877
54977
|
...correctedKinds.length > 0 ? { correctedKinds } : {}
|
|
54878
54978
|
};
|
|
54879
54979
|
}
|
|
54880
|
-
async function runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope = [], findings, partsCheck = false, storedProposals = false) {
|
|
54881
|
-
const contextData = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals);
|
|
54980
|
+
async function runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope = [], findings, partsCheck = false, storedProposals = false, ticketHints) {
|
|
54981
|
+
const contextData = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals, ticketHints);
|
|
54882
54982
|
let envelope = await postTargeting(gateway, contextData);
|
|
54883
54983
|
let warnings;
|
|
54884
|
-
|
|
54984
|
+
const refused2 = () => envelope?.errorCode === "CONTRACT_REJECTED";
|
|
54985
|
+
if (ticketHints && refused2()) {
|
|
54986
|
+
envelope = await postTargeting(
|
|
54987
|
+
gateway,
|
|
54988
|
+
buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals)
|
|
54989
|
+
);
|
|
54990
|
+
warnings = [TICKET_HINTS_REFUSED_WARNING];
|
|
54991
|
+
}
|
|
54992
|
+
if (findings && refused2()) {
|
|
54885
54993
|
envelope = await postTargeting(
|
|
54886
54994
|
gateway,
|
|
54887
54995
|
buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, void 0, partsCheck, storedProposals)
|
|
54888
54996
|
);
|
|
54889
|
-
warnings = ["QuikPilot's targeting ran without the early look's findings (the AI service did not accept them)."];
|
|
54997
|
+
warnings = [...warnings ?? [], "QuikPilot's targeting ran without the early look's findings (the AI service did not accept them)."];
|
|
54890
54998
|
}
|
|
54891
54999
|
checkHardFailure(envelope, "pilot.targeting");
|
|
54892
55000
|
const body2 = unwrapExecute(envelope, "pilot.targeting");
|
|
@@ -54929,23 +55037,36 @@ async function runTargeting(gateway, design, workspaceRoot, workspaceListing, re
|
|
|
54929
55037
|
}
|
|
54930
55038
|
const mode = options.mode ?? resolveTargetingMode();
|
|
54931
55039
|
const findings = prepareTargetingFindings(options.findings, new Set(workspaceListing), deniedPaths);
|
|
55040
|
+
const logEvent = options.loopDeps?.log ?? ((e) => console.log(JSON.stringify(e)));
|
|
55041
|
+
let ticketHints = hintsFor(options.ticketHints, workspaceListing, deniedPaths, logEvent);
|
|
54932
55042
|
if (mode !== "loop") {
|
|
54933
|
-
return runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals);
|
|
55043
|
+
return runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals, ticketHints);
|
|
54934
55044
|
}
|
|
54935
|
-
const baseContext = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals);
|
|
55045
|
+
const baseContext = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals, ticketHints);
|
|
55046
|
+
let hintsWarning;
|
|
54936
55047
|
const listingView = repoViewOf(options.scope);
|
|
54937
55048
|
let summary;
|
|
54938
55049
|
let runtimeCode;
|
|
54939
55050
|
let reason;
|
|
54940
55051
|
try {
|
|
54941
|
-
const
|
|
54942
|
-
|
|
54943
|
-
|
|
54944
|
-
{
|
|
55052
|
+
const deps = { secrets: [gateway.token], ...options.loopDeps, post: (contextData, signal) => postTargeting(gateway, contextData, signal) };
|
|
55053
|
+
const looped = await withoutHintsIfRefused(
|
|
55054
|
+
ticketHints,
|
|
55055
|
+
(ctx) => loopWithTools2({ baseContext: ctx, listing: workspaceListing, deniedPaths }, options.tools2, deps),
|
|
55056
|
+
baseContext,
|
|
55057
|
+
() => {
|
|
55058
|
+
ticketHints = void 0;
|
|
55059
|
+
hintsWarning = TICKET_HINTS_REFUSED_WARNING;
|
|
55060
|
+
logEvent({ event: "targeting.ticket_hints_refused" });
|
|
55061
|
+
}
|
|
54945
55062
|
);
|
|
54946
55063
|
summary = looped.summary;
|
|
54947
55064
|
const result = finalizeTargeting(looped.body, workspaceRoot, workspaceListing, deniedPaths);
|
|
54948
|
-
return {
|
|
55065
|
+
return {
|
|
55066
|
+
...result,
|
|
55067
|
+
loop: { ...summary, ...listingView ? { repoView: listingView } : {} },
|
|
55068
|
+
...hintsWarning ? { warnings: [hintsWarning, ...result.warnings ?? []] } : {}
|
|
55069
|
+
};
|
|
54949
55070
|
} catch (err2) {
|
|
54950
55071
|
if (err2 instanceof DeniedPathError || err2 instanceof SafetyRefusalError) throw err2;
|
|
54951
55072
|
if (err2 instanceof LoopFailure) {
|
|
@@ -54979,7 +55100,7 @@ async function runTargeting(gateway, design, workspaceRoot, workspaceListing, re
|
|
|
54979
55100
|
toolCalls: fellBack.toolCalls,
|
|
54980
55101
|
...runtimeCode && CODE_LIKE.test(runtimeCode) ? { runtimeCode } : {}
|
|
54981
55102
|
});
|
|
54982
|
-
const single = await runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals);
|
|
55103
|
+
const single = await runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals, ticketHints);
|
|
54983
55104
|
return {
|
|
54984
55105
|
...single,
|
|
54985
55106
|
loop: fellBack,
|
|
@@ -54992,7 +55113,7 @@ function mapTestDiscovery(testDiscovery) {
|
|
|
54992
55113
|
if (estimateTokens(JSON.stringify(testDiscovery.discoveredTestFiles, null, 2)) <= MAP_DISCOVERY_MAX_TOKENS) return testDiscovery;
|
|
54993
55114
|
return { report: "PRESENT", discoveredTestFiles: [], unmappedEntries: Math.max(1, testDiscovery.unmappedEntries + testDiscovery.discoveredTestFiles.length) };
|
|
54994
55115
|
}
|
|
54995
|
-
function buildMapContextData(repoMap, design, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck = false, storedProposals = false) {
|
|
55116
|
+
function buildMapContextData(repoMap, design, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck = false, storedProposals = false, ticketHints) {
|
|
54996
55117
|
return {
|
|
54997
55118
|
repoMap,
|
|
54998
55119
|
design,
|
|
@@ -55003,23 +55124,35 @@ function buildMapContextData(repoMap, design, requiredTests, deniedPaths, testDi
|
|
|
55003
55124
|
testDiscovery: mapTestDiscovery(testDiscovery),
|
|
55004
55125
|
...findings ? { findings } : {},
|
|
55005
55126
|
...partsCheck ? { partsCheck: true } : {},
|
|
55006
|
-
...partsCheck && storedProposals ? { [STORED_PROPOSALS_KEY]: true } : {}
|
|
55127
|
+
...partsCheck && storedProposals ? { [STORED_PROPOSALS_KEY]: true } : {},
|
|
55128
|
+
...ticketHints ? { ticketHints } : {}
|
|
55007
55129
|
};
|
|
55008
55130
|
}
|
|
55009
55131
|
async function runMapTargeting(gateway, design, workspaceRoot, scope, requiredTests, deniedPaths, testDiscovery, outOfScope, options, partsCheck, storedProposals = false) {
|
|
55010
55132
|
const findings = prepareTargetingFindings(options.findings, new Set(scope.readListing), deniedPaths);
|
|
55011
|
-
const baseContext = buildMapContextData(scope.repoMap, design, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals);
|
|
55012
|
-
const repoView = repoViewOf(scope);
|
|
55013
55133
|
const log = options.loopDeps?.log ?? ((e) => console.log(JSON.stringify(e)));
|
|
55134
|
+
const ticketHints = hintsFor(options.ticketHints, scope.readListing, deniedPaths, log);
|
|
55135
|
+
const baseContext = buildMapContextData(scope.repoMap, design, requiredTests, deniedPaths, testDiscovery, outOfScope, findings, partsCheck, storedProposals, ticketHints);
|
|
55136
|
+
const repoView = repoViewOf(scope);
|
|
55014
55137
|
let reason;
|
|
55138
|
+
let hintsWarning;
|
|
55015
55139
|
try {
|
|
55016
|
-
const
|
|
55017
|
-
|
|
55018
|
-
|
|
55019
|
-
{
|
|
55140
|
+
const deps = { secrets: [gateway.token], ...options.loopDeps, post: (contextData, signal) => postTargeting(gateway, contextData, signal) };
|
|
55141
|
+
const looped = await withoutHintsIfRefused(
|
|
55142
|
+
ticketHints,
|
|
55143
|
+
(ctx) => loopWithTools2({ baseContext: ctx, listing: scope.readListing, deniedPaths, readRoots: scope.readRoots, contractVersion: MAP_LOOP_CONTRACT_VERSION }, options.tools2, deps),
|
|
55144
|
+
baseContext,
|
|
55145
|
+
() => {
|
|
55146
|
+
hintsWarning = TICKET_HINTS_REFUSED_WARNING;
|
|
55147
|
+
log({ event: "targeting.ticket_hints_refused" });
|
|
55148
|
+
}
|
|
55020
55149
|
);
|
|
55021
55150
|
const result = finalizeTargeting(looped.body, workspaceRoot, scope.writeListing, deniedPaths);
|
|
55022
|
-
return {
|
|
55151
|
+
return {
|
|
55152
|
+
...result,
|
|
55153
|
+
loop: { ...looped.summary, ...repoView ? { repoView } : {} },
|
|
55154
|
+
...hintsWarning ? { warnings: [hintsWarning, ...result.warnings ?? []] } : {}
|
|
55155
|
+
};
|
|
55023
55156
|
} catch (err2) {
|
|
55024
55157
|
if (err2 instanceof DeniedPathError || err2 instanceof SafetyRefusalError) throw err2;
|
|
55025
55158
|
reason = err2 instanceof LoopFailure ? err2.reason : "final_invalid";
|
|
@@ -55027,6 +55160,24 @@ async function runMapTargeting(gateway, design, workspaceRoot, scope, requiredTe
|
|
|
55027
55160
|
log({ event: "targeting.map_failed", reason });
|
|
55028
55161
|
throw new MapModeError("targeting", reason);
|
|
55029
55162
|
}
|
|
55163
|
+
var TICKET_HINTS_REFUSED_WARNING = "QuikPilot's targeting ran without the files and routes the request names (the AI service did not accept them).";
|
|
55164
|
+
function hintsFor(raw, listing, deniedPaths, log) {
|
|
55165
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
55166
|
+
const { hints, counts } = prepareTicketHints(raw, listing, deniedPaths);
|
|
55167
|
+
log({ event: "targeting.ticket_hints", ...counts, sent: hints !== void 0 });
|
|
55168
|
+
return hints;
|
|
55169
|
+
}
|
|
55170
|
+
async function withoutHintsIfRefused(hints, run3, baseContext, onRefused) {
|
|
55171
|
+
try {
|
|
55172
|
+
return await run3(baseContext);
|
|
55173
|
+
} catch (err2) {
|
|
55174
|
+
if (!hints || !(err2 instanceof LoopFailure) || err2.reason !== "contract_rejected") throw err2;
|
|
55175
|
+
onRefused();
|
|
55176
|
+
const without = { ...baseContext };
|
|
55177
|
+
delete without.ticketHints;
|
|
55178
|
+
return run3(without);
|
|
55179
|
+
}
|
|
55180
|
+
}
|
|
55030
55181
|
|
|
55031
55182
|
// src/targetingRecord.ts
|
|
55032
55183
|
var MAX_TARGETS = 25;
|
|
@@ -55036,7 +55187,7 @@ var MAX_ADDED_PATHS = 20;
|
|
|
55036
55187
|
var MAX_SKIPPED_CONTEXT = 20;
|
|
55037
55188
|
var MAX_SKIPPED_CASES = 200;
|
|
55038
55189
|
var MAX_CONTEXT_RECORDS = 25;
|
|
55039
|
-
var
|
|
55190
|
+
var MAX_PATH_CHARS6 = 300;
|
|
55040
55191
|
var MAX_ID_CHARS3 = 100;
|
|
55041
55192
|
var MAX_REASON_CHARS3 = 300;
|
|
55042
55193
|
var MAX_LOOP_READS = 50;
|
|
@@ -55067,7 +55218,7 @@ function clampLoop(loop) {
|
|
|
55067
55218
|
break;
|
|
55068
55219
|
}
|
|
55069
55220
|
const path = typeof r.path === "string" ? r.path.trim() : "";
|
|
55070
|
-
if (path.length === 0 || path.length >
|
|
55221
|
+
if (path.length === 0 || path.length > MAX_PATH_CHARS6) {
|
|
55071
55222
|
cut2 = true;
|
|
55072
55223
|
continue;
|
|
55073
55224
|
}
|
|
@@ -55121,11 +55272,11 @@ function buildTargetingRecord(targeting, contextLog) {
|
|
|
55121
55272
|
break;
|
|
55122
55273
|
}
|
|
55123
55274
|
const path = typeof t.path === "string" ? t.path.trim() : "";
|
|
55124
|
-
if (path.length === 0 || path.length >
|
|
55275
|
+
if (path.length === 0 || path.length > MAX_PATH_CHARS6) {
|
|
55125
55276
|
truncated = true;
|
|
55126
55277
|
continue;
|
|
55127
55278
|
}
|
|
55128
|
-
const contextPaths = clampList(t.contextPaths, MAX_CONTEXT_PATHS,
|
|
55279
|
+
const contextPaths = clampList(t.contextPaths, MAX_CONTEXT_PATHS, MAX_PATH_CHARS6);
|
|
55129
55280
|
const automationIds = clampList(t.automationIds, MAX_IDS_PER_TARGET, MAX_ID_CHARS3);
|
|
55130
55281
|
note(contextPaths.cut);
|
|
55131
55282
|
note(automationIds.cut);
|
|
@@ -55144,16 +55295,16 @@ function buildTargetingRecord(targeting, contextLog) {
|
|
|
55144
55295
|
break;
|
|
55145
55296
|
}
|
|
55146
55297
|
const targetPath = typeof entry.targetPath === "string" ? entry.targetPath.trim() : "";
|
|
55147
|
-
if (targetPath.length === 0 || targetPath.length >
|
|
55298
|
+
if (targetPath.length === 0 || targetPath.length > MAX_PATH_CHARS6) {
|
|
55148
55299
|
truncated = true;
|
|
55149
55300
|
continue;
|
|
55150
55301
|
}
|
|
55151
|
-
const contextPaths = clampList(entry.contextPaths, MAX_CONTEXT_PATHS,
|
|
55152
|
-
const addedPaths = clampList(entry.addedPaths, MAX_ADDED_PATHS,
|
|
55302
|
+
const contextPaths = clampList(entry.contextPaths, MAX_CONTEXT_PATHS, MAX_PATH_CHARS6);
|
|
55303
|
+
const addedPaths = clampList(entry.addedPaths, MAX_ADDED_PATHS, MAX_PATH_CHARS6);
|
|
55153
55304
|
const skippedPaths = clampList(
|
|
55154
55305
|
(entry.skipped ?? []).map((s) => s.path),
|
|
55155
55306
|
MAX_SKIPPED_CONTEXT,
|
|
55156
|
-
|
|
55307
|
+
MAX_PATH_CHARS6
|
|
55157
55308
|
);
|
|
55158
55309
|
note(contextPaths.cut);
|
|
55159
55310
|
note(addedPaths.cut);
|
|
@@ -55346,6 +55497,8 @@ async function run2(env2) {
|
|
|
55346
55497
|
// QUIKTR-2325 - and `partsCheck` only when the switch is on and the design has parts.
|
|
55347
55498
|
{
|
|
55348
55499
|
...packet.findings ? { findings: packet.findings } : {},
|
|
55500
|
+
// QUIKTR-2509 - what the person's request names; fitted to this checkout inside runTargeting. Absent: called exactly as before.
|
|
55501
|
+
...packet.ticketHints ? { ticketHints: packet.ticketHints } : {},
|
|
55349
55502
|
scope,
|
|
55350
55503
|
...tools2 ? { tools2 } : {},
|
|
55351
55504
|
mode: resolveTargetingMode(process.env, packet.targetingMode),
|
|
@@ -55480,6 +55633,7 @@ async function run2(env2) {
|
|
|
55480
55633
|
if (approved && approved.proposals.length > 0) approvedApplied = approved.proposals;
|
|
55481
55634
|
}
|
|
55482
55635
|
const decided = approved?.decided ?? [];
|
|
55636
|
+
const criteriaWording = prepareCriteriaWording(packet.criteriaWording);
|
|
55483
55637
|
const stepParams = {
|
|
55484
55638
|
mode: codegenMode,
|
|
55485
55639
|
...keepOnGiveUp ? { keepOnGiveUp: true } : {},
|
|
@@ -55488,6 +55642,8 @@ async function run2(env2) {
|
|
|
55488
55642
|
...conflictsOn && packet.fixFirst === true && process.env.QUIKPILOT_FIX_FIRST?.trim().toLowerCase() !== "off" ? { fixFirst: true } : {},
|
|
55489
55643
|
// QUIKTR-2442: a feature run may propose add-only set-up for an existing test its change breaks.
|
|
55490
55644
|
...featureUpdates ? { featureTestUpdates: true } : {},
|
|
55645
|
+
// QUIKTR-2509: the approved criteria in the person's words, when QuikProjects sent them (its switch QUIKPILOT_TICKET_HINTS).
|
|
55646
|
+
...criteriaWording ? { criteriaWording } : {},
|
|
55491
55647
|
...approved && approved.files.length > 0 ? { approved: approved.files } : {},
|
|
55492
55648
|
...callFunction ? { callFunction } : {},
|
|
55493
55649
|
...runScratch ? { runScratch } : {},
|
|
@@ -55947,7 +56103,7 @@ var EvidenceLedger = class {
|
|
|
55947
56103
|
return seen;
|
|
55948
56104
|
}
|
|
55949
56105
|
};
|
|
55950
|
-
function
|
|
56106
|
+
function isRecord7(x) {
|
|
55951
56107
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
55952
56108
|
}
|
|
55953
56109
|
function arrayOf(x) {
|
|
@@ -55985,7 +56141,7 @@ function capFindingsSize(findings, max = MAX_FINDINGS_CHARS) {
|
|
|
55985
56141
|
function verifyFindings(raw, ledger, ctx) {
|
|
55986
56142
|
const dropped = emptyDropped();
|
|
55987
56143
|
const redactions = emptyRedactionCounts();
|
|
55988
|
-
if (!
|
|
56144
|
+
if (!isRecord7(raw)) return { findings: emptyFindings(), downgraded: false, dropped, redactions };
|
|
55989
56145
|
const pathOk2 = (p) => typeof p === "string" && ctx.listing.has(p) && matchesDeniedPath(p, ctx.deniedPaths) === null;
|
|
55990
56146
|
const symbolsOf = (path, list2) => {
|
|
55991
56147
|
const out2 = [];
|
|
@@ -56000,7 +56156,7 @@ function verifyFindings(raw, ledger, ctx) {
|
|
|
56000
56156
|
};
|
|
56001
56157
|
const files = [];
|
|
56002
56158
|
for (const f of arrayOf(raw.files)) {
|
|
56003
|
-
if (!
|
|
56159
|
+
if (!isRecord7(f) || !pathOk2(f.path)) {
|
|
56004
56160
|
dropped.files += 1;
|
|
56005
56161
|
continue;
|
|
56006
56162
|
}
|
|
@@ -56010,7 +56166,7 @@ function verifyFindings(raw, ledger, ctx) {
|
|
|
56010
56166
|
}
|
|
56011
56167
|
const callPath = [];
|
|
56012
56168
|
for (const s of arrayOf(raw.callPath)) {
|
|
56013
|
-
const ok =
|
|
56169
|
+
const ok = isRecord7(s) && pathOk2(s.path) && typeof s.symbol === "string" && s.symbol.length > 0 && s.symbol.length <= MAX_SYMBOL_CHARS && isLine2(s.line) && ledger.hasLines(s.path, s.line, s.line) && ledger.textContains(s.path, s.symbol);
|
|
56014
56170
|
if (!ok) {
|
|
56015
56171
|
dropped.callPath += 1;
|
|
56016
56172
|
continue;
|
|
@@ -56019,7 +56175,7 @@ function verifyFindings(raw, ledger, ctx) {
|
|
|
56019
56175
|
}
|
|
56020
56176
|
const evidence = [];
|
|
56021
56177
|
for (const e of arrayOf(raw.evidence)) {
|
|
56022
|
-
const ok =
|
|
56178
|
+
const ok = isRecord7(e) && pathOk2(e.path) && isLine2(e.startLine) && isLine2(e.endLine) && e.startLine <= e.endLine && e.endLine - e.startLine + 1 <= MAX_EVIDENCE_LINES && ledger.hasLines(e.path, e.startLine, e.endLine);
|
|
56023
56179
|
if (!ok) {
|
|
56024
56180
|
dropped.evidence += 1;
|
|
56025
56181
|
continue;
|