@quikit/quikpilot-runner 9.3.0-rc.13 → 9.3.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,6 +150,8 @@ it, the callback carries it as `unsuppliedInputs` (at most 10 functions, 5 names
150
150
  noticed" as a check. This is the shape of a change whose new tests pass only because they hand the function the field themselves. It can be
151
151
  wrong (a field that arrives from a database row or a request), so it only warns and never blocks. TypeScript is not covered (QUIKTR-1547).
152
152
 
153
+ **9.3.0-rc.14 — the early look's findings reach the targeting step (QUIKTR-1561).** When QuikProjects' work packet carries `findings` (only after a look COMPLETED), the runner filters them to this checkout (entries whose path is not in the listing or matches the protected list are dropped, and the look's free-text questions are never sent) and adds them as the last key of the targeting request, on every turn of the loop and on the single call. If the AI service does not know the key and refuses it (`CONTRACT_REJECTED`), the request is asked ONCE more without it and a warning says so; any other failure, a second refusal, and a refusal of a request that carried no findings fail exactly as before. A run without a completed look sends exactly the request it always did. Deploy the AI service and QuikProjects first.
154
+
153
155
  **9.3.0-rc.13 — a run that finds no file to change now fails (QUIKTR-1557).** When targeting answers "no file" for a run that has an approved
154
156
  issue (every real run: dispatch attaches one after Gate 1), the runner no longer writes the Phase 0 marker file, runs setup and tests, pushes a
155
157
  branch and reports success. The run ends at once, before anything is written, installed or pushed, with the reason
package/dist/index.js CHANGED
@@ -14048,7 +14048,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
14048
14048
  var REPORT_COPY = "final-test-report.xml";
14049
14049
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
14050
14050
  var MAX_FILES = 200;
14051
- var RUNNER_VERSION = true ? "9.3.0-rc.13" : "dev";
14051
+ var RUNNER_VERSION = true ? "9.3.0-rc.14" : "dev";
14052
14052
  function safeDestination(base, repoPath) {
14053
14053
  if (!repoPath || (0, import_node_path12.isAbsolute)(repoPath)) return null;
14054
14054
  const destination = (0, import_node_path12.resolve)(base, repoPath);
@@ -14186,6 +14186,27 @@ function describeScopeViolations(check) {
14186
14186
  // src/targeting.ts
14187
14187
  var import_node_path13 = require("node:path");
14188
14188
 
14189
+ // src/targetingFindings.ts
14190
+ var isRecord2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
14191
+ function prepareTargetingFindings(raw, listing, deniedPaths) {
14192
+ if (!isRecord2(raw)) return void 0;
14193
+ const { verdict, files, callPath, evidence, searches } = raw;
14194
+ if (typeof verdict !== "string" || !Array.isArray(files) || !Array.isArray(callPath) || !Array.isArray(evidence)) return void 0;
14195
+ const keep = (entry) => isRecord2(entry) && typeof entry.path === "string" && listing.has(entry.path) && matchesDeniedPath(entry.path, deniedPaths) === null;
14196
+ const kept = {
14197
+ files: files.filter(keep),
14198
+ callPath: callPath.filter(keep),
14199
+ evidence: evidence.filter(keep)
14200
+ };
14201
+ if (kept.files.length === 0 && kept.callPath.length === 0 && kept.evidence.length === 0) return void 0;
14202
+ return {
14203
+ verdict,
14204
+ ...kept,
14205
+ searches: Array.isArray(searches) ? searches.filter((s) => typeof s === "string") : [],
14206
+ openQuestions: []
14207
+ };
14208
+ }
14209
+
14189
14210
  // src/targetingMode.ts
14190
14211
  var TARGETING_MODE_ENV = "QUIKPILOT_TARGETING_MODE";
14191
14212
  function parse5(value) {
@@ -14238,7 +14259,7 @@ function validateTarget(target, workspaceRoot, workspaceListing, deniedPaths) {
14238
14259
  );
14239
14260
  }
14240
14261
  }
14241
- function buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope) {
14262
+ function buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings) {
14242
14263
  const contextData = {
14243
14264
  // NESTED, NOT FLATTENED — a second vocabulary for the design shape is exactly what
14244
14265
  // QUIKTR-1034 cost.
@@ -14257,6 +14278,9 @@ function buildContextData(design, workspaceListing, requiredTests, deniedPaths,
14257
14278
  contextData.outOfScope = outOfScope;
14258
14279
  }
14259
14280
  contextData.testDiscovery = testDiscovery;
14281
+ if (findings) {
14282
+ contextData.findings = findings;
14283
+ }
14260
14284
  return contextData;
14261
14285
  }
14262
14286
  async function postTargeting(gateway, contextData, signal) {
@@ -14306,20 +14330,30 @@ function finalizeTargeting(body, workspaceRoot, workspaceListing, deniedPaths) {
14306
14330
  ...correctedKinds.length > 0 ? { correctedKinds } : {}
14307
14331
  };
14308
14332
  }
14309
- async function runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope = []) {
14310
- const contextData = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope);
14311
- const envelope = await postTargeting(gateway, contextData);
14333
+ async function runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope = [], findings) {
14334
+ const contextData = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings);
14335
+ let envelope = await postTargeting(gateway, contextData);
14336
+ let warnings;
14337
+ if (findings && envelope?.errorCode === "CONTRACT_REJECTED") {
14338
+ envelope = await postTargeting(
14339
+ gateway,
14340
+ buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope)
14341
+ );
14342
+ warnings = ["QuikPilot's targeting ran without the early look's findings (the AI service did not accept them)."];
14343
+ }
14312
14344
  checkHardFailure(envelope, "pilot.targeting");
14313
14345
  const body = unwrapExecute(envelope, "pilot.targeting");
14314
- return finalizeTargeting(body, workspaceRoot, workspaceListing, deniedPaths);
14346
+ const result = finalizeTargeting(body, workspaceRoot, workspaceListing, deniedPaths);
14347
+ return warnings ? { ...result, warnings } : result;
14315
14348
  }
14316
14349
  var CODE_LIKE = /^[A-Z0-9_]{1,40}$/;
14317
14350
  async function runTargeting(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope = [], options = {}) {
14318
14351
  const mode = options.mode ?? resolveTargetingMode();
14352
+ const findings = prepareTargetingFindings(options.findings, new Set(workspaceListing), deniedPaths);
14319
14353
  if (mode !== "loop") {
14320
- return runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope);
14354
+ return runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings);
14321
14355
  }
14322
- const baseContext = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope);
14356
+ const baseContext = buildContextData(design, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings);
14323
14357
  let summary;
14324
14358
  let runtimeCode;
14325
14359
  let reason;
@@ -14359,11 +14393,11 @@ async function runTargeting(gateway, design, workspaceRoot, workspaceListing, re
14359
14393
  toolCalls: fellBack.toolCalls,
14360
14394
  ...runtimeCode && CODE_LIKE.test(runtimeCode) ? { runtimeCode } : {}
14361
14395
  });
14362
- const single = await runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope);
14396
+ const single = await runSingleShot(gateway, design, workspaceRoot, workspaceListing, requiredTests, deniedPaths, testDiscovery, outOfScope, findings);
14363
14397
  return {
14364
14398
  ...single,
14365
14399
  loop: fellBack,
14366
- warnings: [`QuikPilot's read-only targeting could not complete (${reason}); standard targeting was used instead.`]
14400
+ warnings: [`QuikPilot's read-only targeting could not complete (${reason}); standard targeting was used instead.`, ...single.warnings ?? []]
14367
14401
  };
14368
14402
  }
14369
14403
 
@@ -14828,7 +14862,8 @@ async function run(env2) {
14828
14862
  packet.requiredTests,
14829
14863
  packet.guardrails.deniedPaths,
14830
14864
  packet.testDiscovery,
14831
- outOfScope
14865
+ outOfScope,
14866
+ ...packet.findings ? [{ findings: packet.findings }] : []
14832
14867
  );
14833
14868
  targetingResult = targeting;
14834
14869
  for (const w of targeting.warnings ?? []) {
@@ -15203,7 +15238,7 @@ var EvidenceLedger = class {
15203
15238
  return seen;
15204
15239
  }
15205
15240
  };
15206
- function isRecord2(x) {
15241
+ function isRecord3(x) {
15207
15242
  return typeof x === "object" && x !== null && !Array.isArray(x);
15208
15243
  }
15209
15244
  function arrayOf(x) {
@@ -15221,7 +15256,7 @@ function isLine(n) {
15221
15256
  function verifyFindings(raw, ledger, ctx) {
15222
15257
  const dropped = emptyDropped();
15223
15258
  const redactions = emptyRedactionCounts();
15224
- if (!isRecord2(raw)) return { findings: emptyFindings(), downgraded: false, dropped, redactions };
15259
+ if (!isRecord3(raw)) return { findings: emptyFindings(), downgraded: false, dropped, redactions };
15225
15260
  const pathOk2 = (p) => typeof p === "string" && ctx.listing.has(p) && matchesDeniedPath(p, ctx.deniedPaths) === null;
15226
15261
  const symbolsOf = (path, list2) => {
15227
15262
  const out = [];
@@ -15236,7 +15271,7 @@ function verifyFindings(raw, ledger, ctx) {
15236
15271
  };
15237
15272
  const files = [];
15238
15273
  for (const f of arrayOf(raw.files)) {
15239
- if (!isRecord2(f) || !pathOk2(f.path)) {
15274
+ if (!isRecord3(f) || !pathOk2(f.path)) {
15240
15275
  dropped.files += 1;
15241
15276
  continue;
15242
15277
  }
@@ -15246,7 +15281,7 @@ function verifyFindings(raw, ledger, ctx) {
15246
15281
  }
15247
15282
  const callPath = [];
15248
15283
  for (const s of arrayOf(raw.callPath)) {
15249
- const ok = isRecord2(s) && pathOk2(s.path) && typeof s.symbol === "string" && s.symbol.length > 0 && s.symbol.length <= MAX_SYMBOL_CHARS && isLine(s.line) && ledger.hasLines(s.path, s.line, s.line) && ledger.textContains(s.path, s.symbol);
15284
+ const ok = isRecord3(s) && pathOk2(s.path) && typeof s.symbol === "string" && s.symbol.length > 0 && s.symbol.length <= MAX_SYMBOL_CHARS && isLine(s.line) && ledger.hasLines(s.path, s.line, s.line) && ledger.textContains(s.path, s.symbol);
15250
15285
  if (!ok) {
15251
15286
  dropped.callPath += 1;
15252
15287
  continue;
@@ -15255,7 +15290,7 @@ function verifyFindings(raw, ledger, ctx) {
15255
15290
  }
15256
15291
  const evidence = [];
15257
15292
  for (const e of arrayOf(raw.evidence)) {
15258
- const ok = isRecord2(e) && pathOk2(e.path) && isLine(e.startLine) && isLine(e.endLine) && e.startLine <= e.endLine && e.endLine - e.startLine + 1 <= MAX_EVIDENCE_LINES && ledger.hasLines(e.path, e.startLine, e.endLine);
15293
+ const ok = isRecord3(e) && pathOk2(e.path) && isLine(e.startLine) && isLine(e.endLine) && e.startLine <= e.endLine && e.endLine - e.startLine + 1 <= MAX_EVIDENCE_LINES && ledger.hasLines(e.path, e.startLine, e.endLine);
15259
15294
  if (!ok) {
15260
15295
  dropped.evidence += 1;
15261
15296
  continue;