From 5deffdc757cedb14393549d9b623881d3c009a5d Mon Sep 17 00:00:00 2001 From: teamchong <25894545+teamchong@users.noreply.github.com> Date: Thu, 9 Jul 2026 22:41:42 -0400 Subject: [PATCH] test: pin PXPIPE_MODELS in savings-math e2e so CI is hermetic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GPT tests drive gpt-5.6-sol, which is intentionally outside the built-in default scope (Fable 5 only). Without pinning, the file's result depended on the developer's ambient PXPIPE_MODELS — passing locally but failing in CI's clean env. Snapshot/pin/restore, same convention as proxy-usage.test.ts. --- tests/savings-math-e2e.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/savings-math-e2e.test.ts b/tests/savings-math-e2e.test.ts index 556b84f..b3f5e43 100644 --- a/tests/savings-math-e2e.test.ts +++ b/tests/savings-math-e2e.test.ts @@ -19,10 +19,25 @@ * * Run just this file: pnpm vitest run tests/savings-math-e2e.test.ts */ -import { describe, expect, it } from 'vitest'; +import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { createProxy, type ProxyEvent } from '../src/core/proxy.js'; import { countTokens as o200k } from 'gpt-tokenizer/encoding/o200k_base'; +// The GPT tests below drive 'gpt-5.6-sol', which is intentionally absent from +// the built-in default scope (Fable 5 only). Pin PXPIPE_MODELS so the suite is +// deterministic regardless of the developer's shell (same convention as +// proxy-usage.test.ts) — without this, the file passes or fails depending on +// ambient env, which is exactly what broke CI. +let ambientPxpipeModels: string | undefined; +beforeAll(() => { + ambientPxpipeModels = process.env.PXPIPE_MODELS; + process.env.PXPIPE_MODELS = 'claude-fable-5,gpt-5.6-sol'; +}); +afterAll(() => { + if (ambientPxpipeModels === undefined) delete process.env.PXPIPE_MODELS; + else process.env.PXPIPE_MODELS = ambientPxpipeModels; +}); + const PROBE_TOKENS = 9999; // canned count_tokens result from the fake upstream function fakeUpstream() {