@loucompanion/forge-bridge 0.1.4-dev.800627ea0931 → 0.1.4-dev.81e48ecc185d
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/session/pre-publication-pass.d.ts +2 -1
- package/dist/session/pre-publication-pass.js +8 -5
- package/dist/session/pre-publication-validation.d.ts +2 -0
- package/dist/session/pre-publication-validation.js +30 -4
- package/dist/session/sandbox-host-capacity-gate.js +10 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -29,7 +29,8 @@ export declare class PrePublicationValidationError extends ForgeFailureError {
|
|
|
29
29
|
export declare class PrePublicationPass {
|
|
30
30
|
private readonly runtimeRestartFailure?;
|
|
31
31
|
private readonly failures;
|
|
32
|
-
|
|
32
|
+
/** The check whose .NET build failed to compile in this pass, if any. */
|
|
33
|
+
private dotnetCompileFailedIn;
|
|
33
34
|
/** A failed runtime restart before the pass is its first failure. */
|
|
34
35
|
constructor(runtimeRestartFailure?: PrePublicationValidationError | undefined);
|
|
35
36
|
record(failure: PrePublicationCheckFailure, failedStep?: ValidationStep): void;
|
|
@@ -7,7 +7,9 @@ import { ForgeFailureError, failureFactsFromError } from "./session.types.js";
|
|
|
7
7
|
// could not run because a check they depend on failed, and reports them all as one failure.
|
|
8
8
|
/** The check id a failed restart of the attempt's runtime stack before the pass is reported under. */
|
|
9
9
|
export const runtimeRestartCheckId = "host-runtime-restart";
|
|
10
|
-
|
|
10
|
+
// The checks whose first step builds the .NET solution: CI's whole-tier check and the affected
|
|
11
|
+
// tests every gate profile runs (decision 0017).
|
|
12
|
+
const dotnetBuildCheckIds = new Set(["dotnet-build-and-unit", "comment-repair-dotnet-regression"]);
|
|
11
13
|
// Checks that build the .NET solution themselves and would only repeat the compiler errors once its
|
|
12
14
|
// compile step fails: the OpenAPI export builds Forge.Api and the E2E suite publishes it.
|
|
13
15
|
const dotnetBuildConsumers = new Set(["openapi-and-generated-types", "playwright-e2e"]);
|
|
@@ -62,7 +64,8 @@ function clipDetail(detail) {
|
|
|
62
64
|
export class PrePublicationPass {
|
|
63
65
|
runtimeRestartFailure;
|
|
64
66
|
failures = [];
|
|
65
|
-
|
|
67
|
+
/** The check whose .NET build failed to compile in this pass, if any. */
|
|
68
|
+
dotnetCompileFailedIn = null;
|
|
66
69
|
/** A failed runtime restart before the pass is its first failure. */
|
|
67
70
|
constructor(runtimeRestartFailure) {
|
|
68
71
|
this.runtimeRestartFailure = runtimeRestartFailure;
|
|
@@ -70,14 +73,14 @@ export class PrePublicationPass {
|
|
|
70
73
|
}
|
|
71
74
|
record(failure, failedStep) {
|
|
72
75
|
this.failures.push(failure);
|
|
73
|
-
if (failure.checkId
|
|
74
|
-
this.
|
|
76
|
+
if (dotnetBuildCheckIds.has(failure.checkId) && failedStep?.command === "dotnet" && failedStep.args[0] === "build") {
|
|
77
|
+
this.dotnetCompileFailedIn ??= failure.checkId;
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
/** The failed checks that keep this check from running meaningfully in this pass. */
|
|
78
81
|
blockers(checkId) {
|
|
79
82
|
return [
|
|
80
|
-
...(this.
|
|
83
|
+
...(this.dotnetCompileFailedIn && dotnetBuildConsumers.has(checkId) ? [this.dotnetCompileFailedIn] : []),
|
|
81
84
|
...(this.runtimeRestartFailure && runtimeStackConsumers.has(checkId) ? [runtimeRestartCheckId] : []),
|
|
82
85
|
];
|
|
83
86
|
}
|
|
@@ -77,6 +77,8 @@ export declare class PrePublicationValidator {
|
|
|
77
77
|
private checkTestOnlyExports;
|
|
78
78
|
private changedPaths;
|
|
79
79
|
private assertContractMatchesDispatchBaseline;
|
|
80
|
+
/** The approved contract of the branch an in-progress merge brings in (MERGE_HEAD), else null. */
|
|
81
|
+
private mergedInContractDigest;
|
|
80
82
|
private runStep;
|
|
81
83
|
private launchStep;
|
|
82
84
|
private runCommand;
|
|
@@ -23,16 +23,21 @@ const requiredCheckIds = new Set([
|
|
|
23
23
|
"playwright-e2e",
|
|
24
24
|
"github-provider-policy",
|
|
25
25
|
]);
|
|
26
|
-
|
|
26
|
+
// Every gate profile runs the affected .NET tests; only CI runs the whole tiers (decision 0017).
|
|
27
|
+
const currentApprovedContractDigest = "9cf3a3070de56f3d3bc2c013dfa45b0fd463d257722849087e6743fb9cb1fd0d";
|
|
28
|
+
// Only comment repair ran the affected tests; the other profiles ran Unit, Contract and
|
|
29
|
+
// Infrastructure whole. Story branches cut before decision 0017 still carry it.
|
|
30
|
+
const commentRepairOnlyAffectedContractDigest = "378c767c7977c850140ffb19d69db41da62d0187c37a33828d6cda8803a61c83";
|
|
27
31
|
// Comment repair ran the whole ApiComponent and Orchestration tiers under this contract.
|
|
28
|
-
// Story branches cut before the affected-tests contract still carry it.
|
|
29
32
|
const wholeTierCommentRepairContractDigest = "024de3648c907db9c0eab13def9a4f91e81148433e0a2ba7f44776446421054a";
|
|
30
33
|
// Contracts that declare the comment-repair-dotnet-regression check.
|
|
31
34
|
const commentRepairRegressionContractDigests = new Set([
|
|
32
35
|
currentApprovedContractDigest,
|
|
36
|
+
commentRepairOnlyAffectedContractDigest,
|
|
33
37
|
wholeTierCommentRepairContractDigest,
|
|
34
38
|
]);
|
|
35
39
|
const compatibleApprovedContractDigests = new Set([
|
|
40
|
+
commentRepairOnlyAffectedContractDigest,
|
|
36
41
|
wholeTierCommentRepairContractDigest,
|
|
37
42
|
// Preserve dispatches pinned before comment repair gained all .NET regression tiers.
|
|
38
43
|
"c0014ce6abc0e0b2e66dd2bcf6cb14c47d28506444c73f87d1b76b3d1c06027b",
|
|
@@ -139,7 +144,7 @@ export class PrePublicationValidator {
|
|
|
139
144
|
capabilities,
|
|
140
145
|
emit,
|
|
141
146
|
signal,
|
|
142
|
-
execution: scoped.execution,
|
|
147
|
+
execution: withValidationBaseRevision(scoped.execution),
|
|
143
148
|
postgresAdminConnection: scoped.postgresAdminConnection,
|
|
144
149
|
};
|
|
145
150
|
return await this.runChecks(applicableChecks(contract, profile, changedPaths), run, pass);
|
|
@@ -353,10 +358,24 @@ export class PrePublicationValidator {
|
|
|
353
358
|
if (!approvedContractDigests.has(baselineDigest)) {
|
|
354
359
|
throw new ForgeFailureError("prepublication_contract_invalid", `prepublication_contract_invalid: the dispatch baseline uses unapproved CI parity contract ${baselineDigest}.`, "bridge");
|
|
355
360
|
}
|
|
356
|
-
|
|
361
|
+
// A conflict repair's uncommitted merge brings the target branch's contract with it.
|
|
362
|
+
if (baselineDigest !== contractDigest && await this.mergedInContractDigest(worktreePath, signal, execution) !== contractDigest) {
|
|
357
363
|
throw new ForgeFailureError("prepublication_contract_invalid", `prepublication_contract_invalid: the CI parity contract changed after dispatch (baseline ${baselineDigest}, worktree ${contractDigest}).`, "bridge");
|
|
358
364
|
}
|
|
359
365
|
}
|
|
366
|
+
/** The approved contract of the branch an in-progress merge brings in (MERGE_HEAD), else null. */
|
|
367
|
+
async mergedInContractDigest(worktreePath, signal, execution) {
|
|
368
|
+
const merged = await this.runCommand("git", ["show", `MERGE_HEAD:${contractRelativePath}`], worktreePath, signal, execution);
|
|
369
|
+
if (merged.exitCode !== 0)
|
|
370
|
+
return null;
|
|
371
|
+
try {
|
|
372
|
+
const digest = validationContractDigest(JSON.parse(merged.stdout ?? ""));
|
|
373
|
+
return approvedContractDigests.has(digest) ? digest : null;
|
|
374
|
+
}
|
|
375
|
+
catch {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
360
379
|
async runStep(checkId, step, cwd, signal, execution, postgresAdminConnection, emit) {
|
|
361
380
|
const invocation = managedAttemptInvocation(checkId, step, execution?.environment);
|
|
362
381
|
// Every launch, including confirmation reruns, is admitted by the host load governor first.
|
|
@@ -626,6 +645,13 @@ export async function loadValidationContract(worktreePath) {
|
|
|
626
645
|
}
|
|
627
646
|
return contract;
|
|
628
647
|
}
|
|
648
|
+
/** The affected .NET tests measure the attempt's change against its dispatch baseline (run-affected-dotnet-tests.mjs). */
|
|
649
|
+
function withValidationBaseRevision(execution) {
|
|
650
|
+
const baseline = execution?.baselineRevision?.trim();
|
|
651
|
+
if (!baseline)
|
|
652
|
+
return execution;
|
|
653
|
+
return { ...execution, environment: { ...execution?.environment, FORGE_VALIDATION_BASE_REVISION: baseline } };
|
|
654
|
+
}
|
|
629
655
|
function validationContractDigest(contract) {
|
|
630
656
|
return createHash("sha256")
|
|
631
657
|
.update(JSON.stringify(canonicalizeJson(contract)))
|
|
@@ -179,9 +179,10 @@ function responseError(request, response) {
|
|
|
179
179
|
return new ForgeFailureError(response.code ?? "host_capacity_broker_failed", message, "bridge");
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
|
-
* The bridge's reply, or null while there is none
|
|
183
|
-
*
|
|
184
|
-
* bridge's: the sandbox user can
|
|
182
|
+
* The bridge's reply, or null while there is none (or the one opened was just
|
|
183
|
+
* replaced by a newer reply). Only a regular file with a single link, owned by the
|
|
184
|
+
* trusted uid and writable by no one else, is the bridge's: the sandbox user can
|
|
185
|
+
* create none of those (see host-capacity-broker.ts).
|
|
185
186
|
* Anything else fails closed with sandbox_host_capacity_reply_untrusted.
|
|
186
187
|
*/
|
|
187
188
|
async function readResponse(responsePath, requestId, trustedOwnerUid) {
|
|
@@ -197,6 +198,12 @@ async function readResponse(responsePath, requestId, trustedOwnerUid) {
|
|
|
197
198
|
let content;
|
|
198
199
|
try {
|
|
199
200
|
const stat = await handle.stat();
|
|
201
|
+
// No link left: the bridge renamed a newer reply over this one after it was opened
|
|
202
|
+
// (waiting -> admitted, admitted -> fenced). It is not a forgery, and nothing is read
|
|
203
|
+
// from it; the next poll opens the newer reply. Only the bridge can replace a reply,
|
|
204
|
+
// since the directory is root-owned and not writable by the sandbox user.
|
|
205
|
+
if (stat.isFile() && stat.nlink === 0)
|
|
206
|
+
return null;
|
|
200
207
|
if (!stat.isFile() || stat.nlink !== 1)
|
|
201
208
|
throw untrustedReply(responsePath, "it is not a regular file with a single link");
|
|
202
209
|
if (stat.uid !== trustedOwnerUid)
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export declare const forgeBridgeVersion = "0.1.4-dev.81e48ecc185d";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export const forgeBridgeVersion = "0.1.4-dev.81e48ecc185d";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loucompanion/forge-bridge",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.81e48ecc185d",
|
|
4
4
|
"description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|