@loucompanion/forge-bridge 0.1.4-dev.e83e5bc6ecce → 0.1.4-dev.f22f5e3d01fe
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 +55 -0
- package/dist/bridge/bridge-chat-provider-command.d.ts +16 -0
- package/dist/bridge/bridge-chat-provider-command.js +125 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +71 -2
- package/dist/bridge/bridge.service.js +282 -114
- package/dist/bridge/bridge.types.d.ts +11 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/runner-host-capabilities.d.ts +3 -0
- package/dist/bridge/runner-host-capabilities.js +13 -0
- package/dist/cli/cli.help.js +18 -0
- package/dist/cli/cli.service.d.ts +16 -0
- package/dist/cli/cli.service.js +132 -14
- package/dist/cli/local-config.d.ts +4 -0
- package/dist/cli/local-config.js +26 -4
- package/dist/runtime/aspnet-runtime-prebuild.js +94 -6
- package/dist/runtime/host-facts.d.ts +2 -1
- package/dist/runtime/host-load-admission.d.ts +18 -3
- package/dist/runtime/host-load-admission.js +19 -4
- package/dist/runtime/host-load-child-environment.d.ts +11 -6
- package/dist/runtime/host-load-child-environment.js +22 -11
- package/dist/runtime/host-load-governor-config.d.ts +19 -1
- package/dist/runtime/host-load-governor-config.js +37 -0
- package/dist/runtime/host-load-governor.d.ts +12 -0
- package/dist/runtime/host-load-governor.js +139 -26
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +78 -0
- package/dist/runtime/host-load-sampler.d.ts +26 -3
- package/dist/runtime/host-load-sampler.js +61 -2
- package/dist/runtime/host-load-step-class.d.ts +3 -1
- package/dist/runtime/host-load-step-class.js +60 -5
- package/dist/runtime/host-load-test-slot.d.ts +43 -0
- package/dist/runtime/host-load-test-slot.js +81 -0
- package/dist/runtime/host-load-token-ledger.d.ts +26 -0
- package/dist/runtime/host-load-token-ledger.js +93 -61
- package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
- package/dist/runtime/host-load-windows-cpu.js +85 -0
- package/dist/runtime/host-runtime-lease.d.ts +59 -3
- package/dist/runtime/host-runtime-lease.js +199 -8
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +36 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
- package/dist/runtime/runner-settings.d.ts +100 -0
- package/dist/runtime/runner-settings.js +214 -0
- package/dist/sandbox/host-capacity-broker.d.ts +7 -1
- package/dist/sandbox/host-capacity-broker.js +23 -4
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.js +8 -9
- package/dist/session/managed-command-host-load.d.ts +2 -0
- package/dist/session/managed-command-host-load.js +2 -1
- package/dist/session/phase-completion.schemas.js +25 -23
- package/dist/session/phase-completion.validation.js +3 -1
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-validation.d.ts +23 -11
- package/dist/session/pre-publication-validation.js +178 -107
- package/dist/session/provider-cli/claude-background-work.d.ts +66 -0
- package/dist/session/provider-cli/claude-background-work.js +180 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +40 -0
- package/dist/session/provider-cli/pre-publication-repair.js +243 -0
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +73 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +13 -22
- package/dist/session/provider-cli/provider-cli.process.js +36 -337
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +2 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +49 -9
- package/dist/session/provider-cli/provider-cli.runtime.js +7 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +4 -1
- package/dist/session/provider-cli/provider-cli.service.js +74 -151
- package/dist/session/provider-cli/provider-cli.types.d.ts +26 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
- package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
- package/dist/session/provider-cli/provider-output-pipes.js +67 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +6 -0
- package/dist/session/sandbox-host-capacity-gate.js +12 -3
- package/dist/session/session.base.d.ts +6 -1
- package/dist/session/session.service.d.ts +7 -2
- package/dist/session/session.service.js +100 -2
- package/dist/session/session.types.js +3 -3
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
- package/dist/shared/process/windows-app-execution-alias.js +45 -0
- package/dist/shared/process/windows-launch.d.ts +18 -0
- package/dist/shared/process/windows-launch.js +68 -0
- package/dist/shared/provider-capabilities.js +5 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { decomposeGateFileNames, decomposeStatuses, draftStatuses, isDebugCompletionPhase, phaseFiles, qaBlockerReasons, qaGateFileNames } from "./phase-completion.js";
|
|
2
2
|
import { browserCheckSchema, qaSidecarsSchema, qaEvidenceWrapperSchema, qaGateEvidenceWrapperSchema, findingEvidenceSchema, objectToolSchema, evidenceObjectSchema, qaScopeSchema, commandEvidenceSchema, resolvedFindingSchema, acceptanceCriteriaSchema, reviewSectionSchema, reviewSectionProperties } from "./phase-completion.schema-parts.js";
|
|
3
|
+
import { architectNonPassProperties } from "./architect-waits.js";
|
|
3
4
|
export function toolDescription(phase, qaGate = null, decomposeGate = null, draftGate = null) {
|
|
4
5
|
if (qaGate) {
|
|
5
6
|
return qaGate === "qa_verdict"
|
|
@@ -499,17 +500,8 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null, draf
|
|
|
499
500
|
report_markdown: { type: "string", description: "Human-readable Architect report. Use report as an alias only when the client cannot send report_markdown." },
|
|
500
501
|
report: { type: "string", description: "Alias for report_markdown." },
|
|
501
502
|
blockers: baseProperties.blockers,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
description: "Required for needs_revision when blockers are not used.",
|
|
505
|
-
items: { type: "string" }
|
|
506
|
-
},
|
|
507
|
-
revision_reasons: {
|
|
508
|
-
type: "array",
|
|
509
|
-
description: "Concrete reasons that prevent pass status.",
|
|
510
|
-
items: { type: "string" }
|
|
511
|
-
}
|
|
512
|
-
}, ["status", "summary"], "For status pass, include implementation_plan and qa_plan at the top level of the MCP tool arguments, as JSON objects rather than quoted strings. implementation_plan.phases must be a top-level array inside implementation_plan, not nested under another object. For needs_revision or blocked, implementation_plan and qa_plan may be omitted; include blockers, revision_questions, or revision_reasons instead.");
|
|
503
|
+
...architectNonPassProperties()
|
|
504
|
+
}, ["status", "summary"], "For status pass, include implementation_plan and qa_plan at the top level of the MCP tool arguments, as JSON objects rather than quoted strings. implementation_plan.phases must be a top-level array inside implementation_plan, not nested under another object. For needs_revision or blocked, implementation_plan and qa_plan may be omitted; include blockers, revision_questions, or revision_reasons instead. When blocked because another Story or pull request must merge first, also list it in waits_on; when the owner must choose, also set owner_decision.");
|
|
513
505
|
}
|
|
514
506
|
return objectToolSchema({
|
|
515
507
|
...baseProperties,
|
|
@@ -536,6 +528,27 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null, draf
|
|
|
536
528
|
ready_for_dev_test: { type: "boolean", default: true, description: "Required for pass and must be true." }
|
|
537
529
|
}, ["status", "summary"], "For status pass, commands must include at least one passing deterministic command, acceptance criteria entries must use status: satisfied plus evidence, and ready_for_dev_test must be true.");
|
|
538
530
|
}
|
|
531
|
+
// Feature-to-Story candidate fields: schedule order, handoff to dependents, and whether the Story
|
|
532
|
+
// needs a design reference before Forge builds it.
|
|
533
|
+
const storyCandidateScheduleProperties = {
|
|
534
|
+
scheduleIndex: { type: "number", description: "Feature-to-Story total schedule order for dependency-safe execution." },
|
|
535
|
+
schedule_index: { type: "number", description: "Snake_case alias for scheduleIndex." },
|
|
536
|
+
waveIndex: { type: "number", description: "Feature-to-Story parallel wave number." },
|
|
537
|
+
wave_index: { type: "number", description: "Snake_case alias for waveIndex." },
|
|
538
|
+
featureScheduleIndex: { type: "number", description: "Optional ordering within the Feature." },
|
|
539
|
+
feature_schedule_index: { type: "number", description: "Snake_case alias for featureScheduleIndex." },
|
|
540
|
+
expectedOutput: { type: "string", description: "Durable output this Story should produce for dependents." },
|
|
541
|
+
expected_output: { type: "string", description: "Snake_case alias for expectedOutput." },
|
|
542
|
+
handoffSummary: { type: "string", description: "How dependent Stories should consume this Story output." },
|
|
543
|
+
handoff_summary: { type: "string", description: "Snake_case alias for handoffSummary." },
|
|
544
|
+
dependencyReason: { type: "string", description: "Why this Story depends on its dependsOn predecessors." },
|
|
545
|
+
dependency_reason: { type: "string", description: "Snake_case alias for dependencyReason." },
|
|
546
|
+
requiresDesign: {
|
|
547
|
+
type: "boolean",
|
|
548
|
+
description: "Feature-to-Story only. True when the Story adds or changes user-visible UI; Forge holds it until a design reference is attached. False for non-visual Stories."
|
|
549
|
+
},
|
|
550
|
+
requires_design: { type: "boolean", description: "Snake_case alias for requiresDesign." }
|
|
551
|
+
};
|
|
539
552
|
function decomposeGateToolInputSchema(gate, phaseProperties) {
|
|
540
553
|
// Advertise every status the Decompose writer accepts, so the schema and the runtime agree.
|
|
541
554
|
const baseProperties = {
|
|
@@ -572,18 +585,7 @@ function decomposeGateToolInputSchema(gate, phaseProperties) {
|
|
|
572
585
|
acceptanceCriteria: { type: "string" },
|
|
573
586
|
planningPacket: { type: "string" },
|
|
574
587
|
sortOrder: { type: "number" },
|
|
575
|
-
|
|
576
|
-
schedule_index: { type: "number", description: "Snake_case alias for scheduleIndex." },
|
|
577
|
-
waveIndex: { type: "number", description: "Feature-to-Story parallel wave number." },
|
|
578
|
-
wave_index: { type: "number", description: "Snake_case alias for waveIndex." },
|
|
579
|
-
featureScheduleIndex: { type: "number", description: "Optional ordering within the Feature." },
|
|
580
|
-
feature_schedule_index: { type: "number", description: "Snake_case alias for featureScheduleIndex." },
|
|
581
|
-
expectedOutput: { type: "string", description: "Durable output this Story should produce for dependents." },
|
|
582
|
-
expected_output: { type: "string", description: "Snake_case alias for expectedOutput." },
|
|
583
|
-
handoffSummary: { type: "string", description: "How dependent Stories should consume this Story output." },
|
|
584
|
-
handoff_summary: { type: "string", description: "Snake_case alias for handoffSummary." },
|
|
585
|
-
dependencyReason: { type: "string", description: "Why this Story depends on its dependsOn predecessors." },
|
|
586
|
-
dependency_reason: { type: "string", description: "Snake_case alias for dependencyReason." },
|
|
588
|
+
...storyCandidateScheduleProperties,
|
|
587
589
|
points: { type: "number" },
|
|
588
590
|
dependsOn: { type: "array", items: { type: "string" } },
|
|
589
591
|
estimatedQaScope: qaScopeSchema("Work Order-to-Feature planning QA estimate. This is not dispatch-authoritative QA scope."),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { qaBlockerReasons, qaCandidateBugActions, qaFindingScopes, qaFindingSeverities, qaGateToolNames, qaScopeAuthorities, qaScopeCapabilities, qaScopeConfidence, qaScopeEvidence, qaScopeFields, qaScopeSources, qaScopeSurfaces } from "./phase-completion.js";
|
|
2
2
|
import { structuredTypeHint } from "./mcp-argument-coercion.js";
|
|
3
|
+
import { validateArchitectWaits } from "./architect-waits.js";
|
|
3
4
|
import { validateQaGatePassingCommands } from "./phase-completion.command-validation.js";
|
|
4
5
|
export { validateQaGatePassingCommands } from "./phase-completion.command-validation.js";
|
|
5
6
|
export const qaEvidenceGates = new Set(["qa_regression", "qa_api", "qa_manual_web", "qa_bug_repro"]);
|
|
@@ -353,6 +354,7 @@ export function validateQaGatePayloadShape(gate, payload, status) {
|
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
export function validateArchitectPayloadShape(payload, status) {
|
|
357
|
+
validateArchitectWaits(payload, status);
|
|
356
358
|
if (status !== "pass") {
|
|
357
359
|
requireArchitectNonPassEvidence(payload);
|
|
358
360
|
return;
|
|
@@ -706,7 +708,7 @@ export function hasArchitectDependencyCycle(edges) {
|
|
|
706
708
|
return false;
|
|
707
709
|
}
|
|
708
710
|
export function requireArchitectNonPassEvidence(payload) {
|
|
709
|
-
const evidenceKeys = ["blockers", "revision_questions", "revision_reasons", "known_gaps", "findings", "remaining_risks", "failures"];
|
|
711
|
+
const evidenceKeys = ["blockers", "revision_questions", "revision_reasons", "waits_on", "owner_decision", "known_gaps", "findings", "remaining_risks", "failures"];
|
|
710
712
|
const hasEvidence = evidenceKeys.some((key) => {
|
|
711
713
|
const value = payload[key];
|
|
712
714
|
if (typeof value === "string") {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ValidationStep } from "./pre-publication-step-execution.js";
|
|
2
|
+
import { ForgeFailureError, type RunnerDispatchEvent } from "./session.types.js";
|
|
3
|
+
/** The check id a failed restart of the attempt's runtime stack before the pass is reported under. */
|
|
4
|
+
export declare const runtimeRestartCheckId = "host-runtime-restart";
|
|
5
|
+
/** One check that failed in a pass: the step that failed and its clipped diagnostics. */
|
|
6
|
+
export interface PrePublicationCheckFailure {
|
|
7
|
+
readonly checkId: string;
|
|
8
|
+
readonly exitCode: number;
|
|
9
|
+
readonly command: string;
|
|
10
|
+
readonly args: readonly string[];
|
|
11
|
+
readonly detail: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A failed validation pass. The single-check fields name the first failure, as they always have;
|
|
15
|
+
* `failures` lists every check that failed in the pass, in the order the checks ran.
|
|
16
|
+
*/
|
|
17
|
+
export declare class PrePublicationValidationError extends ForgeFailureError {
|
|
18
|
+
readonly checkId: string;
|
|
19
|
+
readonly exitCode: number;
|
|
20
|
+
readonly command: string;
|
|
21
|
+
readonly args: readonly string[];
|
|
22
|
+
readonly detail: string;
|
|
23
|
+
readonly code = "prepublication_validation_failed";
|
|
24
|
+
readonly failures: readonly PrePublicationCheckFailure[];
|
|
25
|
+
constructor(checkId: string, exitCode: number, command: string, args: readonly string[], detail: string, additionalFailures?: readonly PrePublicationCheckFailure[]);
|
|
26
|
+
/** Every failed check's id, first failure first. */
|
|
27
|
+
get checkIds(): readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export declare class PrePublicationPass {
|
|
30
|
+
private readonly runtimeRestartFailure?;
|
|
31
|
+
private readonly failures;
|
|
32
|
+
/** The check whose .NET build failed to compile in this pass, if any. */
|
|
33
|
+
private dotnetCompileFailedIn;
|
|
34
|
+
/** A failed runtime restart before the pass is its first failure. */
|
|
35
|
+
constructor(runtimeRestartFailure?: PrePublicationValidationError | undefined);
|
|
36
|
+
record(failure: PrePublicationCheckFailure, failedStep?: ValidationStep): void;
|
|
37
|
+
/** The failed checks that keep this check from running meaningfully in this pass. */
|
|
38
|
+
blockers(checkId: string): readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether an error ends the pass with the failures it already found. Only a classified retryable
|
|
41
|
+
* failure (a resource hold, lost infrastructure, a supervisor that did not start) does, once the
|
|
42
|
+
* pass has found a failure: the repair turn can fix those failures now, and the next pass meets
|
|
43
|
+
* the condition again. Any other error, or cancellation, still ends the attempt as it did.
|
|
44
|
+
*/
|
|
45
|
+
stopsAt(error: unknown, signal?: AbortSignal): error is ForgeFailureError;
|
|
46
|
+
stoppedEvent(checkId: string, error: ForgeFailureError): RunnerDispatchEvent;
|
|
47
|
+
/** Throws every failure the pass found as one validation failure. */
|
|
48
|
+
throwIfFailed(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare function skippedCheckEvent(checkId: string, blockedBy: readonly string[]): RunnerDispatchEvent;
|
|
51
|
+
/** The tests a check's steps skipped, so a check that passed with skips says so with each reason. */
|
|
52
|
+
export declare class SkippedTestTally {
|
|
53
|
+
private readonly worktreePath;
|
|
54
|
+
private readonly environment?;
|
|
55
|
+
private summary;
|
|
56
|
+
constructor(worktreePath: string, environment?: Readonly<Record<string, string>> | undefined);
|
|
57
|
+
/** The invocation's own arguments: a managed attempt may direct results to its test-output root. */
|
|
58
|
+
add(args: readonly string[], stepStartedMs: number): Promise<void>;
|
|
59
|
+
passedEvent(checkId: string, secrets: readonly string[]): RunnerDispatchEvent;
|
|
60
|
+
}
|
|
61
|
+
export declare function validationEvent(eventType: string, checkId: string, content: string, detail?: Readonly<Record<string, unknown>>): RunnerDispatchEvent;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { redactText } from "../shared/redaction/redaction.js";
|
|
2
|
+
import { describeSkippedTests, mergeSkippedTests, readSkippedTests, } from "./pre-publication-skipped-tests.js";
|
|
3
|
+
import { ForgeFailureError, failureFactsFromError } from "./session.types.js";
|
|
4
|
+
// One pre-publication validation pass. A failed check no longer ends the pass: the remaining checks
|
|
5
|
+
// that can still meaningfully run keep going, so one in-place repair turn sees every independent
|
|
6
|
+
// failure at once instead of one per turn. The pass records each failure, says which checks it
|
|
7
|
+
// could not run because a check they depend on failed, and reports them all as one failure.
|
|
8
|
+
/** The check id a failed restart of the attempt's runtime stack before the pass is reported under. */
|
|
9
|
+
export const runtimeRestartCheckId = "host-runtime-restart";
|
|
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"]);
|
|
13
|
+
// Checks that build the .NET solution themselves and would only repeat the compiler errors once its
|
|
14
|
+
// compile step fails: the OpenAPI export builds Forge.Api and the E2E suite publishes it.
|
|
15
|
+
const dotnetBuildConsumers = new Set(["openapi-and-generated-types", "playwright-e2e"]);
|
|
16
|
+
// Checks that run against the attempt's application stack, which a failed restart left stopped.
|
|
17
|
+
const runtimeStackConsumers = new Set(["playwright-e2e"]);
|
|
18
|
+
// The diagnostics of each further failure that the error message carries; the repair prompt
|
|
19
|
+
// carries every failure's diagnostics in full.
|
|
20
|
+
const additionalFailureMessageDetail = 1500;
|
|
21
|
+
/**
|
|
22
|
+
* A failed validation pass. The single-check fields name the first failure, as they always have;
|
|
23
|
+
* `failures` lists every check that failed in the pass, in the order the checks ran.
|
|
24
|
+
*/
|
|
25
|
+
export class PrePublicationValidationError extends ForgeFailureError {
|
|
26
|
+
checkId;
|
|
27
|
+
exitCode;
|
|
28
|
+
command;
|
|
29
|
+
args;
|
|
30
|
+
detail;
|
|
31
|
+
code = "prepublication_validation_failed";
|
|
32
|
+
failures;
|
|
33
|
+
constructor(checkId, exitCode, command, args, detail, additionalFailures = []) {
|
|
34
|
+
super("prepublication_validation_failed", validationFailureMessage([{ checkId, exitCode, command, args, detail }, ...additionalFailures]), "bridge");
|
|
35
|
+
this.checkId = checkId;
|
|
36
|
+
this.exitCode = exitCode;
|
|
37
|
+
this.command = command;
|
|
38
|
+
this.args = args;
|
|
39
|
+
this.detail = detail;
|
|
40
|
+
this.name = "PrePublicationValidationError";
|
|
41
|
+
this.failures = [{ checkId, exitCode, command, args, detail }, ...additionalFailures];
|
|
42
|
+
}
|
|
43
|
+
/** Every failed check's id, first failure first. */
|
|
44
|
+
get checkIds() {
|
|
45
|
+
return this.failures.map(failure => failure.checkId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function validationFailureMessage(failures) {
|
|
49
|
+
const [first, ...others] = failures;
|
|
50
|
+
const summary = (failure, detail) => `${failure.checkId} exited ${failure.exitCode}${detail ? `: ${detail}` : ""}`;
|
|
51
|
+
if (others.length === 0)
|
|
52
|
+
return `prepublication_validation_failed: ${summary(first, first.detail)}`;
|
|
53
|
+
// The other check ids come before the first detail, so a clipped failure message still names them.
|
|
54
|
+
const also = `[also failed: ${others.map(failure => failure.checkId).join(", ")}]`;
|
|
55
|
+
const more = others.map(failure => summary(failure, clipDetail(failure.detail)));
|
|
56
|
+
return `prepublication_validation_failed: ${first.checkId} exited ${first.exitCode} ${also}${first.detail ? `: ${first.detail}` : ""}`
|
|
57
|
+
+ `\n\nAlso failed in the same validation pass: ${more.join("\n\n")}`;
|
|
58
|
+
}
|
|
59
|
+
function clipDetail(detail) {
|
|
60
|
+
return detail.length <= additionalFailureMessageDetail
|
|
61
|
+
? detail
|
|
62
|
+
: `${detail.slice(0, additionalFailureMessageDetail)}… (clipped)`;
|
|
63
|
+
}
|
|
64
|
+
export class PrePublicationPass {
|
|
65
|
+
runtimeRestartFailure;
|
|
66
|
+
failures = [];
|
|
67
|
+
/** The check whose .NET build failed to compile in this pass, if any. */
|
|
68
|
+
dotnetCompileFailedIn = null;
|
|
69
|
+
/** A failed runtime restart before the pass is its first failure. */
|
|
70
|
+
constructor(runtimeRestartFailure) {
|
|
71
|
+
this.runtimeRestartFailure = runtimeRestartFailure;
|
|
72
|
+
this.failures.push(...runtimeRestartFailure?.failures ?? []);
|
|
73
|
+
}
|
|
74
|
+
record(failure, failedStep) {
|
|
75
|
+
this.failures.push(failure);
|
|
76
|
+
if (dotnetBuildCheckIds.has(failure.checkId) && failedStep?.command === "dotnet" && failedStep.args[0] === "build") {
|
|
77
|
+
this.dotnetCompileFailedIn ??= failure.checkId;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** The failed checks that keep this check from running meaningfully in this pass. */
|
|
81
|
+
blockers(checkId) {
|
|
82
|
+
return [
|
|
83
|
+
...(this.dotnetCompileFailedIn && dotnetBuildConsumers.has(checkId) ? [this.dotnetCompileFailedIn] : []),
|
|
84
|
+
...(this.runtimeRestartFailure && runtimeStackConsumers.has(checkId) ? [runtimeRestartCheckId] : []),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Whether an error ends the pass with the failures it already found. Only a classified retryable
|
|
89
|
+
* failure (a resource hold, lost infrastructure, a supervisor that did not start) does, once the
|
|
90
|
+
* pass has found a failure: the repair turn can fix those failures now, and the next pass meets
|
|
91
|
+
* the condition again. Any other error, or cancellation, still ends the attempt as it did.
|
|
92
|
+
*/
|
|
93
|
+
stopsAt(error, signal) {
|
|
94
|
+
if (this.failures.length === 0 || signal?.aborted || !(error instanceof ForgeFailureError))
|
|
95
|
+
return false;
|
|
96
|
+
return failureFactsFromError(error).retryability === "retryable";
|
|
97
|
+
}
|
|
98
|
+
stoppedEvent(checkId, error) {
|
|
99
|
+
const failedCheckIds = this.failures.map(failure => failure.checkId);
|
|
100
|
+
return validationEvent("prepublication_validation_pass_stopped", checkId, `Stopped this pre-publication pass at '${checkId}' (${error.failureCode}). Reporting the ${failedCheckIds.length} failed check${failedCheckIds.length === 1 ? "" : "s"} it already found (${failedCheckIds.join(", ")}) for repair; the next pass runs '${checkId}' again.`, { failureCode: error.failureCode, failedCheckIds });
|
|
101
|
+
}
|
|
102
|
+
/** Throws every failure the pass found as one validation failure. */
|
|
103
|
+
throwIfFailed() {
|
|
104
|
+
const [first, ...others] = this.failures;
|
|
105
|
+
if (!first)
|
|
106
|
+
return;
|
|
107
|
+
throw new PrePublicationValidationError(first.checkId, first.exitCode, first.command, first.args, first.detail, others);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export function skippedCheckEvent(checkId, blockedBy) {
|
|
111
|
+
const reason = blockedBy.map(blocker => blocker === runtimeRestartCheckId
|
|
112
|
+
? "the attempt's runtime stack, whose restart failed"
|
|
113
|
+
: `the .NET build, which failed in '${blocker}'`).join(" and ");
|
|
114
|
+
return validationEvent("prepublication_validation_skipped", checkId, `Skipped pre-publication CI parity check '${checkId}' in this pass: it needs ${reason}. The next pass runs it again.`, { blockedBy });
|
|
115
|
+
}
|
|
116
|
+
/** The tests a check's steps skipped, so a check that passed with skips says so with each reason. */
|
|
117
|
+
export class SkippedTestTally {
|
|
118
|
+
worktreePath;
|
|
119
|
+
environment;
|
|
120
|
+
summary = { count: 0, reasons: [] };
|
|
121
|
+
constructor(worktreePath, environment) {
|
|
122
|
+
this.worktreePath = worktreePath;
|
|
123
|
+
this.environment = environment;
|
|
124
|
+
}
|
|
125
|
+
/** The invocation's own arguments: a managed attempt may direct results to its test-output root. */
|
|
126
|
+
async add(args, stepStartedMs) {
|
|
127
|
+
this.summary = mergeSkippedTests(this.summary, await readSkippedTests(this.worktreePath, args, stepStartedMs, this.environment));
|
|
128
|
+
}
|
|
129
|
+
passedEvent(checkId, secrets) {
|
|
130
|
+
const skipped = {
|
|
131
|
+
...this.summary,
|
|
132
|
+
reasons: this.summary.reasons.map(entry => ({ ...entry, reason: redactText(entry.reason, secrets) })),
|
|
133
|
+
};
|
|
134
|
+
if (skipped.count === 0) {
|
|
135
|
+
return validationEvent("prepublication_validation_passed", checkId, `Pre-publication CI parity check '${checkId}' passed.`);
|
|
136
|
+
}
|
|
137
|
+
return validationEvent("prepublication_validation_passed", checkId, `Pre-publication CI parity check '${checkId}' passed with ${describeSkippedTests(skipped)}.`, { skippedTests: skipped.count, skippedReasons: skipped.reasons });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export function validationEvent(eventType, checkId, content, detail) {
|
|
141
|
+
return {
|
|
142
|
+
role: "runner",
|
|
143
|
+
kind: "checkpoint",
|
|
144
|
+
content,
|
|
145
|
+
eventType,
|
|
146
|
+
data: JSON.stringify({ checkId, contractId: "forge-ci-parity-v1", ...detail }),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { NativeTestPostgresFallback } from "../runtime/native-test-postgres
|
|
|
3
3
|
import type { HostLoadStepGate } from "../runtime/host-load-governor.js";
|
|
4
4
|
import { type PrePublicationHostLoadOwner } from "./pre-publication-host-load.js";
|
|
5
5
|
import { type ValidationStep } from "./pre-publication-step-execution.js";
|
|
6
|
+
import { PrePublicationValidationError, type PrePublicationCheckFailure } from "./pre-publication-pass.js";
|
|
6
7
|
import type { ProviderProcessRunner } from "./provider-cli/provider-cli.process.js";
|
|
7
8
|
import { ForgeFailureError, type RunnerDispatchEvent } from "./session.types.js";
|
|
8
9
|
export type PrePublicationProfile = "implementation" | "comment_repair" | "ci_repair" | "conflict_repair";
|
|
@@ -34,16 +35,13 @@ export interface PrePublicationExecutionContext {
|
|
|
34
35
|
readonly processRunner?: ProviderProcessRunner;
|
|
35
36
|
/** The attempt governed steps reserve host capacity for (decision 0013). */
|
|
36
37
|
readonly hostLoadOwner?: PrePublicationHostLoadOwner;
|
|
38
|
+
/**
|
|
39
|
+
* The failed restart of the attempt's runtime stack before this pass. The pass reports it with
|
|
40
|
+
* its own failures and does not run the checks that need the stopped stack.
|
|
41
|
+
*/
|
|
42
|
+
readonly runtimeRestartFailure?: PrePublicationValidationError;
|
|
37
43
|
}
|
|
38
|
-
export
|
|
39
|
-
readonly checkId: string;
|
|
40
|
-
readonly exitCode: number;
|
|
41
|
-
readonly command: string;
|
|
42
|
-
readonly args: readonly string[];
|
|
43
|
-
readonly detail: string;
|
|
44
|
-
readonly code = "prepublication_validation_failed";
|
|
45
|
-
constructor(checkId: string, exitCode: number, command: string, args: readonly string[], detail: string);
|
|
46
|
-
}
|
|
44
|
+
export { PrePublicationValidationError, type PrePublicationCheckFailure };
|
|
47
45
|
export declare class PrePublicationInfrastructureError extends ForgeFailureError {
|
|
48
46
|
readonly checkId: string;
|
|
49
47
|
readonly exitCode: number;
|
|
@@ -59,17 +57,31 @@ export declare class PrePublicationValidator {
|
|
|
59
57
|
private readonly nativeTestPostgresFallback;
|
|
60
58
|
private readonly hostLoad?;
|
|
61
59
|
constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null, hostLoad?: HostLoadStepGate | undefined);
|
|
60
|
+
/**
|
|
61
|
+
* Runs one pre-publication pass. A failed check does not end the pass: every remaining check that
|
|
62
|
+
* can still meaningfully run keeps going, and the pass then throws all of its failures as one
|
|
63
|
+
* PrePublicationValidationError.
|
|
64
|
+
*/
|
|
62
65
|
validate(worktreePath: string, profile: PrePublicationProfile, capabilities: ReadonlySet<string>, emit?: (event: RunnerDispatchEvent) => Promise<void>, signal?: AbortSignal, execution?: PrePublicationExecutionContext): Promise<readonly string[]>;
|
|
66
|
+
private runChecks;
|
|
67
|
+
/** Runs one check's steps in order; the first failed step ends the check, since later steps use its output. */
|
|
68
|
+
private runCheck;
|
|
69
|
+
/** Runs a step, confirming once a failure that matches a known transient pattern. */
|
|
70
|
+
private runConfirmedStep;
|
|
71
|
+
private runCheckedStep;
|
|
72
|
+
private confirmStep;
|
|
73
|
+
private confirmInfrastructure;
|
|
63
74
|
/** Returns the native fallback connection when this check must use it instead of Docker. */
|
|
64
75
|
private ensurePrerequisite;
|
|
65
76
|
private throwIfPrerequisiteWasLost;
|
|
66
|
-
private
|
|
77
|
+
private checkTestOnlyExports;
|
|
67
78
|
private changedPaths;
|
|
68
79
|
private assertContractMatchesDispatchBaseline;
|
|
80
|
+
/** The approved contract of the branch an in-progress merge brings in (MERGE_HEAD), else null. */
|
|
81
|
+
private mergedInContractDigest;
|
|
69
82
|
private runStep;
|
|
70
83
|
private launchStep;
|
|
71
84
|
private runCommand;
|
|
72
85
|
}
|
|
73
86
|
export declare function applicableChecks(contract: ValidationContract, profile: PrePublicationProfile | "github_actions", changedPaths: readonly string[]): readonly ValidationCheck[];
|
|
74
87
|
export declare function loadValidationContract(worktreePath: string): Promise<ValidationContract | null>;
|
|
75
|
-
export {};
|