feat: execute WP7-02 independent model matrices
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 54s

This commit is contained in:
suyx
2026-08-04 16:01:31 +08:00
parent c2f89453a2
commit 470d243b5b
11 changed files with 811 additions and 142 deletions
+8 -10
View File
@@ -1,5 +1,4 @@
import { createHash } from "node:crypto";
import { spawnSync } from "node:child_process";
import { mkdirSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
@@ -201,21 +200,20 @@ export function validateIndependentEvidenceSet(evidence) {
if (JSON.stringify(ids) !== JSON.stringify([...WP7_02_MODEL_IDS].toSorted())) throw new Error("WP7_02_MODEL_EVIDENCE_SET_INVALID");
if (new Set(evidence.map((entry) => entry.evidence_id)).size !== evidence.length) throw new Error("WP7_02_SHARED_EVIDENCE_FORBIDDEN");
for (const entry of evidence) {
if (entry.matrix?.model_id !== entry.model_id || entry.status !== "externally_blocked"
|| entry.external_calls?.real_calls !== 0 || /\"verified\"\s*:/i.test(JSON.stringify(entry))) {
const blocked = entry.status === "externally_blocked"
&& Number.isSafeInteger(entry.external_calls?.real_calls) && entry.external_calls.real_calls >= 0
&& entry.manual_review?.status === "blocked";
const passed = entry.status === "passed" && entry.matrix?.status === "passed"
&& entry.external_calls?.status === "passed" && entry.external_calls.real_calls > 0
&& entry.manual_review?.status === "passed" && entry.redaction?.status === "passed";
if (entry.matrix?.model_id !== entry.model_id || (!blocked && !passed)
|| /\"verified\"\s*:/i.test(JSON.stringify(entry))) {
throw new Error("WP7_02_BLOCKED_EVIDENCE_INVALID");
}
}
return evidence;
}
export function probeAiGatewayCredentialTargets() {
if (process.platform !== "win32") return [];
const result = spawnSync("cmdkey.exe", ["/list"], { encoding: "utf8", windowsHide: true });
if ((result.status ?? 1) !== 0) throw new Error("WP7_02_CREDENTIAL_TARGET_PROBE_FAILED");
return result.stdout.includes(AI_GATEWAY_CREDENTIAL_TARGET) ? [AI_GATEWAY_CREDENTIAL_TARGET] : [];
}
export function writeBlockedModelEvidence(directory, evidence) {
mkdirSync(resolve(directory), { recursive: true });
const files = {