From da39de7b28f133d544d9c037d867555ebb3873c4 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 26 Oct 2026 06:06:59 +0000 Subject: [PATCH] test(browse): pin the mismatch remedy per platform so the Windows subset does not take process.platform proxyMismatchLines defaulted to process.platform in the env-proxy-meets-direct-daemon case, so on the windows-free-tests lane the remedy read 'or unset HTTPS_PROXY' and the assertion failed. The case now passes 'linux' explicitly and pins the darwin/win32 remedy beside it. Test only; source unchanged since 1f6c85af. Decision: GStack Minder (2026-10-26), option A. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- browse/test/proxy-env.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/browse/test/proxy-env.test.ts b/browse/test/proxy-env.test.ts index 7bfa47801..b5681b2c9 100644 --- a/browse/test/proxy-env.test.ts +++ b/browse/test/proxy-env.test.ts @@ -244,13 +244,18 @@ describe('proxyMismatchLines', () => { const state = (extra: Record = {}) => ({ pid: 1, port: 1, token: 't', startedAt: '', serverPath: '', mode: 'launched' as const, configHash: 'x', ...extra }); const proxied = { proxy: 'http://proxy.example:3128/', proxySource: 'HTTPS_PROXY', proxyBypass: 'localhost,127.0.0.1,[::1]' }; - test('an env proxy meeting a direct daemon names the variable and offers stop or direct', () => { - const lines = proxyMismatchLines(extractGlobalFlags(['text'], { HTTPS_PROXY: 'http://proxy.example:3128' }), state(), {})!; + test('an env proxy meeting a direct daemon names the variable and offers stop, then direct on Linux or unsetting the variable elsewhere', () => { + const env = { HTTPS_PROXY: 'http://proxy.example:3128' }; + const lines = proxyMismatchLines(extractGlobalFlags(['text'], env, 'linux'), state(), {}, 'linux')!; expect(lines[0]).toContain('(HTTPS_PROXY differs)'); expect(lines[1]).toBe(' daemon: no proxy'); expect(lines[2]).toBe(' session: proxy http://proxy.example:3128/ from HTTPS_PROXY, bypassing localhost,127.0.0.1,[::1]'); expect(lines[3]).toBe("fix: run 'browse stop' to restart the daemon with this session's proxy settings, or set BROWSE_PROXY_URL=direct to use the running daemon without a proxy."); expect(lines[4]).toBe('see https://github.com/garrytan/gstack/blob/main/BROWSER.md#proxy-from-environment'); + for (const platform of ['darwin', 'win32'] as const) { + const other = proxyMismatchLines(extractGlobalFlags(['text'], env, platform), state(), {}, platform)!; + expect(other[3], platform).toBe("fix: run 'browse stop' to restart the daemon with this session's proxy settings, or unset HTTPS_PROXY to use the running daemon with the system proxy settings."); + } }); test('a direct session meeting an env-proxied daemon names the daemon variable', () => {