Files
PaperClipAI/tests/runner-e2e/prerequisites.ts
T
DottaandPaperclip a6a5417cd9 test(runner-e2e): qualify Stop at pending native permission
Add explicit Cursor and Copilot local/Daytona cells that retain an unanswered callback before a caller-correlated Stop, require cancelled provider settlement and stale-answer rejection, and independently verify no effects through owned retirement. Normal completion and provider death do not satisfy this active-work oracle.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-30 14:42:10 -05:00

44 lines
2.1 KiB
TypeScript

import type { MatrixExecution } from "./types.js";
/** Explicit-only profiles blocked until complete identity/auth/session/billing qualification. */
export const PENDING_PROFILE_PREREQUISITES = {
"legacy-kimi-cli": "Kimi CLI identity/auth/skills/session/billing qualification is pending",
"legacy-kimi-acp": "Kimi ACP identity/auth/skills/session/billing qualification is pending",
"legacy-grok": "Grok identity/auth/skills/session/billing qualification is pending",
} as const;
/** Pi is intentionally absent: no qualified model source exists for a valid profile. */
export const UNQUALIFIED_PROFILE_GAPS = {
pi: "Pi has no qualified model source, so no valid Product E2E profile is registered.",
} as const;
/** Reject missing remote observer authority before creating a company or run. */
export function assertRemoteNativeEvidencePrerequisites(
executions: readonly MatrixExecution[],
environment: NodeJS.ProcessEnv,
): void {
if (!executions.some(execution => execution.environment.id === "daytona"
&& ["cursor_native", "pi_native", "copilot_protection", "native_active_stop"].includes(execution.task.flow))) return;
const names = ["PAPERCLIP_E2E_DAYTONA_NODE_SHA256", "PAPERCLIP_E2E_DAYTONA_RUNNERD_SHA256"];
const invalid = names.filter(name => !/^sha256:[a-f0-9]{64}$/u.test(environment[name] ?? ""));
if (invalid.length) throw new Error(`Native Daytona evidence requires exact image executable digests: ${invalid.join(", ")}`);
}
export function assertRunnerE2EPrerequisites(
executions: readonly MatrixExecution[],
): void {
const blocked = [...new Set(
executions
.map((execution) => execution.profile.id)
.filter((profileId): profileId is keyof typeof PENDING_PROFILE_PREREQUISITES =>
profileId in PENDING_PROFILE_PREREQUISITES,
),
)];
if (blocked.length === 0) return;
throw new Error(
`Selected runner E2E profile prerequisite(s) are pending: ${blocked
.map((profileId) => `${profileId} (${PENDING_PROFILE_PREREQUISITES[profileId]})`)
.join("; ")}. No provider credentials were loaded or sent.`,
);
}