@loucompanion/forge-bridge 0.1.4-dev.fb770705136a → 0.2.1-dev.0f8fb73715e8
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 +183 -4
- package/dist/bridge/bridge-chat-giphy-look.d.ts +48 -0
- package/dist/bridge/bridge-chat-giphy-look.js +55 -0
- package/dist/bridge/bridge-chat-provider-command.d.ts +40 -0
- package/dist/bridge/bridge-chat-provider-command.js +230 -0
- package/dist/bridge/bridge-chat.types.d.ts +20 -0
- package/dist/bridge/bridge-chat.types.js +28 -1
- package/dist/bridge/bridge-state-file.d.ts +161 -0
- package/dist/bridge/bridge-state-file.js +376 -0
- package/dist/bridge/bridge-state-io.d.ts +15 -0
- package/dist/bridge/bridge-state-io.js +68 -0
- package/dist/bridge/bridge-state-lock.d.ts +11 -0
- package/dist/bridge/bridge-state-lock.js +102 -0
- package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
- package/dist/bridge/bridge-state-unpublished.js +111 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +102 -14
- package/dist/bridge/bridge.service.js +499 -471
- package/dist/bridge/bridge.types.d.ts +37 -0
- package/dist/bridge/bridge.types.js +2 -1
- package/dist/bridge/default-session-service.d.ts +13 -0
- package/dist/bridge/default-session-service.js +22 -0
- package/dist/bridge/dispatch-offer-policy.d.ts +22 -0
- package/dist/bridge/dispatch-offer-policy.js +58 -0
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/readiness-result-outbox.d.ts +5 -1
- package/dist/bridge/readiness-result-outbox.js +20 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +31 -1
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/bridge/windows-bash-resolution.d.ts +31 -0
- package/dist/bridge/windows-bash-resolution.js +153 -0
- package/dist/cleanup/cleanup-wip.d.ts +12 -0
- package/dist/cleanup/cleanup-wip.js +66 -0
- package/dist/cleanup/cleanup.service.d.ts +20 -1
- package/dist/cleanup/cleanup.service.js +150 -169
- package/dist/cleanup/cleanup.types.d.ts +6 -0
- package/dist/cleanup/forge-owned-paths.d.ts +11 -0
- package/dist/cleanup/forge-owned-paths.js +62 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
- package/dist/cleanup/host-runtime-ledger.js +130 -0
- package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
- package/dist/cleanup/managed-branch-sweep.js +111 -0
- package/dist/cli/cli.help.js +75 -13
- package/dist/cli/cli.service.d.ts +19 -10
- package/dist/cli/cli.service.js +161 -228
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +18 -1
- package/dist/cli/local-config.js +67 -5
- package/dist/cli/provider-cli-advertising.d.ts +24 -0
- package/dist/cli/provider-cli-advertising.js +88 -0
- package/dist/cli/provider-cli-detection.d.ts +10 -0
- package/dist/cli/provider-cli-detection.js +160 -0
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +36 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +169 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
- package/dist/runtime/attempt-process-supervisor.js +12 -6
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -0
- package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
- package/dist/runtime/dotnet-build-outputs.js +402 -0
- package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
- package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
- package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
- package/dist/runtime/ephemeral-test-postgres.js +303 -0
- package/dist/runtime/host-facts.d.ts +2 -1
- package/dist/runtime/host-listener-inspector.d.ts +26 -0
- package/dist/runtime/host-listener-inspector.js +84 -3
- package/dist/runtime/host-load-admission.d.ts +72 -0
- package/dist/runtime/host-load-admission.js +99 -0
- package/dist/runtime/host-load-capacity.d.ts +198 -0
- package/dist/runtime/host-load-capacity.js +353 -0
- package/dist/runtime/host-load-child-environment.d.ts +40 -0
- package/dist/runtime/host-load-child-environment.js +110 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
- package/dist/runtime/host-load-forge-cgroups.js +140 -0
- package/dist/runtime/host-load-governor-config.d.ts +82 -0
- package/dist/runtime/host-load-governor-config.js +104 -0
- package/dist/runtime/host-load-governor.d.ts +273 -0
- package/dist/runtime/host-load-governor.js +831 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +187 -0
- package/dist/runtime/host-load-live-test-slots.d.ts +61 -0
- package/dist/runtime/host-load-live-test-slots.js +193 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +80 -0
- package/dist/runtime/host-load-sampler.d.ts +92 -2
- package/dist/runtime/host-load-sampler.js +166 -8
- package/dist/runtime/host-load-step-class.d.ts +70 -0
- package/dist/runtime/host-load-step-class.js +161 -0
- package/dist/runtime/host-load-step-reaper.d.ts +27 -0
- package/dist/runtime/host-load-step-reaper.js +95 -0
- package/dist/runtime/host-load-step-run.d.ts +107 -0
- package/dist/runtime/host-load-step-run.js +158 -0
- package/dist/runtime/host-load-test-slot.d.ts +46 -0
- package/dist/runtime/host-load-test-slot.js +100 -0
- package/dist/runtime/host-load-token-ledger.d.ts +200 -0
- package/dist/runtime/host-load-token-ledger.js +453 -0
- 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-pressure-stall.d.ts +21 -1
- package/dist/runtime/host-pressure-stall.js +48 -1
- package/dist/runtime/host-runtime-contract.d.ts +15 -0
- package/dist/runtime/host-runtime-contract.js +39 -6
- package/dist/runtime/host-runtime-lease.d.ts +101 -6
- package/dist/runtime/host-runtime-lease.js +408 -294
- package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
- package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
- package/dist/runtime/host-runtime-promotion.d.ts +101 -2
- package/dist/runtime/host-runtime-promotion.js +355 -14
- 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.js +5 -16
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
- package/dist/runtime/prepared-runtime-identity.d.ts +4 -0
- package/dist/runtime/prepared-runtime-identity.js +130 -9
- package/dist/runtime/prepared-runtime-readiness.d.ts +23 -1
- package/dist/runtime/prepared-runtime-readiness.js +89 -18
- package/dist/runtime/runner-settings.d.ts +104 -0
- package/dist/runtime/runner-settings.js +236 -0
- package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
- package/dist/runtime/supervised-runtime-build-guard.js +112 -0
- package/dist/sandbox/host-capacity-broker.d.ts +115 -0
- package/dist/sandbox/host-capacity-broker.js +336 -0
- package/dist/sandbox/managed-branch.d.ts +13 -0
- package/dist/sandbox/managed-branch.js +90 -0
- package/dist/sandbox/provider-auth/codex.js +11 -11
- package/dist/sandbox/runtime.d.ts +11 -3
- package/dist/sandbox/runtime.js +53 -20
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/sandbox/sandbox-input.d.ts +22 -0
- package/dist/sandbox/sandbox-input.js +49 -0
- package/dist/sandbox/workspace.service.js +15 -2
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.d.ts +2 -7
- package/dist/session/managed-attempt-tools.js +204 -141
- package/dist/session/managed-build-coordinator.d.ts +16 -0
- package/dist/session/managed-build-coordinator.js +10 -0
- package/dist/session/managed-build-receipt.d.ts +7 -0
- package/dist/session/managed-build-receipt.js +11 -3
- package/dist/session/managed-command-environment.d.ts +8 -0
- package/dist/session/managed-command-environment.js +28 -0
- package/dist/session/managed-command-host-load.d.ts +52 -0
- package/dist/session/managed-command-host-load.js +87 -0
- package/dist/session/mcp-argument-coercion.d.ts +23 -0
- package/dist/session/mcp-argument-coercion.js +121 -0
- package/dist/session/phase-completion.artifact-bundle.d.ts +20 -0
- package/dist/session/phase-completion.artifact-bundle.js +167 -0
- package/dist/session/phase-completion.artifacts.d.ts +9 -17
- package/dist/session/phase-completion.artifacts.js +158 -190
- package/dist/session/phase-completion.command-validation.d.ts +7 -0
- package/dist/session/phase-completion.command-validation.js +77 -0
- package/dist/session/phase-completion.d.ts +31 -2
- package/dist/session/phase-completion.helpers.js +18 -65
- package/dist/session/phase-completion.js +19 -32
- package/dist/session/phase-completion.mcp-args.d.ts +9 -0
- package/dist/session/phase-completion.mcp-args.js +195 -0
- package/dist/session/phase-completion.phase-aliases.d.ts +5 -0
- package/dist/session/phase-completion.phase-aliases.js +43 -0
- package/dist/session/phase-completion.pr-review-schema.d.ts +1 -0
- package/dist/session/phase-completion.pr-review-schema.js +75 -0
- package/dist/session/phase-completion.pr-review-validation.d.ts +11 -0
- package/dist/session/phase-completion.pr-review-validation.js +212 -0
- package/dist/session/phase-completion.pr-review.d.ts +36 -0
- package/dist/session/phase-completion.pr-review.js +294 -0
- package/dist/session/phase-completion.prompts.d.ts +1 -1
- package/dist/session/phase-completion.prompts.js +20 -1
- package/dist/session/phase-completion.runtime.d.ts +13 -12
- package/dist/session/phase-completion.runtime.js +113 -214
- package/dist/session/phase-completion.schema-parts.d.ts +19 -0
- package/dist/session/phase-completion.schema-parts.js +188 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -3
- package/dist/session/phase-completion.schemas.js +219 -232
- package/dist/session/phase-completion.validation.d.ts +3 -3
- package/dist/session/phase-completion.validation.js +58 -94
- package/dist/session/pr-review-diff-base.d.ts +18 -0
- package/dist/session/pr-review-diff-base.js +44 -0
- package/dist/session/pr-review-placement.d.ts +50 -0
- package/dist/session/pr-review-placement.js +91 -0
- package/dist/session/pre-publication-change-set.d.ts +62 -0
- package/dist/session/pre-publication-change-set.js +166 -0
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +112 -0
- package/dist/session/pre-publication-native-postgres.d.ts +30 -0
- package/dist/session/pre-publication-native-postgres.js +111 -0
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-process.d.ts +3 -0
- package/dist/session/pre-publication-process.js +32 -19
- package/dist/session/pre-publication-step-execution.d.ts +12 -0
- package/dist/session/pre-publication-step-execution.js +50 -0
- package/dist/session/pre-publication-validation.d.ts +39 -22
- package/dist/session/pre-publication-validation.js +241 -207
- package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
- package/dist/session/provider-cli/claude-background-work.js +181 -0
- package/dist/session/provider-cli/dispatch-target-branch.d.ts +7 -0
- package/dist/session/provider-cli/dispatch-target-branch.js +8 -0
- package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
- package/dist/session/provider-cli/host-build-lock.js +30 -0
- package/dist/session/provider-cli/pr-review-credential-isolation.d.ts +83 -0
- package/dist/session/provider-cli/pr-review-credential-isolation.js +144 -0
- package/dist/session/provider-cli/pr-review-guardrails.d.ts +70 -0
- package/dist/session/provider-cli/pr-review-guardrails.js +360 -0
- package/dist/session/provider-cli/pr-review-prompt.d.ts +2 -0
- package/dist/session/provider-cli/pr-review-prompt.js +119 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
- package/dist/session/provider-cli/pre-publication-repair.js +281 -0
- package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +75 -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.deterministic.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.deterministic.js +5 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +6 -3
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +29 -10
- package/dist/session/provider-cli/provider-cli.pr-review.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.pr-review.js +213 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
- package/dist/session/provider-cli/provider-cli.process.js +41 -432
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +15 -3
- package/dist/session/provider-cli/provider-cli.prompts.js +183 -90
- package/dist/session/provider-cli/provider-cli.reapply-conflicts.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.reapply-conflicts.js +37 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +15 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +43 -1
- package/dist/session/provider-cli/provider-cli.service-support.d.ts +37 -0
- package/dist/session/provider-cli/provider-cli.service-support.js +146 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +18 -18
- package/dist/session/provider-cli/provider-cli.service.js +127 -317
- package/dist/session/provider-cli/provider-cli.types.d.ts +35 -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-cli.windows-launch.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -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/provider-cli/provider-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
- package/dist/session/qa-sidecar-validation.d.ts +6 -0
- package/dist/session/qa-sidecar-validation.js +28 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
- package/dist/session/sandbox-host-capacity-gate.js +279 -0
- package/dist/session/session-host-project.d.ts +22 -0
- package/dist/session/session-host-project.js +98 -0
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.parse-helpers.d.ts +10 -0
- package/dist/session/session.parse-helpers.js +84 -0
- package/dist/session/session.runtime-refresh.d.ts +46 -0
- package/dist/session/session.runtime-refresh.js +116 -0
- package/dist/session/session.service.d.ts +16 -2
- package/dist/session/session.service.js +208 -155
- package/dist/session/session.types.d.ts +8 -0
- package/dist/session/session.types.js +13 -83
- package/dist/session/session.types.pr-review.d.ts +48 -0
- package/dist/session/session.types.pr-review.js +51 -0
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/fs/file-identity.d.ts +10 -0
- package/dist/shared/fs/file-identity.js +15 -0
- package/dist/shared/fs/replace-file.d.ts +7 -0
- package/dist/shared/fs/replace-file.js +33 -0
- package/dist/shared/process/host-process-recovery.d.ts +14 -3
- package/dist/shared/process/host-process-recovery.js +23 -3
- package/dist/shared/process/host-process-supervisor.d.ts +14 -1
- package/dist/shared/process/host-process-supervisor.js +67 -15
- package/dist/shared/process/process-tree.d.ts +52 -0
- package/dist/shared/process/process-tree.js +144 -0
- package/dist/shared/process/process.d.ts +67 -0
- package/dist/shared/process/process.js +213 -11
- 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.d.ts +2 -0
- package/dist/shared/provider-capabilities.js +23 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.js +24 -0
- package/dist/worktree/dependency-warmer.d.ts +25 -0
- package/dist/worktree/dependency-warmer.js +46 -10
- package/dist/worktree/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +58 -0
- package/dist/worktree/wip-git.js +182 -0
- package/dist/worktree/wip-refs.d.ts +85 -0
- package/dist/worktree/wip-refs.js +169 -0
- package/dist/worktree/wip-restore.d.ts +51 -0
- package/dist/worktree/wip-restore.js +324 -0
- package/dist/worktree/wip-snapshot.d.ts +53 -0
- package/dist/worktree/wip-snapshot.js +270 -0
- package/dist/worktree/worktree-inputs.d.ts +8 -0
- package/dist/worktree/worktree-inputs.js +134 -0
- package/dist/worktree/worktree-origin-sync.d.ts +35 -0
- package/dist/worktree/worktree-origin-sync.js +128 -0
- package/dist/worktree/worktree-wip-events.d.ts +20 -0
- package/dist/worktree/worktree-wip-events.js +148 -0
- package/dist/worktree/worktree-wip.d.ts +57 -0
- package/dist/worktree/worktree-wip.js +200 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +58 -5
- package/dist/worktree/worktree.service.js +237 -161
- package/dist/worktree/worktree.types.d.ts +54 -0
- package/package.json +2 -2
- package/runtime/windows-listener-owner.ps1 +12 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type CompletionPhase, type DebugCompletionPhase, type QaCompletionGate } from "./phase-completion.js";
|
|
2
|
+
export { validateQaGatePassingCommands } from "./phase-completion.command-validation.js";
|
|
3
|
+
export { validatePrReviewPayloadShape } from "./phase-completion.pr-review-validation.js";
|
|
4
|
+
export declare const qaEvidenceGates: ReadonlySet<QaCompletionGate>;
|
|
2
5
|
export declare function normalizeCompletionStatus(value: string, phase?: CompletionPhase): string;
|
|
3
6
|
export declare function normalizeQaGateStatus(value: string): string;
|
|
4
7
|
export declare function validatePayloadShape(phase: CompletionPhase, payload: Record<string, unknown>): void;
|
|
@@ -6,9 +9,6 @@ export declare function validateCommentRepairPayloadShape(payload: Record<string
|
|
|
6
9
|
export declare function validateCiRepairPayloadShape(payload: Record<string, unknown>): void;
|
|
7
10
|
export declare function validateDebugPayloadShape(phase: DebugCompletionPhase, payload: Record<string, unknown>): void;
|
|
8
11
|
export declare function validateQaGatePayloadShape(gate: QaCompletionGate, payload: Record<string, unknown>, status: string): void;
|
|
9
|
-
export declare function validateQaGatePassingCommands(commands: readonly unknown[], options?: {
|
|
10
|
-
readonly allowClassifiedNonBlockingFailures?: boolean;
|
|
11
|
-
}): void;
|
|
12
12
|
export declare function validateArchitectPayloadShape(payload: Record<string, unknown>, status: string): void;
|
|
13
13
|
export declare function validateArchitectTaskDevelopScope(task: Record<string, unknown>, taskId: string): void;
|
|
14
14
|
export declare function validateArchitectVerificationScope(task: Record<string, unknown>, taskId: string): void;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { qaBlockerReasons, qaCandidateBugActions, qaFindingScopes, qaFindingSeverities, qaGateToolNames, qaScopeAuthorities, qaScopeCapabilities, qaScopeConfidence, qaScopeEvidence, qaScopeFields, qaScopeSources, qaScopeSurfaces } from "./phase-completion.js";
|
|
1
|
+
import { qaBlockerReasons, qaCandidateBugActions, qaFindingScopes, qaFindingSeverities, qaGateToolNames, qaScopeAuthorities, qaScopeCapabilities, qaScopeConfidence, qaScopeEvidence, qaScopeFields, qaScopeSources, qaScopeSurfaces, prReviewStatuses } from "./phase-completion.js";
|
|
2
|
+
import { structuredTypeHint } from "./mcp-argument-coercion.js";
|
|
3
|
+
import { validateArchitectWaits } from "./architect-waits.js";
|
|
4
|
+
import { validateQaGatePassingCommands } from "./phase-completion.command-validation.js";
|
|
5
|
+
export { validateQaGatePassingCommands } from "./phase-completion.command-validation.js";
|
|
6
|
+
export { validatePrReviewPayloadShape } from "./phase-completion.pr-review-validation.js";
|
|
7
|
+
export const qaEvidenceGates = new Set(["qa_regression", "qa_api", "qa_manual_web", "qa_bug_repro"]);
|
|
2
8
|
export function normalizeCompletionStatus(value, phase) {
|
|
3
9
|
const normalized = value.trim().toLowerCase().replace(/-/g, "_");
|
|
4
10
|
if (phase === "qa") {
|
|
@@ -8,6 +14,13 @@ export function normalizeCompletionStatus(value, phase) {
|
|
|
8
14
|
}
|
|
9
15
|
return canonical;
|
|
10
16
|
}
|
|
17
|
+
if (phase === "pr_review") {
|
|
18
|
+
const canonical = normalized === "stalehead" ? "stale_head" : normalized;
|
|
19
|
+
if (!prReviewStatuses.includes(canonical)) {
|
|
20
|
+
throw new Error(`pr_review status must be one of ${prReviewStatuses.join(", ")}.`);
|
|
21
|
+
}
|
|
22
|
+
return canonical;
|
|
23
|
+
}
|
|
11
24
|
if (phase === "architect") {
|
|
12
25
|
const canonical = normalized === "needsrevision" ? "needs_revision" : normalized;
|
|
13
26
|
if (canonical !== "pass" && canonical !== "needs_revision" && canonical !== "blocked") {
|
|
@@ -157,11 +170,11 @@ export function validateCommentRepairPayloadShape(payload) {
|
|
|
157
170
|
requireNonEmptyStringRecord(record, "summary", `changed_files[${index}].`);
|
|
158
171
|
}
|
|
159
172
|
if (hasFixed && arrayLength(payload, "changed_files") === 0) {
|
|
160
|
-
throw new Error("
|
|
173
|
+
throw new Error("changed_files must include at least one entry when any disposition is fixed.");
|
|
161
174
|
}
|
|
162
175
|
if (arrayLength(payload, "changed_files") > 0) {
|
|
163
176
|
requireNonEmptyArray(payload, "validation");
|
|
164
|
-
validateQaGatePassingCommands(payload.validation);
|
|
177
|
+
validateQaGatePassingCommands(payload.validation, { label: "validation", context: "status is pass" });
|
|
165
178
|
}
|
|
166
179
|
}
|
|
167
180
|
export function validateCiRepairPayloadShape(payload) {
|
|
@@ -196,7 +209,7 @@ export function validateCiRepairPayloadShape(payload) {
|
|
|
196
209
|
for (const key of ["narrow_validation", "broader_validation"]) {
|
|
197
210
|
requireArray(payload, key);
|
|
198
211
|
requireNonEmptyArray(payload, key);
|
|
199
|
-
validateQaGatePassingCommands(payload[key]);
|
|
212
|
+
validateQaGatePassingCommands(payload[key], { label: key, context: "status is pass" });
|
|
200
213
|
}
|
|
201
214
|
requireArray(payload, "workflow_validation");
|
|
202
215
|
requireNonEmptyArray(payload, "workflow_validation");
|
|
@@ -276,6 +289,34 @@ export function validateDebugPayloadShape(phase, payload) {
|
|
|
276
289
|
requireNonEmptyArray(payload, "required_regressions");
|
|
277
290
|
requirePassingCommands(payload);
|
|
278
291
|
}
|
|
292
|
+
// Shared by the QA evidence gates and the final verdict: gate evidence is inherited into the
|
|
293
|
+
// verdict, so a gate must reject what the verdict would reject.
|
|
294
|
+
function validateQaBrowserCheckEntries(browserChecks, status) {
|
|
295
|
+
for (const [index, browserCheck] of browserChecks.entries()) {
|
|
296
|
+
requireEvidenceRecord(browserCheck, `browser_checks[${index}]`);
|
|
297
|
+
const record = browserCheck;
|
|
298
|
+
requireNonEmptyStringRecord(record, "summary", `browser_checks[${index}].`);
|
|
299
|
+
requireNonEmptyStringRecord(record, "status", `browser_checks[${index}].`);
|
|
300
|
+
const checkStatus = optionalString(record, "status");
|
|
301
|
+
if (status === "pass" && checkStatus && normalizedString(checkStatus) !== "pass") {
|
|
302
|
+
throw new Error(`browser_checks[${index}].status must be pass when QA status is pass.`);
|
|
303
|
+
}
|
|
304
|
+
if (!optionalString(record, "url") && !optionalString(record, "route")) {
|
|
305
|
+
throw new Error(`browser_checks[${index}].url is required unless browser_checks[${index}].route is given.`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function validateQaSidecarEntries(sidecars) {
|
|
310
|
+
for (const [index, sidecar] of sidecars.entries()) {
|
|
311
|
+
requireEvidenceRecord(sidecar, `sidecars[${index}]`);
|
|
312
|
+
const record = sidecar;
|
|
313
|
+
requireNonEmptyStringRecord(record, "path", `sidecars[${index}].`);
|
|
314
|
+
requireNonEmptyStringRecord(record, "content_hash", `sidecars[${index}].`);
|
|
315
|
+
if (typeof record.bytes !== "number" || !Number.isFinite(record.bytes) || record.bytes <= 0) {
|
|
316
|
+
throw new Error(`sidecars[${index}].bytes must be greater than 0.`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
279
320
|
export function validateQaGatePayloadShape(gate, payload, status) {
|
|
280
321
|
requireField(payload, "summary");
|
|
281
322
|
if (status === "skipped") {
|
|
@@ -293,6 +334,12 @@ export function validateQaGatePayloadShape(gate, payload, status) {
|
|
|
293
334
|
throw new Error("complete_qa_plan pass requires checklist with at least one entry.");
|
|
294
335
|
}
|
|
295
336
|
}
|
|
337
|
+
if (qaEvidenceGates.has(gate)) {
|
|
338
|
+
// Every evidence gate's sidecars are merged into the final verdict, so a
|
|
339
|
+
// malformed value must be rejected here, not when the verdict is assembled.
|
|
340
|
+
validateQaSidecarEntries(qaArray(payload, "sidecars", qaEvidenceSource(payload)));
|
|
341
|
+
validateQaBrowserCheckEntries(qaArray(payload, "browser_checks"), status);
|
|
342
|
+
}
|
|
296
343
|
if (gate === "qa_findings" && status !== "blocked") {
|
|
297
344
|
qaObjectArray(payload, "findings");
|
|
298
345
|
qaObjectArray(payload, "candidate_bugs");
|
|
@@ -314,71 +361,8 @@ export function validateQaGatePayloadShape(gate, payload, status) {
|
|
|
314
361
|
}
|
|
315
362
|
}
|
|
316
363
|
}
|
|
317
|
-
export function validateQaGatePassingCommands(commands, options = {}) {
|
|
318
|
-
const issues = [];
|
|
319
|
-
for (const [index, command] of commands.entries()) {
|
|
320
|
-
if (!command || typeof command !== "object" || Array.isArray(command)) {
|
|
321
|
-
issues.push(`commands[${index}] must be an object.`);
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
const record = command;
|
|
325
|
-
if (!optionalString(record, "command"))
|
|
326
|
-
issues.push(`commands[${index}].command is required.`);
|
|
327
|
-
if (!optionalString(record, "status"))
|
|
328
|
-
issues.push(`commands[${index}].status is required.`);
|
|
329
|
-
if (!optionalString(record, "summary"))
|
|
330
|
-
issues.push(`commands[${index}].summary is required.`);
|
|
331
|
-
if (typeof record.exit_code !== "number" || !Number.isFinite(record.exit_code)) {
|
|
332
|
-
issues.push(`commands[${index}].exit_code is required.`);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
const passed = record.exit_code === 0 && normalizedString(record.status) === "pass";
|
|
336
|
-
if (!passed
|
|
337
|
-
&& options.allowClassifiedNonBlockingFailures
|
|
338
|
-
&& optionalString(record, "classification")) {
|
|
339
|
-
try {
|
|
340
|
-
validateClassifiedNonBlockingQaFailure(record, index);
|
|
341
|
-
}
|
|
342
|
-
catch (error) {
|
|
343
|
-
issues.push(error instanceof Error ? error.message : String(error));
|
|
344
|
-
}
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
if (record.exit_code !== 0) {
|
|
348
|
-
issues.push(`commands[${index}].exit_code must be 0 when QA gate status is pass.`);
|
|
349
|
-
}
|
|
350
|
-
if (normalizedString(record.status) !== "pass") {
|
|
351
|
-
issues.push(`commands[${index}].status must be pass when QA gate status is pass.`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
throwCompletionPayloadIssues(issues);
|
|
355
|
-
}
|
|
356
|
-
function validateClassifiedNonBlockingQaFailure(record, index) {
|
|
357
|
-
const classification = normalizedString(optionalString(record, "classification"));
|
|
358
|
-
if (classification !== "out_of_scope_failure" && classification !== "baseline_failure") {
|
|
359
|
-
throw new Error(`commands[${index}] is non-passing; QA regression pass requires classification out_of_scope_failure or baseline_failure with corroborating evidence.`);
|
|
360
|
-
}
|
|
361
|
-
requireNonEmptyStringRecord(record, "candidate_bug_id", `commands[${index}].`);
|
|
362
|
-
requireNonEmptyStringRecord(record, "scope_evidence", `commands[${index}].`);
|
|
363
|
-
if (record.acceptance_criteria_independent !== true) {
|
|
364
|
-
throw new Error(`commands[${index}].acceptance_criteria_independent must be true for a non-blocking QA regression failure.`);
|
|
365
|
-
}
|
|
366
|
-
if (classification === "out_of_scope_failure") {
|
|
367
|
-
requireNonEmptyStringRecord(record, "repro_command", `commands[${index}].`);
|
|
368
|
-
if (typeof record.repro_exit_code !== "number" || !Number.isFinite(record.repro_exit_code) || record.repro_exit_code === 0) {
|
|
369
|
-
throw new Error(`commands[${index}].repro_exit_code must be a non-zero number for an out-of-scope failure.`);
|
|
370
|
-
}
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
requireNonEmptyStringRecord(record, "baseline_ref", `commands[${index}].`);
|
|
374
|
-
if (typeof record.baseline_exit_code !== "number" || !Number.isFinite(record.baseline_exit_code) || record.baseline_exit_code === 0) {
|
|
375
|
-
throw new Error(`commands[${index}].baseline_exit_code must be a non-zero number for a baseline failure.`);
|
|
376
|
-
}
|
|
377
|
-
if (record.failure_signature_match !== true) {
|
|
378
|
-
throw new Error(`commands[${index}].failure_signature_match must be true for a baseline failure.`);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
364
|
export function validateArchitectPayloadShape(payload, status) {
|
|
365
|
+
validateArchitectWaits(payload, status);
|
|
382
366
|
if (status !== "pass") {
|
|
383
367
|
requireArchitectNonPassEvidence(payload);
|
|
384
368
|
return;
|
|
@@ -732,7 +716,7 @@ export function hasArchitectDependencyCycle(edges) {
|
|
|
732
716
|
return false;
|
|
733
717
|
}
|
|
734
718
|
export function requireArchitectNonPassEvidence(payload) {
|
|
735
|
-
const evidenceKeys = ["blockers", "revision_questions", "revision_reasons", "known_gaps", "findings", "remaining_risks", "failures"];
|
|
719
|
+
const evidenceKeys = ["blockers", "revision_questions", "revision_reasons", "waits_on", "owner_decision", "known_gaps", "findings", "remaining_risks", "failures"];
|
|
736
720
|
const hasEvidence = evidenceKeys.some((key) => {
|
|
737
721
|
const value = payload[key];
|
|
738
722
|
if (typeof value === "string") {
|
|
@@ -794,13 +778,13 @@ export function validateQaPayloadShape(payload, status) {
|
|
|
794
778
|
throw new Error("QA pass/needs_rework requires tested_acceptance_criteria with at least one criterion.");
|
|
795
779
|
}
|
|
796
780
|
if (commands.length === 0 && browserChecks.length === 0 && notes.length === 0) {
|
|
797
|
-
throw new Error("QA pass/needs_rework requires at least one
|
|
781
|
+
throw new Error("QA pass/needs_rework requires at least one entry in commands or browser_checks, or a non-empty notes string.");
|
|
798
782
|
}
|
|
799
783
|
}
|
|
800
784
|
const commandIssues = [];
|
|
801
785
|
for (const [index, command] of commands.entries()) {
|
|
802
786
|
if (!command || typeof command !== "object" || Array.isArray(command)) {
|
|
803
|
-
commandIssues.push(`commands[${index}] must be an object.`);
|
|
787
|
+
commandIssues.push(`commands[${index}] must be an object${structuredTypeHint(command, "object")}.`);
|
|
804
788
|
continue;
|
|
805
789
|
}
|
|
806
790
|
const record = command;
|
|
@@ -821,28 +805,8 @@ export function validateQaPayloadShape(payload, status) {
|
|
|
821
805
|
}
|
|
822
806
|
}
|
|
823
807
|
throwCompletionPayloadIssues(commandIssues);
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
const record = browserCheck;
|
|
827
|
-
requireNonEmptyStringRecord(record, "summary", `browser_checks[${index}].`);
|
|
828
|
-
requireNonEmptyStringRecord(record, "status", `browser_checks[${index}].`);
|
|
829
|
-
const checkStatus = optionalString(record, "status");
|
|
830
|
-
if (status === "pass" && checkStatus && normalizedString(checkStatus) !== "pass") {
|
|
831
|
-
throw new Error(`browser_checks[${index}].status must be pass when QA status is pass.`);
|
|
832
|
-
}
|
|
833
|
-
if (!optionalString(record, "url") && !optionalString(record, "route")) {
|
|
834
|
-
throw new Error(`browser_checks[${index}] must include url or route.`);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
for (const [index, sidecar] of sidecars.entries()) {
|
|
838
|
-
requireEvidenceRecord(sidecar, `sidecars[${index}]`);
|
|
839
|
-
const record = sidecar;
|
|
840
|
-
requireNonEmptyStringRecord(record, "path", `sidecars[${index}].`);
|
|
841
|
-
requireNonEmptyStringRecord(record, "content_hash", `sidecars[${index}].`);
|
|
842
|
-
if (typeof record.bytes !== "number" || !Number.isFinite(record.bytes) || record.bytes <= 0) {
|
|
843
|
-
throw new Error(`sidecars[${index}].bytes must be greater than 0.`);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
808
|
+
validateQaBrowserCheckEntries(browserChecks, status);
|
|
809
|
+
validateQaSidecarEntries(sidecars);
|
|
846
810
|
for (const [index, finding] of findings.entries()) {
|
|
847
811
|
requireNonEmptyStringRecord(finding, "id", `findings[${index}].`);
|
|
848
812
|
requireNonEmptyStringRecord(finding, "title", `findings[${index}].`);
|
|
@@ -884,7 +848,7 @@ export function validateQaPayloadShape(payload, status) {
|
|
|
884
848
|
}
|
|
885
849
|
if (status === "needs_rework") {
|
|
886
850
|
if (inScopeFindingIds.length === 0) {
|
|
887
|
-
throw new Error("QA needs_rework requires at least one actionable in-scope finding.");
|
|
851
|
+
throw new Error("QA needs_rework requires at least one actionable in-scope finding: add an entry to findings with scope: in_scope.");
|
|
888
852
|
}
|
|
889
853
|
if (optionalString(payload, "blocker_reason")) {
|
|
890
854
|
throw new Error("QA needs_rework must not include blocker_reason.");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RunOnceDispatchPacket } from "./session.types.js";
|
|
2
|
+
/** Runs git in the review's repository: resolves with stdout, rejects when git fails. */
|
|
3
|
+
export type ReviewDiffBaseGit = (args: readonly string[]) => Promise<string>;
|
|
4
|
+
/**
|
|
5
|
+
* The commit a Forge PR review diffs against: the merge base of the dispatched base and the head, the
|
|
6
|
+
* same `base...head` diff the pull request shows. The provider's base (GitHub's `base.sha`) is the base
|
|
7
|
+
* branch tip at the pull request's last sync, which is not an ancestor of the head once the base moves
|
|
8
|
+
* on and the branch has not merged it; a Docker sandbox imports only the head's ancestry, so that tip
|
|
9
|
+
* is not there, but the merge base always is. Resolved with the bridge's own git, fetching the base by
|
|
10
|
+
* its SHA when the checkout lacks it and falling back to the base branch on origin when the base commit
|
|
11
|
+
* is gone. Null when the dispatch is not a review or no base can be found: the dispatch is then unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveReviewDiffBase(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "prReview" | "pullRequest">, git: ReviewDiffBaseGit): Promise<string | null>;
|
|
14
|
+
/**
|
|
15
|
+
* The dispatch with its review base set to the diff base, keeping the base tip it replaced, so the prompt,
|
|
16
|
+
* the completion tool's anchor check and the recorded review all use one commit that is in the worktree.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withReviewDiffBase(dispatch: RunOnceDispatchPacket, diffBase: string | null): RunOnceDispatchPacket;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { prReviewDispatchHeadSha } from "./pr-review-placement.js";
|
|
2
|
+
const fullObjectId = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
|
|
3
|
+
/**
|
|
4
|
+
* The commit a Forge PR review diffs against: the merge base of the dispatched base and the head, the
|
|
5
|
+
* same `base...head` diff the pull request shows. The provider's base (GitHub's `base.sha`) is the base
|
|
6
|
+
* branch tip at the pull request's last sync, which is not an ancestor of the head once the base moves
|
|
7
|
+
* on and the branch has not merged it; a Docker sandbox imports only the head's ancestry, so that tip
|
|
8
|
+
* is not there, but the merge base always is. Resolved with the bridge's own git, fetching the base by
|
|
9
|
+
* its SHA when the checkout lacks it and falling back to the base branch on origin when the base commit
|
|
10
|
+
* is gone. Null when the dispatch is not a review or no base can be found: the dispatch is then unchanged.
|
|
11
|
+
*/
|
|
12
|
+
export async function resolveReviewDiffBase(dispatch, git) {
|
|
13
|
+
const headSha = prReviewDispatchHeadSha(dispatch);
|
|
14
|
+
const baseSha = (dispatch.prReview?.baseSha ?? "").trim().toLowerCase();
|
|
15
|
+
if (!headSha || !baseSha) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const commit = async (rev) => {
|
|
19
|
+
const sha = (await git(["rev-parse", "--verify", "--quiet", `${rev}^{commit}`]).catch(() => "")).trim().toLowerCase();
|
|
20
|
+
return fullObjectId.test(sha) ? sha : null;
|
|
21
|
+
};
|
|
22
|
+
let base = await commit(baseSha);
|
|
23
|
+
if (!base) {
|
|
24
|
+
await git(["fetch", "--no-tags", "--no-write-fetch-head", "origin", baseSha]).catch(() => undefined);
|
|
25
|
+
const baseBranch = (dispatch.prReview?.baseBranch || dispatch.cycleRun.baseBranch || "").trim();
|
|
26
|
+
base = await commit(baseSha) ?? (baseBranch ? await commit(`refs/remotes/origin/${baseBranch}`) : null);
|
|
27
|
+
}
|
|
28
|
+
if (!base) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const mergeBase = (await git(["merge-base", base, headSha]).catch(() => "")).trim().toLowerCase();
|
|
32
|
+
return fullObjectId.test(mergeBase) ? mergeBase : null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The dispatch with its review base set to the diff base, keeping the base tip it replaced, so the prompt,
|
|
36
|
+
* the completion tool's anchor check and the recorded review all use one commit that is in the worktree.
|
|
37
|
+
*/
|
|
38
|
+
export function withReviewDiffBase(dispatch, diffBase) {
|
|
39
|
+
const prReview = dispatch.prReview;
|
|
40
|
+
if (!diffBase || !prReview || prReview.baseSha.trim().toLowerCase() === diffBase) {
|
|
41
|
+
return dispatch;
|
|
42
|
+
}
|
|
43
|
+
return { ...dispatch, prReview: { ...prReview, baseSha: diffBase, baseTipSha: prReview.baseTipSha || prReview.baseSha } };
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type RunnerDispatchEvent, type RunOnceDispatchPacket, type RunOnceResultPacket } from "./session.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where a Forge PR review may run. A review reads pull request code an author controls, and the only
|
|
4
|
+
* operating-system isolation this bridge enforces is its Docker sandbox: a container with no git
|
|
5
|
+
* credential, no remote and no host home directory. On a plain host the provider runs as the
|
|
6
|
+
* bridge's user, beside that user's git credentials and provider sign-in, and the review guardrails
|
|
7
|
+
* (credential-free git environment, tool deny rules, command shims, the post-run ref and remote-head
|
|
8
|
+
* checks) are defence in depth, not a boundary. So a review placed on the host is refused before any
|
|
9
|
+
* provider starts unless the runner's owner opted in with `allowUnsandboxedPrReview: true` in
|
|
10
|
+
* bridge.json, accepting that risk.
|
|
11
|
+
*/
|
|
12
|
+
export declare const prReviewUnsandboxedHostCode = "pr_review.unsandboxed_host";
|
|
13
|
+
/**
|
|
14
|
+
* A review placed in this bridge's Docker sandbox for a project whose sandbox contract it cannot read or build:
|
|
15
|
+
* refused before any provider starts, and never retried on this runner (a capacity wait would only expire).
|
|
16
|
+
*/
|
|
17
|
+
export declare const prReviewSandboxUnavailableCode = "pr_review.sandbox_unavailable";
|
|
18
|
+
/** The execution facility a runner advertises when its owner opted in to host-placed reviews. */
|
|
19
|
+
export declare const prReviewUnsandboxedHostFacility = "pr_review_unsandboxed_host";
|
|
20
|
+
/** The warning a host-placed review carries when the runner's owner opted in. */
|
|
21
|
+
export declare const prReviewUnsandboxedHostWarningEvent = "pr_review_unsandboxed_host_warning";
|
|
22
|
+
/** A dispatch for the review-only pr_review session, by role, lane or cycle kind. */
|
|
23
|
+
export declare function isPrReviewDispatch(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun">): boolean;
|
|
24
|
+
/** The pull request head a review dispatch reads, lowercased, or null for any other dispatch. */
|
|
25
|
+
export declare function prReviewDispatchHeadSha(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "prReview" | "pullRequest">): string | null;
|
|
26
|
+
/** Why this bridge refuses the dispatch, or null: a review placed outside Docker without the opt-in. */
|
|
27
|
+
export declare function prReviewPlacementRefusal(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "sandbox">, allowUnsandboxedPrReview: boolean | undefined): string | null;
|
|
28
|
+
/** The warning for a review that runs on the host because the runner's owner opted in, or null. */
|
|
29
|
+
export declare function prReviewUnsandboxedHostWarning(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "sandbox">, allowUnsandboxedPrReview: boolean | undefined): string | null;
|
|
30
|
+
/** The terminal failure for a refused review (see {@link prReviewPlacementRefusal}), or null. */
|
|
31
|
+
export declare function prReviewPlacementRefusalResult(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "sandbox">, allowUnsandboxedPrReview: boolean | undefined): RunOnceResultPacket | null;
|
|
32
|
+
/**
|
|
33
|
+
* Set by the server-local runner on a run-once whose Forge PR review it admitted on its host (in its container
|
|
34
|
+
* sandbox, or because the runner opted in to host reviews). Nothing else sets it.
|
|
35
|
+
*/
|
|
36
|
+
export declare const prReviewHostAdmittedEnv = "FORGE_PR_REVIEW_HOST_ADMITTED";
|
|
37
|
+
/**
|
|
38
|
+
* forge-bridge run-once (which the server-local runner launches): a Forge PR review placed outside Docker runs
|
|
39
|
+
* only when the server-local runner admitted it on this host; any other is refused before a provider starts.
|
|
40
|
+
*/
|
|
41
|
+
export declare function runOnceWithReviewPlacement(dispatch: RunOnceDispatchPacket, run: (dispatch: RunOnceDispatchPacket) => Promise<RunOnceResultPacket>, env?: NodeJS.ProcessEnv): Promise<RunOnceResultPacket>;
|
|
42
|
+
/** The execution facilities that tell Forge this runner's owner opted in to host-placed reviews. */
|
|
43
|
+
export declare function prReviewExecutionFacilities(allowUnsandboxedPrReview: boolean | undefined): readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Runs the dispatch; a review that runs on the host by the owner's opt-in is logged, announced as a
|
|
46
|
+
* session event and reported in the result summary as a warning.
|
|
47
|
+
*/
|
|
48
|
+
export declare function runWithUnsandboxedReviewWarning(dispatch: Pick<RunOnceDispatchPacket, "execution" | "cycleRun" | "sandbox">, allowUnsandboxedPrReview: boolean | undefined, sink: {
|
|
49
|
+
emit(event: RunnerDispatchEvent): Promise<void>;
|
|
50
|
+
}, log: (message: string) => void, run: () => Promise<RunOnceResultPacket>): Promise<RunOnceResultPacket>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { failureFactsForCode, failureResult, } from "./session.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Where a Forge PR review may run. A review reads pull request code an author controls, and the only
|
|
4
|
+
* operating-system isolation this bridge enforces is its Docker sandbox: a container with no git
|
|
5
|
+
* credential, no remote and no host home directory. On a plain host the provider runs as the
|
|
6
|
+
* bridge's user, beside that user's git credentials and provider sign-in, and the review guardrails
|
|
7
|
+
* (credential-free git environment, tool deny rules, command shims, the post-run ref and remote-head
|
|
8
|
+
* checks) are defence in depth, not a boundary. So a review placed on the host is refused before any
|
|
9
|
+
* provider starts unless the runner's owner opted in with `allowUnsandboxedPrReview: true` in
|
|
10
|
+
* bridge.json, accepting that risk.
|
|
11
|
+
*/
|
|
12
|
+
export const prReviewUnsandboxedHostCode = "pr_review.unsandboxed_host";
|
|
13
|
+
/**
|
|
14
|
+
* A review placed in this bridge's Docker sandbox for a project whose sandbox contract it cannot read or build:
|
|
15
|
+
* refused before any provider starts, and never retried on this runner (a capacity wait would only expire).
|
|
16
|
+
*/
|
|
17
|
+
export const prReviewSandboxUnavailableCode = "pr_review.sandbox_unavailable";
|
|
18
|
+
/** The execution facility a runner advertises when its owner opted in to host-placed reviews. */
|
|
19
|
+
export const prReviewUnsandboxedHostFacility = "pr_review_unsandboxed_host";
|
|
20
|
+
/** The warning a host-placed review carries when the runner's owner opted in. */
|
|
21
|
+
export const prReviewUnsandboxedHostWarningEvent = "pr_review_unsandboxed_host_warning";
|
|
22
|
+
/** A dispatch for the review-only pr_review session, by role, lane or cycle kind. */
|
|
23
|
+
export function isPrReviewDispatch(dispatch) {
|
|
24
|
+
return [dispatch.execution.role, dispatch.execution.lane, dispatch.cycleRun.kind]
|
|
25
|
+
.some((value) => (value ?? "").trim().toLowerCase() === "pr_review");
|
|
26
|
+
}
|
|
27
|
+
/** The pull request head a review dispatch reads, lowercased, or null for any other dispatch. */
|
|
28
|
+
export function prReviewDispatchHeadSha(dispatch) {
|
|
29
|
+
if (!isPrReviewDispatch(dispatch)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (dispatch.prReview?.headSha || dispatch.pullRequest?.headSha || "").trim().toLowerCase() || null;
|
|
33
|
+
}
|
|
34
|
+
function placedInDocker(dispatch) {
|
|
35
|
+
return dispatch.sandbox?.executionMode === "docker";
|
|
36
|
+
}
|
|
37
|
+
/** Why this bridge refuses the dispatch, or null: a review placed outside Docker without the opt-in. */
|
|
38
|
+
export function prReviewPlacementRefusal(dispatch, allowUnsandboxedPrReview) {
|
|
39
|
+
if (!isPrReviewDispatch(dispatch) || placedInDocker(dispatch) || allowUnsandboxedPrReview === true) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return `${prReviewUnsandboxedHostCode}: this Forge PR review was placed on the bridge host, where the provider would read `
|
|
43
|
+
+ "author-controlled pull request code with the bridge user's credentials in reach. This bridge runs reviews only in its "
|
|
44
|
+
+ "Docker sandbox. Its owner can accept the risk with \"allowUnsandboxedPrReview\": true in bridge.json.";
|
|
45
|
+
}
|
|
46
|
+
/** The warning for a review that runs on the host because the runner's owner opted in, or null. */
|
|
47
|
+
export function prReviewUnsandboxedHostWarning(dispatch, allowUnsandboxedPrReview) {
|
|
48
|
+
if (!isPrReviewDispatch(dispatch) || placedInDocker(dispatch) || allowUnsandboxedPrReview !== true) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return "Warning: this Forge PR review ran on the bridge host without OS-level isolation, because the runner's owner set "
|
|
52
|
+
+ "\"allowUnsandboxedPrReview\": true in bridge.json. The provider read author-controlled code with the bridge user's "
|
|
53
|
+
+ "credentials in reach; only Forge's review guardrails stood between them.";
|
|
54
|
+
}
|
|
55
|
+
/** The terminal failure for a refused review (see {@link prReviewPlacementRefusal}), or null. */
|
|
56
|
+
export function prReviewPlacementRefusalResult(dispatch, allowUnsandboxedPrReview) {
|
|
57
|
+
const refusal = prReviewPlacementRefusal(dispatch, allowUnsandboxedPrReview);
|
|
58
|
+
return refusal
|
|
59
|
+
? failureResult(refusal, [{ role: "runner", kind: "error", content: refusal, eventType: prReviewUnsandboxedHostCode }], failureFactsForCode(prReviewUnsandboxedHostCode))
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Set by the server-local runner on a run-once whose Forge PR review it admitted on its host (in its container
|
|
64
|
+
* sandbox, or because the runner opted in to host reviews). Nothing else sets it.
|
|
65
|
+
*/
|
|
66
|
+
export const prReviewHostAdmittedEnv = "FORGE_PR_REVIEW_HOST_ADMITTED";
|
|
67
|
+
/**
|
|
68
|
+
* forge-bridge run-once (which the server-local runner launches): a Forge PR review placed outside Docker runs
|
|
69
|
+
* only when the server-local runner admitted it on this host; any other is refused before a provider starts.
|
|
70
|
+
*/
|
|
71
|
+
export async function runOnceWithReviewPlacement(dispatch, run, env = process.env) {
|
|
72
|
+
return prReviewPlacementRefusalResult(dispatch, env[prReviewHostAdmittedEnv] === "1") ?? await run(dispatch);
|
|
73
|
+
}
|
|
74
|
+
/** The execution facilities that tell Forge this runner's owner opted in to host-placed reviews. */
|
|
75
|
+
export function prReviewExecutionFacilities(allowUnsandboxedPrReview) {
|
|
76
|
+
return allowUnsandboxedPrReview === true ? [prReviewUnsandboxedHostFacility] : [];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Runs the dispatch; a review that runs on the host by the owner's opt-in is logged, announced as a
|
|
80
|
+
* session event and reported in the result summary as a warning.
|
|
81
|
+
*/
|
|
82
|
+
export async function runWithUnsandboxedReviewWarning(dispatch, allowUnsandboxedPrReview, sink, log, run) {
|
|
83
|
+
const warning = prReviewUnsandboxedHostWarning(dispatch, allowUnsandboxedPrReview);
|
|
84
|
+
if (!warning) {
|
|
85
|
+
return await run();
|
|
86
|
+
}
|
|
87
|
+
log(warning);
|
|
88
|
+
await sink.emit({ role: "runner", kind: "checkpoint", content: warning, eventType: prReviewUnsandboxedHostWarningEvent });
|
|
89
|
+
const result = await run();
|
|
90
|
+
return { ...result, summary: `${result.summary} ${warning}` };
|
|
91
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type RunnerDispatchEvent } from "./session.types.js";
|
|
2
|
+
export { findUnreferencedNewExports } from "./unreferenced-exports.js";
|
|
3
|
+
export type ChangeSetGit = (args: readonly string[]) => Promise<{
|
|
4
|
+
exitCode: number;
|
|
5
|
+
stdout?: string;
|
|
6
|
+
stderr?: string;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Git reads history as it was committed. The agent could otherwise plant a replace ref
|
|
10
|
+
* (`git replace <target tip> <fake>`) or a graft that rewrites what the merge parent's tree is and
|
|
11
|
+
* whose ancestor it is. The bridge's own git calls in the pass, and the affected .NET run that measures
|
|
12
|
+
* against these revisions, run with it (the sandbox import does the same, sandbox/runtime.ts). Other
|
|
13
|
+
* check steps do not: their suites may make replace refs or grafts of their own in throwaway repos. An empty graft file is no grafts; /dev/null is one on every
|
|
14
|
+
* platform Git runs on (Git for Windows maps it to NUL), and nothing can be written into it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const historyIntegrityEnvironment: Readonly<Record<string, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* The pass's change set: the verified merge parent it measures against (null when the attempt makes no
|
|
19
|
+
* merge, or merges something its target branch's CI did not validate), and the changed paths that select
|
|
20
|
+
* its checks. Emits whether and how a merge scoped the pass.
|
|
21
|
+
*/
|
|
22
|
+
export declare function passChangeSet(git: ChangeSetGit, execution: {
|
|
23
|
+
readonly baselineRevision?: string;
|
|
24
|
+
readonly targetBranch?: string;
|
|
25
|
+
} | undefined, emit?: (event: RunnerDispatchEvent) => Promise<void>): Promise<{
|
|
26
|
+
readonly mergeParent: string | null;
|
|
27
|
+
readonly changedPaths: readonly string[];
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* The other parent of a merge the attempt makes: MERGE_HEAD while a merge is in progress, or the second
|
|
31
|
+
* parent of a merge commit HEAD made since the dispatch baseline. Null when the attempt makes no merge,
|
|
32
|
+
* including a merge commit that was already HEAD at dispatch.
|
|
33
|
+
*/
|
|
34
|
+
export declare function attemptMergeParent(git: ChangeSetGit, baselineRevision: string | undefined): Promise<string | null>;
|
|
35
|
+
/** A merge parent the pass may scope to, or why it may not. */
|
|
36
|
+
export type MergeScope = {
|
|
37
|
+
readonly mergeParent: string;
|
|
38
|
+
readonly targetRef: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly mergeParent: null;
|
|
41
|
+
readonly unscopedReason: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Scopes the pass to a merge parent only when the target branch's CI validated it: the parent is the
|
|
45
|
+
* target's tip on origin, or an ancestor of it. The agent controls the merge and every local ref (it can
|
|
46
|
+
* rewrite refs/remotes/origin/<target>, which a host worktree shares with the main repository), so the
|
|
47
|
+
* bridge fetches the target into a ref of its own for this pass and deletes it afterwards. A parent
|
|
48
|
+
* anywhere else (a scratch branch holding the attempt's own work), or a fetch that fails (a Docker
|
|
49
|
+
* sandbox workspace has no origin), scopes nothing.
|
|
50
|
+
*/
|
|
51
|
+
export declare function verifiedMergeScope(git: ChangeSetGit, mergeParent: string, targetBranch: string | undefined, validationRef?: string): Promise<MergeScope>;
|
|
52
|
+
/**
|
|
53
|
+
* The paths the attempt changed: uncommitted, committed since the baseline, and untracked. With a
|
|
54
|
+
* verified merge parent, what the merged head changes over that parent, and the untracked paths.
|
|
55
|
+
*/
|
|
56
|
+
export declare function changedPathInventory(git: ChangeSetGit, baselineRevision: string | undefined, mergeParent: string | null): Promise<readonly string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* The step environment the affected .NET tests read (scripts/run-affected-dotnet-tests.mjs): the dispatch
|
|
59
|
+
* baseline, and the verified merge parent they measure against instead when there is one. The validator
|
|
60
|
+
* adds historyIntegrityEnvironment to that check's steps only.
|
|
61
|
+
*/
|
|
62
|
+
export declare function validationRevisionEnvironment(baselineRevision: string | undefined, mergeParent: string | null): Readonly<Record<string, string>>;
|