test(wp7-02): require safe Gemini text classification
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 5m50s

This commit is contained in:
suyx
2026-08-04 18:03:52 +08:00
parent 75a589dad8
commit 3093c4470a
@@ -216,6 +216,15 @@ test("TDD-WP7-EXT-001 retries one timeout once and records every real attempt",
}); });
test("TDD-WP7-EXT-001 describes only protocol structure and stops repeated contract-shape calls", async () => { test("TDD-WP7-EXT-001 describes only protocol structure and stops repeated contract-shape calls", async () => {
const uriShape = describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "https://first.invalid/generated" }] } }] });
const equivalentUriShape = describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "https://other.invalid/result" }] } }] });
assert.deepEqual(uriShape, equivalentUriShape);
assert.match(JSON.stringify(uriShape), /"representation":"uri"/);
assert.doesNotMatch(JSON.stringify(uriShape), /first\.invalid|other\.invalid/);
assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "![result](https:\/\/example.invalid\/generated)" }] } }] })), /"representation":"markdown_uri"/);
assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "data:image\/png;base64,AAAA" }] } }] })), /"representation":"inline_media"/);
assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "ordinary explanation" }] } }] })), /"representation":"plain_text"/);
let fetchCalls = 0; let fetchCalls = 0;
const execution = await runControlledRealScenarios({ const execution = await runControlledRealScenarios({
fetchImpl: async () => { fetchImpl: async () => {