From 6d7dbaa1b5bf82b95dfd4164c22430ca908f00a7 Mon Sep 17 00:00:00 2001 From: Greg Soucy Date: Fri, 20 Mar 2026 17:37:10 -0400 Subject: [PATCH] [runtime] make schema chain test deterministic Why: ensure the end-to-end signing chain test follows cached-only validator warmup behavior in CI instead of hanging on cold schema startup. Contract impact: none --- runtime/tests/runtime-signing.test.mjs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime/tests/runtime-signing.test.mjs b/runtime/tests/runtime-signing.test.mjs index db5ba90..55e2ced 100644 --- a/runtime/tests/runtime-signing.test.mjs +++ b/runtime/tests/runtime-signing.test.mjs @@ -436,8 +436,10 @@ test("full chain clean -> summarize -> classify verifies with schema using parti RECEIPT_SIGNING_PRIVATE_KEY_PEM_B64: keys.privatePemB64, RECEIPT_SIGNING_PUBLIC_KEY_B64: keys.publicRaw32B64, RECEIPT_SIGNER_ID: "runtime.commandlayer.eth", - VERIFY_SCHEMA_CACHED_ONLY: "0", - SCHEMA_FETCH_TIMEOUT_MS: "50", + VERIFY_SCHEMA_CACHED_ONLY: "1", + VERIFY_MAX_MS: "12000", + SCHEMA_FETCH_TIMEOUT_MS: "3000", + SCHEMA_VALIDATE_BUDGET_MS: "3000", }); async function runVerb(base, verb, content) { @@ -530,11 +532,8 @@ test("full chain clean -> summarize -> classify verifies with schema using parti let verifyAttempt = await verifyReceiptWithTimeout(finalReceipt); console.log("[chain] after verify response", verifyAttempt.res.status, verifyAttempt.json ?? verifyAttempt.text); - if ( - verifyAttempt.res.status === 202 - && verifyAttempt.json?.reason === "validator_not_warmed_yet" - ) { - console.log("[chain] verify warmup 202 response", verifyAttempt.json); + if (verifyAttempt.res.status === 202) { + console.log("[chain] verify warmup 202 response", verifyAttempt.json ?? verifyAttempt.text); await new Promise((resolve) => setTimeout(resolve, 1200)); console.log("[chain] before verify request retry"); verifyAttempt = await verifyReceiptWithTimeout(finalReceipt); @@ -545,7 +544,11 @@ test("full chain clean -> summarize -> classify verifies with schema using parti const verifyJson = verifyAttempt.json; assert.ok(verifyJson, "verify returned non-JSON response"); - assert.equal(verifyRes.status, 200); + + if (verifyRes.status !== 200) { + throw new Error(`verify retry failed with status ${verifyRes.status}: ${verifyAttempt.text}`); + } + assert.equal(verifyJson.checks.signature_valid, true); assert.equal(verifyJson.checks.hash_matches, true); assert.equal(verifyJson.checks.schema_valid, true);