From 99058ee3cdc2717bbdc6123a97875c0abca45196 Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 29 Sep 2026 14:42:11 +0000 Subject: [PATCH] test: follow the headed env helper and the typecheck gate in source-shape checks --- browse/test/cli-supervisor.test.ts | 2 +- browse/test/server-auth.test.ts | 14 ++++++-------- scripts/typecheck-test-baseline.json | 1 - test/cso-distribution.test.ts | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/browse/test/cli-supervisor.test.ts b/browse/test/cli-supervisor.test.ts index 2fb7d6727..a689a025a 100644 --- a/browse/test/cli-supervisor.test.ts +++ b/browse/test/cli-supervisor.test.ts @@ -181,7 +181,7 @@ describe('runHeadedSupervisor (behavior)', () => { describe('buildHeadedServerEnv', () => { test('omits proxy and config hash when this invocation has none', () => { - expect(buildHeadedServerEnv({})).toEqual({ BROWSE_HEADED: '1', BROWSE_PORT: '34567', BROWSE_PARENT_PID: '0' }); + expect(buildHeadedServerEnv({ proxyUrl: null, configHash: '' })).toEqual({ BROWSE_HEADED: '1', BROWSE_PORT: '34567', BROWSE_PARENT_PID: '0' }); }); }); diff --git a/browse/test/server-auth.test.ts b/browse/test/server-auth.test.ts index 5949f1f13..eaf65970e 100644 --- a/browse/test/server-auth.test.ts +++ b/browse/test/server-auth.test.ts @@ -8,6 +8,7 @@ import { describe, test, expect } from 'bun:test'; import * as fs from 'fs'; import * as path from 'path'; +import { buildHeadedServerEnv } from '../src/cli'; const SERVER_SRC = fs.readFileSync(path.join(import.meta.dir, '../src/server.ts'), 'utf-8'); const CLI_SRC = fs.readFileSync(path.join(import.meta.dir, '../src/cli.ts'), 'utf-8'); @@ -366,15 +367,12 @@ describe('Server auth security', () => { // The connect subprocess env must override BROWSE_PARENT_PID expect(pairBlock).toContain("BROWSE_PARENT_PID"); expect(pairBlock).toContain("'0'"); - // The connect command must propagate BROWSE_PARENT_PID=0 via the - // serverEnv object literal passed to startServer. The literal text - // `serverEnv.BROWSE_PARENT_PID` is NOT in source — the value is - // assigned via object-literal syntax (`BROWSE_PARENT_PID: '0'`) - // inside the `const serverEnv: Record = { ... }` - // declaration. Assert both pieces appear in the connect block. + // The connect command starts its server with buildHeadedServerEnv, the + // same env the --supervise respawn uses, and that env disables the + // parent-PID watchdog. const connectBlock = sliceBetween(CLI_SRC, 'Launching headed Chromium', 'Terminal agent started'); - expect(connectBlock).toContain("const serverEnv"); - expect(connectBlock).toContain("BROWSE_PARENT_PID: '0'"); + expect(connectBlock).toContain('startServer(buildHeadedServerEnv(globalFlags))'); + expect(buildHeadedServerEnv({ proxyUrl: null, configHash: '' }).BROWSE_PARENT_PID).toBe('0'); }); // Regression: newtab returned 403 for scoped tokens because the tab ownership diff --git a/scripts/typecheck-test-baseline.json b/scripts/typecheck-test-baseline.json index ba5095cf8..737672681 100644 --- a/scripts/typecheck-test-baseline.json +++ b/scripts/typecheck-test-baseline.json @@ -9,7 +9,6 @@ "browse/test/browse-client.test.ts\tTS2322\tType 'number | undefined' is not assignable to type 'number'. Type 'undefined' is not assignable to type 'number'.": 1, "browse/test/cdp-e2e.test.ts\tTS2339\tProperty 'cleanup' does not exist on type 'BrowserManager'.": 1, "browse/test/cdp-inspector-history-cap.test.ts\tTS2741\tProperty 'sourceLine' is missing in type '{ selector: string; property: string; oldValue: string; newValue: string; source: 'inline'; timestamp: number; method: 'setProperty'; }' but required in type 'StyleModification'.": 7, - "browse/test/cli-supervisor.test.ts\tTS2739\tType '{}' is missing the following properties from type 'Pick': proxyUrl, configHash": 1, "browse/test/commands.test.ts\tTS2300\tDuplicate identifier 'os'.": 2, "browse/test/config.test.ts\tTS2367\tThis comparison appears to be unintentional because the types '\"abc123\"' and '\"def456\"' have no overlap.": 1, "browse/test/config.test.ts\tTS2769\tNo overload matches this call. The last overload gave the following error. Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'.": 1, diff --git a/test/cso-distribution.test.ts b/test/cso-distribution.test.ts index feebec2b9..2657e6ab2 100644 --- a/test/cso-distribution.test.ts +++ b/test/cso-distribution.test.ts @@ -318,7 +318,7 @@ describe('CSO runtime staging gates', () => { expect(gate['continue-on-error']).not.toBe(true); const required = workflow.jobs['free-tests']; expect(required.if).toBe('always()'); - expect(required.needs).toEqual(['free-suite', 'cso-macos-launcher', 'cso-windows-launcher', 'cso-docker-integration']); + expect(required.needs).toEqual(['free-suite', 'typecheck', 'cso-macos-launcher', 'cso-windows-launcher', 'cso-docker-integration']); expect(required.steps[0].run).toContain('test "$CSO_DOCKER_RESULT" = success'); for (const current of Object.values(workflow.jobs) as any[]) for (const step of current.steps) { if (step.uses?.startsWith('oven-sh/setup-bun')) expect(step.uses).toBe('oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6');