@sagentlab/navarch-runtime 0.1.162 → 0.1.164
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/dist/api.cjs +1 -1
- package/dist/git-worktree.cjs +9 -0
- package/dist/qa-report.js +110 -0
- package/dist/qa-runner.cjs +10 -98
- package/dist/session.cjs +9 -3
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -136,7 +136,7 @@ class NavarchApiClient {
|
|
|
136
136
|
}
|
|
137
137
|
/** schema-design.md §7 — `POST /api/dispatch/claim {machine_capacity, capabilities} → task + context bundle`. */
|
|
138
138
|
async claim(req) {
|
|
139
|
-
const result = await this.request("POST", "/api/dispatch/claim", req, { allowEmpty: true });
|
|
139
|
+
const result = await this.request("POST", "/api/dispatch/claim", { ...req, delivery_baseline_protocol: 1 }, { allowEmpty: true });
|
|
140
140
|
if (!result || result.task == null)
|
|
141
141
|
return null;
|
|
142
142
|
return result;
|
package/dist/git-worktree.cjs
CHANGED
|
@@ -72,6 +72,7 @@ class GitWorktree {
|
|
|
72
72
|
sessionTokenMarker;
|
|
73
73
|
hostedCheckpointRef;
|
|
74
74
|
hostedCheckpointLocalRef;
|
|
75
|
+
hostedCheckpointLeaseId;
|
|
75
76
|
/** Set when the resumed remote branch had lost its ownership commit and must be re-marked. */
|
|
76
77
|
adoptedUnmarkedBranch = false;
|
|
77
78
|
constructor(options) {
|
|
@@ -122,6 +123,7 @@ class GitWorktree {
|
|
|
122
123
|
this.ownershipCommitIdentity = options.ownershipCommitIdentity ?? { name: "Navarch", email: "runtime@navarch.local" };
|
|
123
124
|
this.hostedCheckpointRef = options.restoreHostedCheckpoint ? hostedCheckpointRef(options.taskId) : null;
|
|
124
125
|
this.hostedCheckpointLocalRef = `refs/navarch/restored-checkpoints/${taskKey}`;
|
|
126
|
+
this.hostedCheckpointLeaseId = options.hostedCheckpointLeaseId;
|
|
125
127
|
}
|
|
126
128
|
async prepare(signal) {
|
|
127
129
|
signal?.throwIfAborted();
|
|
@@ -331,6 +333,13 @@ class GitWorktree {
|
|
|
331
333
|
if (!/^[0-9a-f]{40,64}$/i.test(sha) || !/^[0-9a-f]{40,64}$/i.test(parent)) {
|
|
332
334
|
throw new Error("the checkpoint ref did not resolve to a snapshot commit with a parent");
|
|
333
335
|
}
|
|
336
|
+
if (this.hostedCheckpointLeaseId !== undefined) {
|
|
337
|
+
const body = (await this.runGit(["--git-dir", this.repositoryPath, "show", "-s", "--format=%B", sha], false)).stdout;
|
|
338
|
+
const leases = body.split("\n").filter(line => line.startsWith("Navarch-Checkpoint-Lease:"));
|
|
339
|
+
if (leases.length !== 1 || leases[0] !== `Navarch-Checkpoint-Lease: ${this.hostedCheckpointLeaseId}`) {
|
|
340
|
+
throw new Error("checkpoint lease identity is missing or different; remote checkpoint preserved");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
334
343
|
return { ref, sha: sha, parent: parent };
|
|
335
344
|
}
|
|
336
345
|
catch (error) {
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QA_CONFIG_LOADER = exports.qaCaseGrep = void 0;
|
|
4
|
+
exports.parseQaReport = parseQaReport;
|
|
5
|
+
exports.runnerCommandScript = runnerCommandScript;
|
|
6
|
+
/** Aggregate every matching test/project: one failed viewport fails the case. */
|
|
7
|
+
function parseQaReport(raw, assignment, missingReason = "automation_missing", missingClass = "setup", sanitize = text => text) {
|
|
8
|
+
if (!raw || typeof raw !== "object" || !Array.isArray(raw.suites))
|
|
9
|
+
throw new Error("Invalid Playwright JSON report");
|
|
10
|
+
const globalErrors = raw.errors ?? [];
|
|
11
|
+
const found = new Map();
|
|
12
|
+
const selected = new Set(assignment.items.map(item => item.case_id));
|
|
13
|
+
const walk = (suite, parents) => {
|
|
14
|
+
const titles = [...parents, suite.title ?? ""];
|
|
15
|
+
for (const spec of suite.specs ?? []) {
|
|
16
|
+
for (const test of spec.tests ?? []) {
|
|
17
|
+
const text = [...titles, spec.title ?? "", ...(spec.tags ?? []).map(tag => tag.startsWith("@") ? tag : `@${tag}`), ...(test.tags ?? []).map(tag => tag.startsWith("@") ? tag : `@${tag}`)].join(" ");
|
|
18
|
+
const ids = new Set([...text.matchAll(/@TC-[A-Z0-9]+(?:-[A-Z0-9]+)*(?:#[1-9][0-9]*)?(?![A-Za-z0-9_#-])/g)].map(match => match[0].slice(1)));
|
|
19
|
+
const attempts = test.results ?? [];
|
|
20
|
+
const last = attempts.at(-1);
|
|
21
|
+
// Expected failures are still product failures for case reporting.
|
|
22
|
+
const status = last?.status === "passed" ? "passed" : last?.status === "skipped" ? "skipped" : last?.status === "interrupted" && missingReason === "runner_timeout" ? "blocked" : "failed";
|
|
23
|
+
const annotatedClass = test.annotations?.find(a => a.type === "navarch:failure_class")?.description;
|
|
24
|
+
const failures = attempts.filter(result => ["failed", "timedOut", "interrupted"].includes(result.status ?? "")).map(result => ({
|
|
25
|
+
retry: Math.min(32767, Math.max(0, result.retry ?? 0)),
|
|
26
|
+
failure_class: (result.status !== "failed" ? "runtime" : ["setup", "resource", "runtime", "product_assertion"].includes(annotatedClass ?? "") ? annotatedClass : "product_assertion"),
|
|
27
|
+
summary: sanitize(result.error?.message?.trim() || `Playwright: ${result.status}`).slice(0, 2000),
|
|
28
|
+
}));
|
|
29
|
+
for (const id of ids) {
|
|
30
|
+
if (!selected.has(id) || !last)
|
|
31
|
+
continue;
|
|
32
|
+
const rows = found.get(id) ?? [];
|
|
33
|
+
rows.push({ run_id: assignment.run.id, case_id: id, attempt: 1, status,
|
|
34
|
+
flaky: status === "passed" && ((last.retry ?? 0) > 0 || attempts.some(result => ["failed", "timedOut", "interrupted"].includes(result.status ?? ""))),
|
|
35
|
+
duration_ms: Math.min(2147483647, attempts.reduce((sum, result) => sum + Math.max(0, result.duration ?? 0), 0)),
|
|
36
|
+
...(["failed", "blocked"].includes(status) ? { failure_summary: status === "blocked" ? missingReason : sanitize(last.error?.message?.trim() || `Playwright: ${last.status ?? "unknown"}`).slice(0, 8000) } : {}),
|
|
37
|
+
...(failures.length ? { failure_class: failures[0].failure_class, failure_attempts: failures.slice(0, 50), failure_attempts_truncated: failures.length > 50 } : {}),
|
|
38
|
+
traces: attempts.flatMap(result => (result.attachments ?? []).filter(a => a.name === "trace" && a.path).map(a => a.path)),
|
|
39
|
+
});
|
|
40
|
+
found.set(id, rows);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const child of suite.suites ?? [])
|
|
45
|
+
walk(child, titles);
|
|
46
|
+
};
|
|
47
|
+
walk(raw, []);
|
|
48
|
+
return assignment.items.filter(item => ["queued", "running"].includes(item.status)).map(item => {
|
|
49
|
+
const rows = found.get(item.case_id) ?? [];
|
|
50
|
+
const failed = rows.find(row => row.status === "failed");
|
|
51
|
+
const blocked = rows.find(row => row.status === "blocked");
|
|
52
|
+
const skipped = rows.some(row => row.status === "skipped");
|
|
53
|
+
const failures = rows.flatMap(row => row.failure_attempts ?? []);
|
|
54
|
+
const result = { run_id: assignment.run.id, case_id: item.case_id, attempt: item.attempt ?? 1,
|
|
55
|
+
status: failed ? "failed" : blocked ? "blocked" : skipped ? "skipped" : rows.length ? "passed" : "blocked",
|
|
56
|
+
flaky: rows.some(row => row.flaky), duration_ms: Math.min(2147483647, rows.reduce((sum, row) => sum + (row.duration_ms ?? 0), 0)),
|
|
57
|
+
...(!rows.length ? { failure_summary: missingReason } : failed || blocked ? { failure_summary: (failed ?? blocked).failure_summary } : {}),
|
|
58
|
+
...(!rows.length ? { failure_class: missingClass } : failures.length ? {
|
|
59
|
+
failure_class: (failed ?? blocked)?.failure_class ?? failures[0].failure_class,
|
|
60
|
+
failure_attempts: failures.slice(0, 50), failure_attempts_truncated: failures.length > 50 || rows.some(row => row.failure_attempts_truncated),
|
|
61
|
+
} : {}),
|
|
62
|
+
traces: [...new Set(rows.flatMap(row => row.traces))], };
|
|
63
|
+
if (globalErrors.length) {
|
|
64
|
+
const failure_class = found.size ? "runtime" : missingClass;
|
|
65
|
+
const diagnostics = globalErrors.slice(0, 50).map(error => ({ retry: 0, failure_class,
|
|
66
|
+
summary: sanitize(error.message?.trim() || "Playwright global error").slice(0, 2000) }));
|
|
67
|
+
if (result.status !== "failed") {
|
|
68
|
+
result.status = "blocked";
|
|
69
|
+
result.failure_class = failure_class;
|
|
70
|
+
result.failure_summary = diagnostics[0].summary;
|
|
71
|
+
}
|
|
72
|
+
result.failure_attempts_truncated ||= (result.failure_attempts?.length ?? 0) + globalErrors.length > 50;
|
|
73
|
+
result.failure_attempts = [...result.failure_attempts ?? [], ...diagnostics].slice(0, 50);
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const qaCaseGrep = (ids) => `@(?:${ids.map(id => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})(?![A-Za-z0-9_#-])`;
|
|
79
|
+
exports.qaCaseGrep = qaCaseGrep;
|
|
80
|
+
/** Forward explicit positional args, or append them to a final simple CLI.
|
|
81
|
+
* Reject ambiguous shell syntax before executing an unfiltered suite. */
|
|
82
|
+
function runnerCommandScript(run) {
|
|
83
|
+
let body = run.trimEnd();
|
|
84
|
+
let last = body.split("\n").at(-1) ?? "";
|
|
85
|
+
// npm consumes unknown options before its separator instead of forwarding
|
|
86
|
+
// Playwright's selection, reporter and retry flags to the actual test CLI.
|
|
87
|
+
if (/^\s*npm\s+(?:run|run-script|test|t)\b/.test(last) && !/\s--(?:\s|$)/.test(last)) {
|
|
88
|
+
last = /"\$(?:@|\{@\})"$/.test(last)
|
|
89
|
+
? last.replace(/"\$(?:@|\{@\})"$/, '-- "$@"') : `${last} --`;
|
|
90
|
+
body = [...body.split("\n").slice(0, -1), last].join("\n");
|
|
91
|
+
}
|
|
92
|
+
if (!last.includes("#") && /"\$(?:@|\{@\})"$/.test(last))
|
|
93
|
+
return body;
|
|
94
|
+
if (!last.trim() || /[#;{}|&<>`]/.test(last) || /^\s*(?:if|then|else|fi|do|done|esac|case|for|while|until)\b/.test(last)) {
|
|
95
|
+
throw new Error('Runner command must end in a simple CLI invocation or forward "$@" explicitly');
|
|
96
|
+
}
|
|
97
|
+
return `${body} "$@"`;
|
|
98
|
+
}
|
|
99
|
+
/** Use Playwright's require hook for CommonJS TypeScript on Node 20. An ESM
|
|
100
|
+
* import of that file bypasses the hook on older supported Node versions. */
|
|
101
|
+
exports.QA_CONFIG_LOADER = String.raw `import { existsSync, readFileSync } from 'node:fs';
|
|
102
|
+
import { createRequire } from 'node:module';
|
|
103
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
104
|
+
const root = fileURLToPath(new URL('.', import.meta.url));
|
|
105
|
+
const original = ['ts','js','mts','mjs','cts','cjs'].map(ext => root + 'playwright.config.' + ext).find(existsSync);
|
|
106
|
+
const packageType = existsSync(root + 'package.json') ? JSON.parse(readFileSync(root + 'package.json', 'utf8')).type : undefined;
|
|
107
|
+
const commonjs = original && (/\.(cts|cjs)$/.test(original) || (!/\.(mts|mjs)$/.test(original) && packageType !== 'module'));
|
|
108
|
+
const imported = original ? (commonjs ? createRequire(import.meta.url)(original) : await import(pathToFileURL(original).href)) : {};
|
|
109
|
+
const base = imported.default?.default ?? imported.default ?? imported;
|
|
110
|
+
`;
|
package/dist/qa-runner.cjs
CHANGED
|
@@ -3,10 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.qaCaseGrep = void 0;
|
|
6
|
+
exports.runnerCommandScript = exports.qaCaseGrep = void 0;
|
|
7
7
|
exports.parseQaReport = parseQaReport;
|
|
8
8
|
exports.qaSelectionArgs = qaSelectionArgs;
|
|
9
|
-
exports.runnerCommandScript = runnerCommandScript;
|
|
10
9
|
exports.executeQaRunner = executeQaRunner;
|
|
11
10
|
const node_fs_1 = require("node:fs");
|
|
12
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -16,115 +15,28 @@ const playwright_server_cjs_1 = require("./playwright-server.cjs");
|
|
|
16
15
|
const lease_heartbeat_cjs_1 = require("./lease-heartbeat.cjs");
|
|
17
16
|
const api_cjs_1 = require("./api.cjs");
|
|
18
17
|
const redact_cjs_1 = require("./redact.cjs");
|
|
19
|
-
|
|
18
|
+
// Keep BYO redaction at the boundary while both executors share report semantics.
|
|
19
|
+
const qa_report_js_1 = require("./qa-report.js");
|
|
20
|
+
var qa_report_js_2 = require("./qa-report.js");
|
|
21
|
+
Object.defineProperty(exports, "qaCaseGrep", { enumerable: true, get: function () { return qa_report_js_2.qaCaseGrep; } });
|
|
22
|
+
Object.defineProperty(exports, "runnerCommandScript", { enumerable: true, get: function () { return qa_report_js_2.runnerCommandScript; } });
|
|
20
23
|
function parseQaReport(raw, assignment, missingReason = "automation_missing", missingClass = "setup", sanitize = redact_cjs_1.redactText) {
|
|
21
|
-
|
|
22
|
-
throw new Error("Invalid Playwright JSON report");
|
|
23
|
-
const globalErrors = raw.errors ?? [];
|
|
24
|
-
const found = new Map();
|
|
25
|
-
const selected = new Set(assignment.items.map(item => item.case_id));
|
|
26
|
-
const walk = (suite, parents) => {
|
|
27
|
-
const titles = [...parents, suite.title ?? ""];
|
|
28
|
-
for (const spec of suite.specs ?? []) {
|
|
29
|
-
for (const test of spec.tests ?? []) {
|
|
30
|
-
const text = [...titles, spec.title ?? "", ...(spec.tags ?? []).map(tag => tag.startsWith("@") ? tag : `@${tag}`), ...(test.tags ?? []).map(tag => tag.startsWith("@") ? tag : `@${tag}`)].join(" ");
|
|
31
|
-
const ids = new Set([...text.matchAll(/@TC-[A-Z0-9]+(?:-[A-Z0-9]+)*(?:#[1-9][0-9]*)?(?![A-Za-z0-9_#-])/g)].map(match => match[0].slice(1)));
|
|
32
|
-
const attempts = test.results ?? [];
|
|
33
|
-
const last = attempts.at(-1);
|
|
34
|
-
// Expected failures are still product failures for case reporting.
|
|
35
|
-
const status = last?.status === "passed" ? "passed" : last?.status === "skipped" ? "skipped" : last?.status === "interrupted" && missingReason === "runner_timeout" ? "blocked" : "failed";
|
|
36
|
-
const annotatedClass = test.annotations?.find(a => a.type === "navarch:failure_class")?.description;
|
|
37
|
-
const failures = attempts.filter(result => ["failed", "timedOut", "interrupted"].includes(result.status ?? "")).map(result => ({
|
|
38
|
-
retry: Math.min(32767, Math.max(0, result.retry ?? 0)),
|
|
39
|
-
failure_class: (result.status !== "failed" ? "runtime" : ["setup", "resource", "runtime", "product_assertion"].includes(annotatedClass ?? "") ? annotatedClass : "product_assertion"),
|
|
40
|
-
summary: sanitize(result.error?.message?.trim() || `Playwright: ${result.status}`).slice(0, 2000),
|
|
41
|
-
}));
|
|
42
|
-
for (const id of ids) {
|
|
43
|
-
if (!selected.has(id) || !last)
|
|
44
|
-
continue;
|
|
45
|
-
const rows = found.get(id) ?? [];
|
|
46
|
-
rows.push({ run_id: assignment.run.id, case_id: id, attempt: 1, status,
|
|
47
|
-
flaky: status === "passed" && ((last.retry ?? 0) > 0 || attempts.some(result => ["failed", "timedOut", "interrupted"].includes(result.status ?? ""))),
|
|
48
|
-
duration_ms: Math.min(2147483647, attempts.reduce((sum, result) => sum + Math.max(0, result.duration ?? 0), 0)),
|
|
49
|
-
...(["failed", "blocked"].includes(status) ? { failure_summary: status === "blocked" ? missingReason : sanitize(last.error?.message?.trim() || `Playwright: ${last.status ?? "unknown"}`).slice(0, 8000) } : {}),
|
|
50
|
-
...(failures.length ? { failure_class: failures[0].failure_class, failure_attempts: failures.slice(0, 50), failure_attempts_truncated: failures.length > 50 } : {}),
|
|
51
|
-
traces: attempts.flatMap(result => (result.attachments ?? []).filter(a => a.name === "trace" && a.path).map(a => a.path)),
|
|
52
|
-
});
|
|
53
|
-
found.set(id, rows);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
for (const child of suite.suites ?? [])
|
|
58
|
-
walk(child, titles);
|
|
59
|
-
};
|
|
60
|
-
walk(raw, []);
|
|
61
|
-
return assignment.items.filter(item => ["queued", "running"].includes(item.status)).map(item => {
|
|
62
|
-
const rows = found.get(item.case_id) ?? [];
|
|
63
|
-
const failed = rows.find(row => row.status === "failed");
|
|
64
|
-
const blocked = rows.find(row => row.status === "blocked");
|
|
65
|
-
const skipped = rows.some(row => row.status === "skipped");
|
|
66
|
-
const failures = rows.flatMap(row => row.failure_attempts ?? []);
|
|
67
|
-
const result = { run_id: assignment.run.id, case_id: item.case_id, attempt: item.attempt ?? 1,
|
|
68
|
-
status: failed ? "failed" : blocked ? "blocked" : skipped ? "skipped" : rows.length ? "passed" : "blocked",
|
|
69
|
-
flaky: rows.some(row => row.flaky), duration_ms: Math.min(2147483647, rows.reduce((sum, row) => sum + (row.duration_ms ?? 0), 0)),
|
|
70
|
-
...(!rows.length ? { failure_summary: missingReason } : failed || blocked ? { failure_summary: (failed ?? blocked).failure_summary } : {}),
|
|
71
|
-
...(!rows.length ? { failure_class: missingClass } : failures.length ? {
|
|
72
|
-
failure_class: (failed ?? blocked)?.failure_class ?? failures[0].failure_class,
|
|
73
|
-
failure_attempts: failures.slice(0, 50), failure_attempts_truncated: failures.length > 50 || rows.some(row => row.failure_attempts_truncated),
|
|
74
|
-
} : {}),
|
|
75
|
-
traces: [...new Set(rows.flatMap(row => row.traces))], };
|
|
76
|
-
if (globalErrors.length) {
|
|
77
|
-
const failure_class = found.size ? "runtime" : missingClass;
|
|
78
|
-
const diagnostics = globalErrors.slice(0, 50).map(error => ({ retry: 0, failure_class,
|
|
79
|
-
summary: sanitize(error.message?.trim() || "Playwright global error").slice(0, 2000) }));
|
|
80
|
-
if (result.status !== "failed") {
|
|
81
|
-
result.status = "blocked";
|
|
82
|
-
result.failure_class = failure_class;
|
|
83
|
-
result.failure_summary = diagnostics[0].summary;
|
|
84
|
-
}
|
|
85
|
-
result.failure_attempts_truncated ||= (result.failure_attempts?.length ?? 0) + globalErrors.length > 50;
|
|
86
|
-
result.failure_attempts = [...result.failure_attempts ?? [], ...diagnostics].slice(0, 50);
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
});
|
|
24
|
+
return (0, qa_report_js_1.parseQaReport)(raw, assignment, missingReason, missingClass, sanitize);
|
|
90
25
|
}
|
|
91
|
-
const qaCaseGrep = (ids) => `@(?:${ids.map(id => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})(?![A-Za-z0-9_#-])`;
|
|
92
|
-
exports.qaCaseGrep = qaCaseGrep;
|
|
93
26
|
/** Long selections live in config, never in argv or one oversized env value. */
|
|
94
27
|
async function qaSelectionArgs(repo, workDir, ids) {
|
|
95
|
-
const grep = (0,
|
|
28
|
+
const grep = (0, qa_report_js_1.qaCaseGrep)(ids);
|
|
96
29
|
if (Buffer.byteLength(grep) < 16_000)
|
|
97
30
|
return ["--grep", grep];
|
|
98
31
|
const selection = node_path_1.default.join(workDir, "qa-selection.txt");
|
|
99
32
|
const config = node_path_1.default.join(repo, ".navarch-qa-playwright.config.mts");
|
|
100
33
|
await node_fs_1.promises.writeFile(selection, grep);
|
|
101
|
-
|
|
102
|
-
for (const ext of ["ts", "js", "mts", "mjs", "cts", "cjs"]) {
|
|
103
|
-
const candidate = node_path_1.default.join(repo, `playwright.config.${ext}`);
|
|
104
|
-
if (await node_fs_1.promises.stat(candidate).then(s => s.isFile(), () => false)) {
|
|
105
|
-
original = candidate;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
await node_fs_1.promises.writeFile(config, `${original ? `import base from ${JSON.stringify(original)};` : "const base = {};"}
|
|
110
|
-
import { readFileSync } from 'node:fs';
|
|
34
|
+
await node_fs_1.promises.writeFile(config, `${qa_report_js_1.QA_CONFIG_LOADER}
|
|
111
35
|
const grep = new RegExp(readFileSync(${JSON.stringify(selection)}, 'utf8'));
|
|
112
36
|
export default { ...base, grep, ...(base.projects ? { projects: base.projects.map(project => ({ ...project, grep })) } : {}) };
|
|
113
37
|
`);
|
|
114
38
|
return ["--config", config];
|
|
115
39
|
}
|
|
116
|
-
/** Forward explicit positional args, or append them to a final simple CLI.
|
|
117
|
-
* Reject ambiguous shell syntax before executing an unfiltered suite. */
|
|
118
|
-
function runnerCommandScript(run) {
|
|
119
|
-
const body = run.trimEnd();
|
|
120
|
-
const last = body.split("\n").at(-1) ?? "";
|
|
121
|
-
if (!last.includes("#") && /"\$(?:@|\{@\})"$/.test(last))
|
|
122
|
-
return body;
|
|
123
|
-
if (!last.trim() || /[#;{}|&<>`]/.test(last) || /^\s*(?:if|then|else|fi|do|done|esac|case|for|while|until)\b/.test(last)) {
|
|
124
|
-
throw new Error('Runner command must end in a simple CLI invocation or forward "$@" explicitly');
|
|
125
|
-
}
|
|
126
|
-
return `${body} "$@"`;
|
|
127
|
-
}
|
|
128
40
|
/** Repository commands receive recipe variables and their declared secrets only. */
|
|
129
41
|
function baseEnvironment() {
|
|
130
42
|
return Object.fromEntries(["PATH", "HOME", "TMPDIR", "TEMP", "TMP", "SystemRoot", "LANG"].flatMap(key => process.env[key] === undefined ? [] : [[key, process.env[key]]]));
|
|
@@ -188,7 +100,7 @@ async function executeQaRunner(deps) {
|
|
|
188
100
|
if (!recipe || !commandName || !/^[a-z][a-z0-9_-]{0,31}$/.test(commandName) || !recipe.commands[commandName])
|
|
189
101
|
throw new Error("Runner requires a recipe e2e command");
|
|
190
102
|
const command = recipe.commands[commandName];
|
|
191
|
-
const commandScript = runnerCommandScript(command.run);
|
|
103
|
+
const commandScript = (0, qa_report_js_1.runnerCommandScript)(command.run);
|
|
192
104
|
const entryEnv = async (names) => {
|
|
193
105
|
const env = { ...baseEnvironment(), ...recipe.env.vars };
|
|
194
106
|
if (names.length) {
|
package/dist/session.cjs
CHANGED
|
@@ -371,6 +371,7 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
371
371
|
: undefined,
|
|
372
372
|
// Hosted runs skip checkpoints for verify tasks, which deliver a verdict.
|
|
373
373
|
restoreHostedCheckpoint: !deliveryBinding && !allowBranchRename && task.task_type !== "verify",
|
|
374
|
+
...(claimed.delivery_baseline_required ? { hostedCheckpointLeaseId: leaseId } : {}),
|
|
374
375
|
...(commitIdentity ? { ownershipCommitIdentity: commitIdentity.committer } : {}),
|
|
375
376
|
});
|
|
376
377
|
credentialConsumer.worktree = gitWorktree;
|
|
@@ -762,9 +763,14 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
762
763
|
// after a restart, so a retry cannot relabel inherited commits as output.
|
|
763
764
|
if (claimed.delivery_baseline_required) {
|
|
764
765
|
const initialHead = await (0, delivery_cjs_1.captureDeliveryBaseline)(gitWorktree.worktreePath);
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
766
|
+
if (!/^[0-9a-f]{40}$/.test(initialHead))
|
|
767
|
+
throw new Error("Delivery baseline capture returned an invalid SHA");
|
|
768
|
+
const baseline = await api.heartbeatLease(leaseId, { delivery_baseline_sha: initialHead }).catch((error) => {
|
|
769
|
+
throw new Error(`Delivery baseline registration failed: ${String(error)}`);
|
|
770
|
+
});
|
|
771
|
+
if (typeof baseline.delivery_baseline_sha !== "string" || !/^[0-9a-f]{40}$/.test(baseline.delivery_baseline_sha)) {
|
|
772
|
+
throw new Error("The control plane did not persist a valid required delivery baseline acknowledgement");
|
|
773
|
+
}
|
|
768
774
|
deliveryBaselineSha = baseline.delivery_baseline_sha;
|
|
769
775
|
}
|
|
770
776
|
const { browserUse, playwrightSuites } = (0, browser_evidence_cjs_1.navarchBrowserTools)({
|
package/package.json
CHANGED