@loucompanion/forge-bridge 0.1.4-dev.9e8a5b93cbcb → 0.1.4-dev.bbb61d3d6127
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 +2 -2
- package/dist/bridge/bridge.service.d.ts +14 -1
- package/dist/bridge/bridge.service.js +73 -8
- package/dist/bridge/bridge.types.d.ts +11 -0
- package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
- package/dist/bridge/dispatch-result-outbox.js +31 -6
- package/dist/bridge/runner-host-capabilities.d.ts +2 -0
- package/dist/bridge/runner-host-capabilities.js +4 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cli/cli.service.js +3 -1
- package/dist/runtime/attempt-process-supervisor.d.ts +19 -0
- package/dist/runtime/attempt-process-supervisor.js +50 -0
- package/dist/runtime/host-database-capability-boundary.d.ts +1 -1
- package/dist/runtime/host-database-capability-boundary.js +1 -0
- package/dist/runtime/host-facts.d.ts +35 -0
- package/dist/runtime/host-facts.js +95 -0
- package/dist/runtime/host-load-admission.d.ts +52 -0
- package/dist/runtime/host-load-admission.js +84 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +8 -0
- package/dist/runtime/host-load-forge-cgroups.js +51 -0
- package/dist/runtime/host-load-governor-config.d.ts +34 -0
- package/dist/runtime/host-load-governor-config.js +46 -0
- package/dist/runtime/host-load-governor.d.ts +123 -0
- package/dist/runtime/host-load-governor.js +415 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +185 -0
- package/dist/runtime/host-load-sampler.d.ts +121 -0
- package/dist/runtime/host-load-sampler.js +224 -0
- package/dist/runtime/host-load-step-class.d.ts +33 -0
- package/dist/runtime/host-load-step-class.js +46 -0
- package/dist/runtime/host-load-token-ledger.d.ts +135 -0
- package/dist/runtime/host-load-token-ledger.js +345 -0
- package/dist/runtime/host-pressure-stall.d.ts +61 -0
- package/dist/runtime/host-pressure-stall.js +168 -0
- package/dist/runtime/host-runtime-contract.d.ts +4 -0
- package/dist/runtime/host-runtime-contract.js +6 -1
- package/dist/runtime/host-runtime-lease.d.ts +13 -2
- package/dist/runtime/host-runtime-lease.js +82 -11
- package/dist/runtime/host-runtime-promotion.js +12 -0
- package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
- package/dist/runtime/host-runtime-requirements-check.js +29 -0
- package/dist/runtime/host-runtime-requirements.d.ts +36 -0
- package/dist/runtime/host-runtime-requirements.js +117 -0
- package/dist/runtime/managed-command-teardown.d.ts +62 -0
- package/dist/runtime/managed-command-teardown.js +607 -0
- package/dist/runtime/playwright-browser-cache.d.ts +39 -0
- package/dist/runtime/playwright-browser-cache.js +227 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +11 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +48 -54
- package/dist/session/managed-attempt-tools.d.ts +25 -0
- package/dist/session/managed-attempt-tools.js +212 -15
- package/dist/session/managed-build-coordinator.d.ts +1 -1
- package/dist/session/managed-build-coordinator.js +4 -1
- package/dist/session/phase-completion.artifacts.js +4 -0
- package/dist/session/phase-completion.runtime.js +22 -17
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +96 -0
- package/dist/session/pre-publication-process.d.ts +20 -0
- package/dist/session/pre-publication-process.js +97 -0
- package/dist/session/pre-publication-skipped-tests.d.ts +21 -0
- package/dist/session/pre-publication-skipped-tests.js +109 -0
- package/dist/session/pre-publication-step-execution.d.ts +11 -0
- package/dist/session/pre-publication-step-execution.js +49 -0
- package/dist/session/pre-publication-validation.d.ts +9 -9
- package/dist/session/pre-publication-validation.js +44 -112
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +2 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +21 -15
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +89 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +310 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +35 -1
- package/dist/session/provider-cli/provider-cli.process.js +187 -17
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +15 -0
- package/dist/session/provider-cli/provider-cli.service.js +126 -26
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +6 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +47 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +6 -0
- package/dist/session/provider-cli/provider-output-state.js +9 -0
- package/dist/session/publishable-worktree-changes.d.ts +54 -0
- package/dist/session/publishable-worktree-changes.js +193 -0
- package/dist/session/session.base.d.ts +3 -0
- package/dist/session/session.service.d.ts +2 -0
- package/dist/session/session.service.js +5 -0
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +14 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminEnvironment, hostRuntimeTestPostgresProvisionerEnvironment, } from "../runtime/host-runtime-contract.js";
|
|
6
|
+
import { isSubPath } from "../shared/path/path.js";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
export class ProcessPrePublicationCommandRunner {
|
|
9
|
+
async run(command, args, cwd, signal, environment) {
|
|
10
|
+
try {
|
|
11
|
+
const launch = await pnpmDirectoryLaunch(command, args, cwd);
|
|
12
|
+
const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm");
|
|
13
|
+
const executable = windowsBatch ? (process.env.ComSpec ?? "cmd.exe") : command;
|
|
14
|
+
const commandArgs = windowsBatch
|
|
15
|
+
? ["/d", "/s", "/c", [`${command}.cmd`, ...launch.args].map(quoteWindowsCommandArgument).join(" ")]
|
|
16
|
+
: [...launch.args];
|
|
17
|
+
const result = await execFileAsync(executable, commandArgs, {
|
|
18
|
+
cwd: launch.cwd,
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
21
|
+
signal,
|
|
22
|
+
env: prePublicationChildEnvironment(environment),
|
|
23
|
+
});
|
|
24
|
+
return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const failure = error;
|
|
28
|
+
if (failure.name === "AbortError")
|
|
29
|
+
throw error;
|
|
30
|
+
if (failure.code === "ENOENT") {
|
|
31
|
+
return { exitCode: 127, stderr: `executable_not_found: ${command}` };
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
exitCode: typeof failure.code === "number" ? failure.code : 1,
|
|
35
|
+
stdout: failure.stdout,
|
|
36
|
+
stderr: failure.stderr ?? failure.message,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function quoteWindowsCommandArgument(value) {
|
|
42
|
+
return /^[A-Za-z0-9_./:@=-]+$/u.test(value) ? value : `"${value.replaceAll('"', '""')}"`;
|
|
43
|
+
}
|
|
44
|
+
function prePublicationChildEnvironment(environment) {
|
|
45
|
+
const child = {};
|
|
46
|
+
const privilegedNames = new Set([
|
|
47
|
+
hostRuntimeTestPostgresAdminEnvironment.toLowerCase(),
|
|
48
|
+
hostRuntimeLegacyTestPostgresEnvironment.toLowerCase(),
|
|
49
|
+
hostRuntimeTestPostgresProvisionerEnvironment.toLowerCase(),
|
|
50
|
+
]);
|
|
51
|
+
for (const [name, value] of Object.entries(process.env)) {
|
|
52
|
+
if (typeof value === "string" && !privilegedNames.has(name.toLowerCase())) {
|
|
53
|
+
child[name] = value;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { ...child, ...environment };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Corepack picks the pnpm version from the nearest package.json `packageManager`
|
|
60
|
+
* pin at or above the process working directory; pnpm's own `--dir` is not
|
|
61
|
+
* consulted. The repository root carries no pin, so `pnpm --dir client ...`
|
|
62
|
+
* launched from the root would run Corepack's host-global default, and pnpm
|
|
63
|
+
* then refuses client's pin (ERR_PNPM_BAD_PM_VERSION). `pnpm --dir X cmd` is
|
|
64
|
+
* `pnpm cmd` run from X, so launch from X and let Corepack walk up from there
|
|
65
|
+
* to the nearest pin. Targets that are absolute, leave the worktree, or do not
|
|
66
|
+
* exist stay unchanged so pnpm reports them itself.
|
|
67
|
+
*/
|
|
68
|
+
export async function pnpmDirectoryLaunch(command, args, cwd) {
|
|
69
|
+
const unchanged = { args, cwd };
|
|
70
|
+
if (command !== "pnpm")
|
|
71
|
+
return unchanged;
|
|
72
|
+
const target = pnpmDirectoryArgument(args);
|
|
73
|
+
if (!target || path.isAbsolute(target.directory))
|
|
74
|
+
return unchanged;
|
|
75
|
+
if (!isSubPath(cwd, path.resolve(cwd, target.directory)))
|
|
76
|
+
return unchanged;
|
|
77
|
+
// The lexical check alone would let a symlink (or junction) inside the worktree
|
|
78
|
+
// move the child's cwd outside it, so compare and launch from real paths.
|
|
79
|
+
const realCwd = await fs.realpath(cwd).catch(() => null);
|
|
80
|
+
const packageDirectory = await fs.realpath(path.resolve(cwd, target.directory)).catch(() => null);
|
|
81
|
+
if (!realCwd || !packageDirectory || !isSubPath(realCwd, packageDirectory))
|
|
82
|
+
return unchanged;
|
|
83
|
+
const stat = await fs.stat(packageDirectory).catch(() => null);
|
|
84
|
+
if (!stat?.isDirectory())
|
|
85
|
+
return unchanged;
|
|
86
|
+
return { args: args.slice(target.consumed), cwd: packageDirectory };
|
|
87
|
+
}
|
|
88
|
+
/** Reads a leading `--dir X`, `--dir=X`, `-C X`, `-CX` or `-C=X`. */
|
|
89
|
+
function pnpmDirectoryArgument(args) {
|
|
90
|
+
const first = args[0] ?? "";
|
|
91
|
+
if (first === "--dir" || first === "-C")
|
|
92
|
+
return args[1] ? { directory: args[1], consumed: 2 } : null;
|
|
93
|
+
const inline = first.startsWith("--dir=") ? first.slice("--dir=".length)
|
|
94
|
+
: first.startsWith("-C") ? first.slice(2).replace(/^=/u, "")
|
|
95
|
+
: "";
|
|
96
|
+
return inline ? { directory: inline, consumed: 1 } : null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skipped .NET tests from the TRX files a validation step wrote, so a run that skipped tests reads as
|
|
3
|
+
* "passed with N skipped (reasons)" rather than a plain pass. Only files under the step's declared results
|
|
4
|
+
* directory and written since the step started count, and that directory must resolve (through symlinks) inside
|
|
5
|
+
* the worktree or the attempt's own test-output root; nothing here can fail a passing step.
|
|
6
|
+
*/
|
|
7
|
+
export interface SkippedTestSummary {
|
|
8
|
+
readonly count: number;
|
|
9
|
+
readonly reasons: readonly {
|
|
10
|
+
readonly reason: string;
|
|
11
|
+
readonly count: number;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
/** The attempt-owned output root a managed attempt's tests write under, outside the worktree. */
|
|
15
|
+
export declare const attemptTestOutputEnvironment = "FORGE_TEST_OUTPUT_DIR";
|
|
16
|
+
export declare function resultsDirectoryArgument(args: readonly string[]): string | undefined;
|
|
17
|
+
export declare function readSkippedTests(cwd: string, args: readonly string[], sinceMs: number, environment?: Readonly<Record<string, string>>): Promise<SkippedTestSummary>;
|
|
18
|
+
export declare function mergeSkippedTests(left: SkippedTestSummary, right: SkippedTestSummary): SkippedTestSummary;
|
|
19
|
+
export declare function describeSkippedTests(summary: SkippedTestSummary): string;
|
|
20
|
+
/** Each NotExecuted result's skip reason, from its ErrorInfo message (VSTest's TRX shape). */
|
|
21
|
+
export declare function skippedReasons(trx: string): string[];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { isSubPath } from "../shared/path/path.js";
|
|
4
|
+
const emptySummary = { count: 0, reasons: [] };
|
|
5
|
+
/** The attempt-owned output root a managed attempt's tests write under, outside the worktree. */
|
|
6
|
+
export const attemptTestOutputEnvironment = "FORGE_TEST_OUTPUT_DIR";
|
|
7
|
+
const resultsDirectoryFlags = new Set(["-resultsdirectory", "--results-directory"]);
|
|
8
|
+
const maxTrxBytes = 64 * 1024 * 1024;
|
|
9
|
+
const maxTrxFiles = 64;
|
|
10
|
+
const maxReasonLength = 400;
|
|
11
|
+
const maxReasons = 10;
|
|
12
|
+
export function resultsDirectoryArgument(args) {
|
|
13
|
+
const index = args.findIndex(arg => resultsDirectoryFlags.has(arg.toLowerCase()));
|
|
14
|
+
const value = index >= 0 ? args[index + 1] : undefined;
|
|
15
|
+
return value && !value.startsWith("-") ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
export async function readSkippedTests(cwd, args, sinceMs, environment) {
|
|
18
|
+
const declared = resultsDirectoryArgument(args);
|
|
19
|
+
if (!declared)
|
|
20
|
+
return emptySummary;
|
|
21
|
+
const root = await realDirectory(path.resolve(cwd, declared));
|
|
22
|
+
if (!root)
|
|
23
|
+
return emptySummary;
|
|
24
|
+
const attemptOutput = environment?.[attemptTestOutputEnvironment]?.trim();
|
|
25
|
+
const allowedRoots = (await Promise.all([cwd, ...(attemptOutput && path.isAbsolute(attemptOutput) ? [attemptOutput] : [])]
|
|
26
|
+
.map(realDirectory))).filter((allowed) => allowed !== undefined);
|
|
27
|
+
if (!allowedRoots.some(allowed => isSubPath(allowed, root)))
|
|
28
|
+
return emptySummary;
|
|
29
|
+
const files = await recentTrxFiles(root, sinceMs);
|
|
30
|
+
const counts = new Map();
|
|
31
|
+
let count = 0;
|
|
32
|
+
for (const file of files) {
|
|
33
|
+
for (const reason of skippedReasons(await fs.readFile(file, "utf8"))) {
|
|
34
|
+
count += 1;
|
|
35
|
+
counts.set(reason, (counts.get(reason) ?? 0) + 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { count, reasons: [...counts].map(([reason, n]) => ({ reason, count: n })) };
|
|
39
|
+
}
|
|
40
|
+
export function mergeSkippedTests(left, right) {
|
|
41
|
+
const counts = new Map(left.reasons.map(entry => [entry.reason, entry.count]));
|
|
42
|
+
for (const entry of right.reasons)
|
|
43
|
+
counts.set(entry.reason, (counts.get(entry.reason) ?? 0) + entry.count);
|
|
44
|
+
return { count: left.count + right.count, reasons: [...counts].map(([reason, count]) => ({ reason, count })) };
|
|
45
|
+
}
|
|
46
|
+
export function describeSkippedTests(summary) {
|
|
47
|
+
const shown = [...summary.reasons].sort((a, b) => b.count - a.count).slice(0, maxReasons);
|
|
48
|
+
const more = summary.reasons.length - shown.length;
|
|
49
|
+
return `${summary.count} skipped test${summary.count === 1 ? "" : "s"} (${shown
|
|
50
|
+
.map(entry => `${entry.count}x ${entry.reason}`).join("; ")}${more > 0 ? `; ${more} more reasons` : ""})`;
|
|
51
|
+
}
|
|
52
|
+
/** Each NotExecuted result's skip reason, from its ErrorInfo message (VSTest's TRX shape). */
|
|
53
|
+
export function skippedReasons(trx) {
|
|
54
|
+
const reasons = [];
|
|
55
|
+
const result = /<UnitTestResult\b([^>]*?)(?:\/>|>([\s\S]*?)<\/UnitTestResult>)/gu;
|
|
56
|
+
for (const match of trx.matchAll(result)) {
|
|
57
|
+
if (!/\boutcome="NotExecuted"/u.test(match[1] ?? ""))
|
|
58
|
+
continue;
|
|
59
|
+
const message = /<Message>([\s\S]*?)<\/Message>/u.exec(match[2] ?? "")?.[1];
|
|
60
|
+
const reason = message ? decodeXml(message).replace(/\s+/gu, " ").trim() : "";
|
|
61
|
+
reasons.push(reason.length === 0 ? "no reason recorded"
|
|
62
|
+
: reason.length > maxReasonLength ? `${reason.slice(0, maxReasonLength)}...` : reason);
|
|
63
|
+
}
|
|
64
|
+
return reasons;
|
|
65
|
+
}
|
|
66
|
+
async function realDirectory(candidate) {
|
|
67
|
+
try {
|
|
68
|
+
const real = await fs.realpath(candidate);
|
|
69
|
+
return (await fs.stat(real)).isDirectory() ? real : undefined;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function recentTrxFiles(root, sinceMs) {
|
|
76
|
+
const found = [];
|
|
77
|
+
const pending = [root];
|
|
78
|
+
while (pending.length > 0 && found.length < maxTrxFiles) {
|
|
79
|
+
const directory = pending.pop();
|
|
80
|
+
let entries;
|
|
81
|
+
try {
|
|
82
|
+
entries = await fs.readdir(directory, { withFileTypes: true });
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
const full = path.join(directory, entry.name);
|
|
89
|
+
if (entry.isDirectory())
|
|
90
|
+
pending.push(full);
|
|
91
|
+
else if (entry.isFile() && entry.name.toLowerCase().endsWith(".trx")) {
|
|
92
|
+
const stat = await fs.stat(full).catch(() => null);
|
|
93
|
+
if (stat && stat.mtimeMs >= sinceMs && stat.size <= maxTrxBytes)
|
|
94
|
+
found.push(full);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return found.sort();
|
|
99
|
+
}
|
|
100
|
+
function decodeXml(value) {
|
|
101
|
+
return value.replace(/&(#x[0-9a-f]+|#[0-9]+|lt|gt|amp|quot|apos);/giu, (entity, name) => {
|
|
102
|
+
const lower = name.toLowerCase();
|
|
103
|
+
if (lower.startsWith("#x"))
|
|
104
|
+
return String.fromCodePoint(Number.parseInt(lower.slice(2), 16));
|
|
105
|
+
if (lower.startsWith("#"))
|
|
106
|
+
return String.fromCodePoint(Number.parseInt(lower.slice(1), 10));
|
|
107
|
+
return { lt: "<", gt: ">", amp: "&", quot: "\"", apos: "'" }[lower] ?? entity;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PrePublicationExecutionContext } from "./pre-publication-validation.js";
|
|
2
|
+
export interface ValidationStep {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly fallbackCommand?: string;
|
|
5
|
+
readonly args: readonly string[];
|
|
6
|
+
readonly fallbackArgs?: readonly string[];
|
|
7
|
+
readonly assertUnchangedPaths?: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function managedAttemptInvocation(checkId: string, step: ValidationStep, environment?: Readonly<Record<string, string>>): Pick<ValidationStep, "command" | "args">;
|
|
10
|
+
export declare function supportsNativeTestPostgresFallback(checkId: string): boolean;
|
|
11
|
+
export declare function validationExecutionForStep(checkId: string, step: ValidationStep, execution?: PrePublicationExecutionContext, postgresAdminConnection?: string): PrePublicationExecutionContext | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { nativeTestPostgresFallbackEnvironment, parseNativeTestPostgresFallback, } from "../runtime/native-test-postgres-fallback.js";
|
|
2
|
+
import { ForgeFailureError } from "./session.types.js";
|
|
3
|
+
export function managedAttemptInvocation(checkId, step, environment) {
|
|
4
|
+
const playwrightConfig = environment?.FORGE_PLAYWRIGHT_CONFIG?.trim();
|
|
5
|
+
const attemptOwned = environment?.FORGE_E2E_OWNERSHIP_MODE === "attempt"
|
|
6
|
+
|| Boolean(environment?.FORGE_DISPATCH_ATTEMPT_ID?.trim());
|
|
7
|
+
if (checkId !== "playwright-e2e" || !attemptOwned) {
|
|
8
|
+
return step;
|
|
9
|
+
}
|
|
10
|
+
if (!playwrightConfig) {
|
|
11
|
+
throw new ForgeFailureError("prepublication_capability_unavailable", "prepublication_capability_unavailable: playwright-e2e requires the Bridge-generated FORGE_PLAYWRIGHT_CONFIG for a managed attempt.", "bridge");
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
command: "pnpm",
|
|
15
|
+
args: ["--dir", "tests/e2e", "exec", "playwright", "test", "--config", playwrightConfig],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const nativeFallbackCheckIds = new Set([
|
|
19
|
+
"owned-suite-registration",
|
|
20
|
+
"dotnet-build-and-unit",
|
|
21
|
+
"comment-repair-dotnet-regression",
|
|
22
|
+
]);
|
|
23
|
+
const nativeFallbackDotnetTierScripts = [
|
|
24
|
+
"scripts/run-dotnet-test-tier.ps1",
|
|
25
|
+
"scripts/run-dotnet-test-tier-set.ps1",
|
|
26
|
+
"scripts/run-affected-dotnet-tests.mjs",
|
|
27
|
+
];
|
|
28
|
+
export function supportsNativeTestPostgresFallback(checkId) {
|
|
29
|
+
return nativeFallbackCheckIds.has(checkId);
|
|
30
|
+
}
|
|
31
|
+
export function validationExecutionForStep(checkId, step, execution, postgresAdminConnection) {
|
|
32
|
+
// The connection only exists when Docker is unavailable and the operator
|
|
33
|
+
// provisioned a dedicated native test cluster. Only the runner-authored
|
|
34
|
+
// .NET test tiers and the suite-identity check receive it; build, client,
|
|
35
|
+
// Bridge, and E2E steps never do.
|
|
36
|
+
if (!postgresAdminConnection || !nativeFallbackCheckIds.has(checkId))
|
|
37
|
+
return execution;
|
|
38
|
+
const runsDotnetTier = step.args.some(argument => nativeFallbackDotnetTierScripts
|
|
39
|
+
.some(script => argument.replaceAll("\\", "/").endsWith(script)));
|
|
40
|
+
if (checkId !== "owned-suite-registration" && !runsDotnetTier)
|
|
41
|
+
return execution;
|
|
42
|
+
return {
|
|
43
|
+
...execution,
|
|
44
|
+
environment: {
|
|
45
|
+
...execution?.environment,
|
|
46
|
+
...nativeTestPostgresFallbackEnvironment(parseNativeTestPostgresFallback(postgresAdminConnection)),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { DockerEngineProbe } from "../runtime/docker-engine-probe.js";
|
|
2
|
-
import {
|
|
2
|
+
import type { NativeTestPostgresFallback } from "../runtime/native-test-postgres-fallback.js";
|
|
3
|
+
import type { HostLoadStepGate } from "../runtime/host-load-governor.js";
|
|
4
|
+
import { type PrePublicationHostLoadOwner } from "./pre-publication-host-load.js";
|
|
5
|
+
import { type ValidationStep } from "./pre-publication-step-execution.js";
|
|
3
6
|
import type { ProviderProcessRunner } from "./provider-cli/provider-cli.process.js";
|
|
4
7
|
import { ForgeFailureError, type RunnerDispatchEvent } from "./session.types.js";
|
|
5
8
|
export type PrePublicationProfile = "implementation" | "comment_repair" | "ci_repair" | "conflict_repair";
|
|
6
|
-
interface ValidationStep {
|
|
7
|
-
readonly command: string;
|
|
8
|
-
readonly fallbackCommand?: string;
|
|
9
|
-
readonly args: readonly string[];
|
|
10
|
-
readonly fallbackArgs?: readonly string[];
|
|
11
|
-
readonly assertUnchangedPaths?: readonly string[];
|
|
12
|
-
}
|
|
13
9
|
interface ValidationCheck {
|
|
14
10
|
readonly id: string;
|
|
15
11
|
readonly profiles: readonly string[];
|
|
@@ -36,6 +32,8 @@ export interface PrePublicationExecutionContext {
|
|
|
36
32
|
readonly baselineRevision?: string;
|
|
37
33
|
readonly environment?: Readonly<Record<string, string>>;
|
|
38
34
|
readonly processRunner?: ProviderProcessRunner;
|
|
35
|
+
/** The attempt governed steps reserve host capacity for (decision 0013). */
|
|
36
|
+
readonly hostLoadOwner?: PrePublicationHostLoadOwner;
|
|
39
37
|
}
|
|
40
38
|
export declare class PrePublicationValidationError extends ForgeFailureError {
|
|
41
39
|
readonly checkId: string;
|
|
@@ -59,7 +57,8 @@ export declare class PrePublicationValidator {
|
|
|
59
57
|
private readonly commands;
|
|
60
58
|
private readonly dockerEngineProbe?;
|
|
61
59
|
private readonly nativeTestPostgresFallback;
|
|
62
|
-
|
|
60
|
+
private readonly hostLoad?;
|
|
61
|
+
constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null, hostLoad?: HostLoadStepGate | undefined);
|
|
63
62
|
validate(worktreePath: string, profile: PrePublicationProfile, capabilities: ReadonlySet<string>, emit?: (event: RunnerDispatchEvent) => Promise<void>, signal?: AbortSignal, execution?: PrePublicationExecutionContext): Promise<readonly string[]>;
|
|
64
63
|
/** Returns the native fallback connection when this check must use it instead of Docker. */
|
|
65
64
|
private ensurePrerequisite;
|
|
@@ -68,6 +67,7 @@ export declare class PrePublicationValidator {
|
|
|
68
67
|
private changedPaths;
|
|
69
68
|
private assertContractMatchesDispatchBaseline;
|
|
70
69
|
private runStep;
|
|
70
|
+
private launchStep;
|
|
71
71
|
private runCommand;
|
|
72
72
|
}
|
|
73
73
|
export declare function applicableChecks(contract: ValidationContract, profile: PrePublicationProfile | "github_actions", changedPaths: readonly string[]): readonly ValidationCheck[];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
4
3
|
import path from "node:path";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
4
|
import { attemptDatabaseCapabilityEnvironment, attemptDatabaseCapabilitySecrets, } from "../runtime/attempt-database-broker.js";
|
|
7
5
|
import { assertHostDatabaseCapabilityBoundary } from "../runtime/host-database-capability-boundary.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { runHostGovernedValidationStep } from "./pre-publication-host-load.js";
|
|
7
|
+
import { managedAttemptInvocation, supportsNativeTestPostgresFallback, validationExecutionForStep, } from "./pre-publication-step-execution.js";
|
|
8
|
+
import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminEnvironment, hostRuntimeTestPostgresProvisionerEnvironment, } from "../runtime/host-runtime-contract.js";
|
|
10
9
|
import { redactText } from "../shared/redaction/redaction.js";
|
|
10
|
+
import { describeSkippedTests, mergeSkippedTests, readSkippedTests, } from "./pre-publication-skipped-tests.js";
|
|
11
|
+
import { ProcessPrePublicationCommandRunner, pnpmDirectoryLaunch } from "./pre-publication-process.js";
|
|
11
12
|
import { findUnreferencedNewExports } from "./unreferenced-exports.js";
|
|
12
13
|
import { ForgeFailureError, sanitizeFailureError, } from "./session.types.js";
|
|
13
|
-
const execFileAsync = promisify(execFile);
|
|
14
14
|
const contractRelativePath = ".forge/validation/ci-parity.v1.json";
|
|
15
15
|
const requiredCheckIds = new Set([
|
|
16
16
|
"file-size-inventory",
|
|
@@ -81,62 +81,16 @@ export class PrePublicationInfrastructureError extends ForgeFailureError {
|
|
|
81
81
|
this.name = "PrePublicationInfrastructureError";
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class ProcessPrePublicationCommandRunner {
|
|
85
|
-
async run(command, args, cwd, signal, environment) {
|
|
86
|
-
try {
|
|
87
|
-
const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm");
|
|
88
|
-
const executable = windowsBatch ? (process.env.ComSpec ?? "cmd.exe") : command;
|
|
89
|
-
const commandArgs = windowsBatch
|
|
90
|
-
? ["/d", "/s", "/c", [`${command}.cmd`, ...args].map(quoteWindowsCommandArgument).join(" ")]
|
|
91
|
-
: [...args];
|
|
92
|
-
const result = await execFileAsync(executable, commandArgs, {
|
|
93
|
-
cwd,
|
|
94
|
-
encoding: "utf8",
|
|
95
|
-
maxBuffer: 4 * 1024 * 1024,
|
|
96
|
-
signal,
|
|
97
|
-
env: prePublicationChildEnvironment(environment),
|
|
98
|
-
});
|
|
99
|
-
return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
const failure = error;
|
|
103
|
-
if (failure.name === "AbortError")
|
|
104
|
-
throw error;
|
|
105
|
-
if (failure.code === "ENOENT") {
|
|
106
|
-
return { exitCode: 127, stderr: `executable_not_found: ${command}` };
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
exitCode: typeof failure.code === "number" ? failure.code : 1,
|
|
110
|
-
stdout: failure.stdout,
|
|
111
|
-
stderr: failure.stderr ?? failure.message,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function quoteWindowsCommandArgument(value) {
|
|
117
|
-
return /^[A-Za-z0-9_./:@=-]+$/u.test(value) ? value : `"${value.replaceAll('"', '""')}"`;
|
|
118
|
-
}
|
|
119
|
-
function prePublicationChildEnvironment(environment) {
|
|
120
|
-
const child = {};
|
|
121
|
-
const privilegedNames = new Set([
|
|
122
|
-
hostRuntimeTestPostgresAdminEnvironment.toLowerCase(),
|
|
123
|
-
hostRuntimeLegacyTestPostgresEnvironment.toLowerCase(),
|
|
124
|
-
]);
|
|
125
|
-
for (const [name, value] of Object.entries(process.env)) {
|
|
126
|
-
if (typeof value === "string" && !privilegedNames.has(name.toLowerCase())) {
|
|
127
|
-
child[name] = value;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return { ...child, ...environment };
|
|
131
|
-
}
|
|
132
84
|
export class PrePublicationValidator {
|
|
133
85
|
commands;
|
|
134
86
|
dockerEngineProbe;
|
|
135
87
|
nativeTestPostgresFallback;
|
|
136
|
-
|
|
88
|
+
hostLoad;
|
|
89
|
+
constructor(commands = new ProcessPrePublicationCommandRunner(), dockerEngineProbe, nativeTestPostgresFallback = () => null, hostLoad) {
|
|
137
90
|
this.commands = commands;
|
|
138
91
|
this.dockerEngineProbe = dockerEngineProbe;
|
|
139
92
|
this.nativeTestPostgresFallback = nativeTestPostgresFallback;
|
|
93
|
+
this.hostLoad = hostLoad;
|
|
140
94
|
}
|
|
141
95
|
async validate(worktreePath, profile, capabilities, emit, signal, execution) {
|
|
142
96
|
const checksExports = profile === "implementation" || profile === "comment_repair";
|
|
@@ -176,12 +130,14 @@ export class PrePublicationValidator {
|
|
|
176
130
|
}
|
|
177
131
|
const postgresAdminConnection = await this.ensurePrerequisite(check, scoped.execution?.environment, scoped.postgresAdminConnection, emit) ?? scoped.postgresAdminConnection;
|
|
178
132
|
await emit?.(validationEvent("prepublication_validation_started", check.id, `Running pre-publication CI parity check '${check.id}'.`));
|
|
133
|
+
let skipped = { count: 0, reasons: [] };
|
|
179
134
|
for (const step of check.steps) {
|
|
180
|
-
|
|
135
|
+
const stepStartedMs = Date.now() - 1000;
|
|
136
|
+
let result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection, emit);
|
|
181
137
|
await this.throwIfPrerequisiteWasLost(check, result, scoped.execution?.environment, postgresAdminConnection, emit);
|
|
182
138
|
if (isTimeoutOnlyClientTestFailure(check.id, step, result)) {
|
|
183
139
|
await emit?.(validationEvent("prepublication_validation_timeout_confirmation_started", check.id, "The full client test step reported only Vitest timeouts; confirming once with the same command and attempt environment."));
|
|
184
|
-
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection);
|
|
140
|
+
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection, emit);
|
|
185
141
|
await this.throwIfPrerequisiteWasLost(check, result, scoped.execution?.environment, postgresAdminConnection, emit);
|
|
186
142
|
await emit?.(validationEvent(result.exitCode === 0
|
|
187
143
|
? "prepublication_validation_timeout_confirmation_passed"
|
|
@@ -191,7 +147,7 @@ export class PrePublicationValidator {
|
|
|
191
147
|
}
|
|
192
148
|
if (isTransientBridgeCleanupFailure(check.id, step, result)) {
|
|
193
149
|
await emit?.(validationEvent("prepublication_validation_cleanup_confirmation_started", check.id, "The Bridge suite hit the known Windows temporary-worktree cleanup race; confirming once with the same command and attempt environment."));
|
|
194
|
-
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection);
|
|
150
|
+
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection, emit);
|
|
195
151
|
await this.throwIfPrerequisiteWasLost(check, result, scoped.execution?.environment, postgresAdminConnection, emit);
|
|
196
152
|
await emit?.(validationEvent(result.exitCode === 0
|
|
197
153
|
? "prepublication_validation_cleanup_confirmation_passed"
|
|
@@ -201,7 +157,7 @@ export class PrePublicationValidator {
|
|
|
201
157
|
}
|
|
202
158
|
if (isTransientShellInfrastructureFailure(result)) {
|
|
203
159
|
await emit?.(validationEvent("prepublication_infrastructure_confirmation_started", check.id, "The validation shell reported a known host-runtime failure; confirming once with the same command and attempt environment."));
|
|
204
|
-
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection);
|
|
160
|
+
result = await this.runStep(check.id, step, worktreePath, signal, scoped.execution, postgresAdminConnection, emit);
|
|
205
161
|
await this.throwIfPrerequisiteWasLost(check, result, scoped.execution?.environment, postgresAdminConnection, emit);
|
|
206
162
|
const infrastructureFailed = isTransientShellInfrastructureFailure(result);
|
|
207
163
|
await emit?.(validationEvent(infrastructureFailed
|
|
@@ -222,9 +178,17 @@ export class PrePublicationValidator {
|
|
|
222
178
|
await emit?.(validationEvent("prepublication_validation_failed", check.id, `Pre-publication CI parity check '${check.id}' exited ${result.exitCode}${detail ? `: ${detail}` : "."}`));
|
|
223
179
|
throw new PrePublicationValidationError(check.id, result.exitCode, result.command, result.args, detail);
|
|
224
180
|
}
|
|
181
|
+
// The invocation's own arguments: a managed attempt may direct results to its test-output root.
|
|
182
|
+
skipped = mergeSkippedTests(skipped, await readSkippedTests(worktreePath, result.args, stepStartedMs, scoped.execution?.environment));
|
|
225
183
|
}
|
|
226
184
|
completed.push(check.id);
|
|
227
|
-
|
|
185
|
+
// A pass that skipped tests says so, with each reason, instead of reading as a plain pass.
|
|
186
|
+
const secrets = validationExactSecrets(scoped.execution?.environment);
|
|
187
|
+
skipped = { ...skipped, reasons: skipped.reasons.map(entry => ({ ...entry, reason: redactText(entry.reason, secrets) })) };
|
|
188
|
+
const skippedDetail = skipped.count > 0 ? describeSkippedTests(skipped) : undefined;
|
|
189
|
+
await emit?.(validationEvent("prepublication_validation_passed", check.id, skippedDetail
|
|
190
|
+
? `Pre-publication CI parity check '${check.id}' passed with ${skippedDetail}.`
|
|
191
|
+
: `Pre-publication CI parity check '${check.id}' passed.`, skipped.count > 0 ? { skippedTests: skipped.count, skippedReasons: skipped.reasons } : undefined));
|
|
228
192
|
}
|
|
229
193
|
return completed;
|
|
230
194
|
}
|
|
@@ -252,7 +216,7 @@ export class PrePublicationValidator {
|
|
|
252
216
|
const snapshot = await this.dockerEngineProbe.ensureAvailableForRequiredWork();
|
|
253
217
|
if (!snapshot.available) {
|
|
254
218
|
const detail = `Docker prerequisite unavailable (${snapshot.unavailableCode ?? "docker_engine_unavailable"}): ${snapshot.unavailableReason ?? "the daemon did not pass a fresh readiness probe"}`;
|
|
255
|
-
const fallback = check.requiredPrerequisite === "isolated_postgres" && supportsNativeTestPostgresFallback(check)
|
|
219
|
+
const fallback = check.requiredPrerequisite === "isolated_postgres" && supportsNativeTestPostgresFallback(check.id)
|
|
256
220
|
? this.nativeTestPostgresFallback()
|
|
257
221
|
: null;
|
|
258
222
|
if (fallback) {
|
|
@@ -338,8 +302,14 @@ export class PrePublicationValidator {
|
|
|
338
302
|
throw new ForgeFailureError("prepublication_contract_invalid", `prepublication_contract_invalid: the CI parity contract changed after dispatch (baseline ${baselineDigest}, worktree ${contractDigest}).`, "bridge");
|
|
339
303
|
}
|
|
340
304
|
}
|
|
341
|
-
async runStep(checkId, step, cwd, signal, execution, postgresAdminConnection) {
|
|
305
|
+
async runStep(checkId, step, cwd, signal, execution, postgresAdminConnection, emit) {
|
|
342
306
|
const invocation = managedAttemptInvocation(checkId, step, execution?.environment);
|
|
307
|
+
// Every launch, including confirmation reruns, is admitted by the host load governor first.
|
|
308
|
+
return await runHostGovernedValidationStep(this.hostLoad, {
|
|
309
|
+
checkId, command: invocation.command, args: invocation.args, owner: execution?.hostLoadOwner, signal, emit,
|
|
310
|
+
}, async (stepSignal) => await this.launchStep(checkId, step, invocation, cwd, stepSignal, execution, postgresAdminConnection));
|
|
311
|
+
}
|
|
312
|
+
async launchStep(checkId, step, invocation, cwd, signal, execution, postgresAdminConnection) {
|
|
343
313
|
const stepExecution = validationExecutionForStep(checkId, step, execution, postgresAdminConnection);
|
|
344
314
|
const before = await readValidationFiles(cwd, step.assertUnchangedPaths ?? []);
|
|
345
315
|
const result = await this.runCommand(invocation.command, invocation.args, cwd, signal, stepExecution);
|
|
@@ -361,10 +331,11 @@ export class PrePublicationValidator {
|
|
|
361
331
|
const exactSecrets = validationExactSecrets(execution?.environment);
|
|
362
332
|
try {
|
|
363
333
|
if (execution?.processRunner) {
|
|
334
|
+
const launch = await pnpmDirectoryLaunch(command, args, cwd);
|
|
364
335
|
const result = await execution.processRunner.run({
|
|
365
336
|
command,
|
|
366
|
-
args,
|
|
367
|
-
cwd,
|
|
337
|
+
args: launch.args,
|
|
338
|
+
cwd: launch.cwd,
|
|
368
339
|
env: execution.environment,
|
|
369
340
|
captureOutput: true,
|
|
370
341
|
failureRedactionValues: exactSecrets,
|
|
@@ -387,53 +358,6 @@ export class PrePublicationValidator {
|
|
|
387
358
|
}
|
|
388
359
|
}
|
|
389
360
|
}
|
|
390
|
-
function managedAttemptInvocation(checkId, step, environment) {
|
|
391
|
-
const playwrightConfig = environment?.FORGE_PLAYWRIGHT_CONFIG?.trim();
|
|
392
|
-
const attemptOwned = environment?.FORGE_E2E_OWNERSHIP_MODE === "attempt"
|
|
393
|
-
|| Boolean(environment?.FORGE_DISPATCH_ATTEMPT_ID?.trim());
|
|
394
|
-
if (checkId !== "playwright-e2e" || !attemptOwned) {
|
|
395
|
-
return step;
|
|
396
|
-
}
|
|
397
|
-
if (!playwrightConfig) {
|
|
398
|
-
throw new ForgeFailureError("prepublication_capability_unavailable", "prepublication_capability_unavailable: playwright-e2e requires the Bridge-generated FORGE_PLAYWRIGHT_CONFIG for a managed attempt.", "bridge");
|
|
399
|
-
}
|
|
400
|
-
return {
|
|
401
|
-
command: "pnpm",
|
|
402
|
-
args: ["--dir", "tests/e2e", "exec", "playwright", "test", "--config", playwrightConfig],
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
const nativeFallbackCheckIds = new Set([
|
|
406
|
-
"owned-suite-registration",
|
|
407
|
-
"dotnet-build-and-unit",
|
|
408
|
-
"comment-repair-dotnet-regression",
|
|
409
|
-
]);
|
|
410
|
-
const nativeFallbackDotnetTierScripts = [
|
|
411
|
-
"scripts/run-dotnet-test-tier.ps1",
|
|
412
|
-
"scripts/run-dotnet-test-tier-set.ps1",
|
|
413
|
-
"scripts/run-affected-dotnet-tests.mjs",
|
|
414
|
-
];
|
|
415
|
-
function supportsNativeTestPostgresFallback(check) {
|
|
416
|
-
return nativeFallbackCheckIds.has(check.id);
|
|
417
|
-
}
|
|
418
|
-
function validationExecutionForStep(checkId, step, execution, postgresAdminConnection) {
|
|
419
|
-
// The connection only exists when Docker is unavailable and the operator
|
|
420
|
-
// provisioned a dedicated native test cluster. Only the runner-authored
|
|
421
|
-
// .NET test tiers and the suite-identity check receive it; build, client,
|
|
422
|
-
// Bridge, and E2E steps never do.
|
|
423
|
-
if (!postgresAdminConnection || !nativeFallbackCheckIds.has(checkId))
|
|
424
|
-
return execution;
|
|
425
|
-
const runsDotnetTier = step.args.some(argument => nativeFallbackDotnetTierScripts
|
|
426
|
-
.some(script => argument.replaceAll("\\", "/").endsWith(script)));
|
|
427
|
-
if (checkId !== "owned-suite-registration" && !runsDotnetTier)
|
|
428
|
-
return execution;
|
|
429
|
-
return {
|
|
430
|
-
...execution,
|
|
431
|
-
environment: {
|
|
432
|
-
...execution?.environment,
|
|
433
|
-
...nativeTestPostgresFallbackEnvironment(parseNativeTestPostgresFallback(postgresAdminConnection)),
|
|
434
|
-
},
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
361
|
function environmentValue(environment, name) {
|
|
438
362
|
return Object.prototype.hasOwnProperty.call(environment ?? {}, name)
|
|
439
363
|
? environment?.[name]?.trim() ?? ""
|
|
@@ -455,6 +379,7 @@ function validationExactSecrets(environment) {
|
|
|
455
379
|
return [
|
|
456
380
|
environment?.[hostRuntimeTestPostgresAdminEnvironment]?.trim() ?? "",
|
|
457
381
|
environment?.[hostRuntimeLegacyTestPostgresEnvironment]?.trim() ?? "",
|
|
382
|
+
environment?.[hostRuntimeTestPostgresProvisionerEnvironment]?.trim() ?? "",
|
|
458
383
|
...attemptDatabaseCapabilitySecrets(environment?.[attemptDatabaseCapabilityEnvironment]),
|
|
459
384
|
].filter((value, index, values) => value.length > 0 && values.indexOf(value) === index);
|
|
460
385
|
}
|
|
@@ -587,6 +512,7 @@ function withoutPrivilegedPostgresEnvironment(environment) {
|
|
|
587
512
|
const privilegedNames = new Set([
|
|
588
513
|
hostRuntimeTestPostgresAdminEnvironment.toLowerCase(),
|
|
589
514
|
hostRuntimeLegacyTestPostgresEnvironment.toLowerCase(),
|
|
515
|
+
hostRuntimeTestPostgresProvisionerEnvironment.toLowerCase(),
|
|
590
516
|
]);
|
|
591
517
|
return Object.fromEntries(Object.entries(environment)
|
|
592
518
|
.filter(([name]) => !privilegedNames.has(name.toLowerCase())));
|
|
@@ -656,6 +582,12 @@ function canonicalizeJson(value) {
|
|
|
656
582
|
}
|
|
657
583
|
return value;
|
|
658
584
|
}
|
|
659
|
-
function validationEvent(eventType, checkId, content) {
|
|
660
|
-
return {
|
|
585
|
+
function validationEvent(eventType, checkId, content, detail) {
|
|
586
|
+
return {
|
|
587
|
+
role: "runner",
|
|
588
|
+
kind: "checkpoint",
|
|
589
|
+
content,
|
|
590
|
+
eventType,
|
|
591
|
+
data: JSON.stringify({ checkId, contractId: "forge-ci-parity-v1", ...detail }),
|
|
592
|
+
};
|
|
661
593
|
}
|
|
@@ -2,6 +2,7 @@ import { GitClient } from "../../shared/git/git.js";
|
|
|
2
2
|
import { type CompletionPhase, type CompletionToolRuntime, type DebugCompletionPhase, type QaCompletionGate } from "../phase-completion.js";
|
|
3
3
|
import type { RunOnceDispatchPacket, RunnerDispatchArtifact, RunnerDispatchSidecar } from "../session.types.js";
|
|
4
4
|
import type { ProviderCliRunContext } from "./provider-cli.types.js";
|
|
5
|
+
import { type ProviderProcessRunResult } from "./provider-cli.process.js";
|
|
5
6
|
export declare function emitDraftGateArtifacts(emit: ProviderCliRunContext["emit"], worktreePath: string, workItemId: string): Promise<void>;
|
|
6
7
|
export declare function emitDecomposeGateArtifacts(emit: ProviderCliRunContext["emit"], worktreePath: string, workItemId: string): Promise<void>;
|
|
7
8
|
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
@@ -91,5 +92,5 @@ export declare class LiveCompletionArtifactEmitter {
|
|
|
91
92
|
private pollQueued;
|
|
92
93
|
private poll;
|
|
93
94
|
}
|
|
94
|
-
export declare function readCompletionArtifactsForRun(worktreePath: string, workItemId: string, phase: CompletionPhase, developCycle: boolean, debugCycle: boolean): Promise<RunnerDispatchArtifact[]>;
|
|
95
|
+
export declare function readCompletionArtifactsForRun(worktreePath: string, workItemId: string, phase: CompletionPhase, developCycle: boolean, debugCycle: boolean, providerResult?: Pick<ProviderProcessRunResult, "terminalStopReason"> | null): Promise<RunnerDispatchArtifact[]>;
|
|
95
96
|
export {};
|