test(wp7-02): require stable Gemini replacement set
Dada P0-A isolated Windows CI / validate-and-package (push) Canceled after 0s

This commit is contained in:
suyx
2026-08-04 18:45:04 +08:00
parent a54efb146a
commit 0328aa8ef5
2 changed files with 23 additions and 33 deletions
@@ -20,19 +20,10 @@ import {
const models = [ const models = [
{ {
config_version: 3, config_version: 7,
model_id: "gemini-3.1-flash-image-preview", model_id: "gemini-3.1-flash-image",
route_profile: { route_profile: {
endpoint: "https://oneapi.intelligrow.cn/v1beta/models/gemini-3.1-flash-image-preview:generateContent", endpoint: "https://oneapi.intelligrow.cn/v1beta/models/gemini-3.1-flash-image:generateContent",
mode: "sync",
protocol_version: "gemini-native-v1beta",
},
},
{
config_version: 3,
model_id: "gemini-3-pro-image-preview",
route_profile: {
endpoint: "https://oneapi.intelligrow.cn/v1beta/models/gemini-3-pro-image-preview:generateContent",
mode: "sync", mode: "sync",
protocol_version: "gemini-native-v1beta", protocol_version: "gemini-native-v1beta",
}, },
@@ -51,7 +42,7 @@ const models = [
const stableFlashInteractionModel = { const stableFlashInteractionModel = {
config_version: 4, config_version: 4,
model_id: "gemini-3.1-flash-image-preview", model_id: "gemini-3.1-flash-image",
route_profile: { route_profile: {
endpoint: "https://oneapi.intelligrow.cn/v1beta/interactions", endpoint: "https://oneapi.intelligrow.cn/v1beta/interactions",
mode: "sync", mode: "sync",
@@ -62,7 +53,7 @@ const stableFlashInteractionModel = {
const stableFlashOpenAiImageModel = { const stableFlashOpenAiImageModel = {
config_version: 6, config_version: 6,
model_id: "gemini-3.1-flash-image-preview", model_id: "gemini-3.1-flash-image",
route_profile: { route_profile: {
endpoint: "https://oneapi.intelligrow.cn/v1/images/generations", endpoint: "https://oneapi.intelligrow.cn/v1/images/generations",
mode: "sync", mode: "sync",
@@ -74,7 +65,7 @@ const stableFlashOpenAiImageModel = {
const stableFlashOpenAiChatModel = { const stableFlashOpenAiChatModel = {
config_version: 7, config_version: 7,
model_id: "gemini-3.1-flash-image-preview", model_id: "gemini-3.1-flash-image",
route_profile: { route_profile: {
endpoint: "https://oneapi.intelligrow.cn/v1/chat/completions", endpoint: "https://oneapi.intelligrow.cn/v1/chat/completions",
mode: "sync", mode: "sync",
@@ -174,7 +165,7 @@ test("TDD-WP7-EXT-001 builds protocol-specific requests without auth in argument
assert.equal(stableOpenAiChat.url, "https://oneapi.intelligrow.cn/v1/chat/completions"); assert.equal(stableOpenAiChat.url, "https://oneapi.intelligrow.cn/v1/chat/completions");
assert.equal("authorization" in stableOpenAiChat.headers, false); assert.equal("authorization" in stableOpenAiChat.headers, false);
const openai = buildProviderRequest({ modelConfig: models[2], prompt: "controlled fixture prompt", ratio: "9:16" }); const openai = buildProviderRequest({ modelConfig: models[1], prompt: "controlled fixture prompt", ratio: "9:16" });
assert.deepEqual(openai.body, { assert.deepEqual(openai.body, {
model: "gpt-image-2", model: "gpt-image-2",
prompt: "controlled fixture prompt", prompt: "controlled fixture prompt",
@@ -183,7 +174,7 @@ test("TDD-WP7-EXT-001 builds protocol-specific requests without auth in argument
}); });
assert.equal("authorization" in openai.headers, false); assert.equal("authorization" in openai.headers, false);
const openaiEdit = buildProviderRequest({ modelConfig: models[2], prompt: "controlled fixture prompt", ratio: "1:1", reference }); const openaiEdit = buildProviderRequest({ modelConfig: models[1], prompt: "controlled fixture prompt", ratio: "1:1", reference });
assert.equal(openaiEdit.url, "https://oneapi.intelligrow.cn/v1/images/edits"); assert.equal(openaiEdit.url, "https://oneapi.intelligrow.cn/v1/images/edits");
assert.equal(openaiEdit.body instanceof FormData, true); assert.equal(openaiEdit.body instanceof FormData, true);
assert.equal(openaiEdit.body.get("model"), "gpt-image-2"); assert.equal(openaiEdit.body.get("model"), "gpt-image-2");
+15 -16
View File
@@ -26,10 +26,9 @@ const candidate = () => ({
status: "candidate_unvalidated", status: "candidate_unvalidated",
}); });
test("TDD-WP7-EXT-001 fixes the complete per-model controlled-real matrix", () => { test("TDD-WP7-EXT-001 fixes the user-approved replacement model set", () => {
assert.deepEqual(WP7_02_MODEL_IDS, [ assert.deepEqual(WP7_02_MODEL_IDS, [
"gemini-3.1-flash-image-preview", "gemini-3.1-flash-image",
"gemini-3-pro-image-preview",
"gpt-image-2", "gpt-image-2",
]); ]);
for (const modelId of WP7_02_MODEL_IDS) { for (const modelId of WP7_02_MODEL_IDS) {
@@ -98,17 +97,17 @@ test("TDD-WP7-EXT-001 remains externally blocked without confirmation, config an
test("TDD-WP7-EXT-001 fixes independent OneAPI routes without embedding credentials", () => { test("TDD-WP7-EXT-001 fixes independent OneAPI routes without embedding credentials", () => {
const manifest = JSON.parse(readFileSync("config/wp7-02-oneapi-test.json", "utf8")); const manifest = JSON.parse(readFileSync("config/wp7-02-oneapi-test.json", "utf8"));
assert.equal(manifest.config_set_version, 4); assert.equal(manifest.config_set_version, 8);
assert.equal(manifest.gateway_account_ref, "oneapi-intelligrow-test"); assert.equal(manifest.gateway_account_ref, "oneapi-intelligrow-test");
assert.deepEqual(manifest.models.map((entry) => entry.model_id), WP7_02_MODEL_IDS); assert.deepEqual(manifest.models.map((entry) => entry.model_id), WP7_02_MODEL_IDS);
assert.deepEqual(manifest.models.map((entry) => entry.route_profile.protocol_version), [ assert.deepEqual(manifest.models.map((entry) => entry.route_profile.protocol_version), [
"gemini-native-v1beta", "gemini-openai-chat-v1",
"gemini-native-v1beta",
"openai-images-v1", "openai-images-v1",
]); ]);
assert.deepEqual(manifest.models.map((entry) => entry.config_version), [3, 3, 2]); assert.deepEqual(manifest.models.map((entry) => entry.config_version), [7, 2]);
assert.equal(manifest.models.slice(0, 2).every((entry) => /\/v1beta\/models\/.+:generateContent$/.test(entry.route_profile.endpoint)), true); assert.equal(manifest.models[0].route_profile.endpoint, "https://oneapi.intelligrow.cn/v1/chat/completions");
assert.equal(manifest.models[2].route_profile.reference_endpoint, "https://oneapi.intelligrow.cn/v1/images/edits"); assert.equal(manifest.models[0].route_profile.provider_model_id, "gemini-3.1-flash-image");
assert.equal(manifest.models[1].route_profile.reference_endpoint, "https://oneapi.intelligrow.cn/v1/images/edits");
assert.equal(manifest.models.every((entry) => entry.route_profile.endpoint.startsWith("https://oneapi.intelligrow.cn/")), true); assert.equal(manifest.models.every((entry) => entry.route_profile.endpoint.startsWith("https://oneapi.intelligrow.cn/")), true);
assert.doesNotMatch(JSON.stringify(manifest), /api[_-]?key|authorization|bearer|sk-[A-Za-z0-9]/i); assert.doesNotMatch(JSON.stringify(manifest), /api[_-]?key|authorization|bearer|sk-[A-Za-z0-9]/i);
}); });
@@ -121,7 +120,7 @@ test("TDD-WP7-EXT-001 writes blocked evidence without mock or sensitive payloads
runId: "wp7-02-red-test", runId: "wp7-02-red-test",
})); }));
validateIndependentEvidenceSet(evidence); validateIndependentEvidenceSet(evidence);
assert.equal(new Set(evidence.map((entry) => entry.evidence_id)).size, 3); assert.equal(new Set(evidence.map((entry) => entry.evidence_id)).size, 2);
for (const entry of evidence) { for (const entry of evidence) {
assert.equal(entry.status, "externally_blocked"); assert.equal(entry.status, "externally_blocked");
assert.equal(entry.external_calls.real_calls, 0); assert.equal(entry.external_calls.real_calls, 0);
@@ -137,12 +136,12 @@ test("TDD-WP7-EXT-001 writes blocked evidence without mock or sensitive payloads
assert.throws(() => validateIndependentEvidenceSet(shared), /WP7_02_SHARED_EVIDENCE_FORBIDDEN/); assert.throws(() => validateIndependentEvidenceSet(shared), /WP7_02_SHARED_EVIDENCE_FORBIDDEN/);
const mixed = structuredClone(evidence); const mixed = structuredClone(evidence);
mixed[2].status = "passed"; mixed[1].status = "passed";
mixed[2].matrix = { model_id: mixed[2].model_id, status: "passed" }; mixed[1].matrix = { model_id: mixed[1].model_id, status: "passed" };
mixed[2].external_calls = { real_calls: 5, status: "passed" }; mixed[1].external_calls = { real_calls: 5, status: "passed" };
mixed[2].manual_review = { status: "pending" }; mixed[1].manual_review = { status: "pending" };
mixed[2].redaction = { status: "passed" }; mixed[1].redaction = { status: "passed" };
assert.doesNotThrow(() => validateIndependentEvidenceSet(mixed)); assert.doesNotThrow(() => validateIndependentEvidenceSet(mixed));
mixed[2].manual_review = { status: "passed" }; mixed[1].manual_review = { status: "passed" };
assert.doesNotThrow(() => validateIndependentEvidenceSet(mixed)); assert.doesNotThrow(() => validateIndependentEvidenceSet(mixed));
}); });