From c98e7ff6d0d604b0dda9f0b8d05804cb71bd3efa Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Tue, 23 Jun 2026 01:15:27 -0300 Subject: [PATCH] fix(release-green): resolve release-PR full-CI reds for v3.8.34 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surfaced only on the release PR (these gates don't run on PR->release fast-gates): - fix(quota): complete HTML-comment sanitization in opencodeOllamaUsage SSR reset-time parsing — strip any generically instead of the two literal React hydration markers, so no partial "|/g, "").replace(/Resets?\s*in\s*/i, "") + // Strip any HTML comment generically (React SSR emits / hydration + // markers) — a complete removal, not just the two literal markers, so no + // partial "/g, "").replace(/Resets?\s*in\s*/i, "") ); if (resetInSec === null || !Number.isFinite(resetInSec)) continue; const window = { diff --git a/tests/integration/chat-pipeline.test.ts b/tests/integration/chat-pipeline.test.ts index 1a8b8ca358..7627108d30 100644 --- a/tests/integration/chat-pipeline.test.ts +++ b/tests/integration/chat-pipeline.test.ts @@ -711,9 +711,13 @@ test("chat pipeline applies Codex CLI fingerprint to OAuth responses requests", assert.ok(headerOrder.indexOf("Accept") < headerOrder.indexOf("User-Agent")); const bodyOrder = Object.keys(JSON.parse(call.bodyString)); + // Order must match the canonical Codex fingerprint bodyFieldOrder (cliFingerprints.ts): + // …reasoning, prompt_cache_key, …, include — i.e. prompt_cache_key precedes include. + // (#4584 inadvertently flipped these two; fast-gates skip integration tests so it only + // surfaced on the release PR full CI.) assert.deepEqual( bodyOrder.slice(0, 8), - "model stream input instructions store reasoning include prompt_cache_key".split(" ") + "model stream input instructions store reasoning prompt_cache_key include".split(" ") ); assert.equal(call.body.model, "gpt-5.5"); assert.equal(call.body.store, false); diff --git a/tests/unit/opencode-go-usage.test.ts b/tests/unit/opencode-go-usage.test.ts index 2488ada889..64e6357800 100644 --- a/tests/unit/opencode-go-usage.test.ts +++ b/tests/unit/opencode-go-usage.test.ts @@ -238,6 +238,54 @@ test("getUsageForProvider scrapes OpenCode Go dashboard quota when workspace coo } }); +// Regression: React SSR wraps the reset-time text in hydration comment markers +// (). The reset string must be fully sanitized (complete +// removal, not just the two literal markers) so the reset time still parses — and so no +// partial "Resets in 1 hour 30 minutes', + "", + ].join(""), + { status: 200, headers: { "content-type": "text/html" } } + ); + + try { + const result = (await usage.getUsageForProvider({ + id: "opencode-go-dashboard", + provider: "opencode-go", + apiKey: "opencode-go-key", + })) as { + quotas?: Record; + }; + + // session quota resolved → the comment-wrapped reset time was sanitized and parsed + assert.ok( + result.quotas?.session, + "session quota should resolve from comment-wrapped reset-time" + ); + assert.equal(result.quotas!.session.remainingPercentage, 75); + } finally { + globalThis.fetch = originalFetch; + if (originalWorkspace === undefined) delete process.env.OPENCODE_GO_WORKSPACE_ID; + else process.env.OPENCODE_GO_WORKSPACE_ID = originalWorkspace; + if (originalCookie === undefined) delete process.env.OPENCODE_GO_AUTH_COOKIE; + else process.env.OPENCODE_GO_AUTH_COOKIE = originalCookie; + } +}); + test("getUsageForProvider returns message for invalid OpenCode Go API keys", async () => { const originalFetch = globalThis.fetch; globalThis.fetch = async () => new Response("nope", { status: 401 });