From 21bd661e7dcce054656de5bfce6a194146c38c15 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Mon, 31 Aug 2026 20:59:12 +0000 Subject: [PATCH] test(browse): pin cli.ts profile-dir wiring to the canonical resolver Wave-added coverage for the #2732 absorption: a 6-line fix with zero tests is how the hardcoded path shipped in the first place. resolveChromiumProfile's env behavior is already pinned in config.test.ts; this pins cli.ts's delegation and forbids the hardcoded path from returning. Co-Authored-By: Claude Fable 5 --- browse/test/cli-lock.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/browse/test/cli-lock.test.ts b/browse/test/cli-lock.test.ts index 9c6e04c19..577315b56 100644 --- a/browse/test/cli-lock.test.ts +++ b/browse/test/cli-lock.test.ts @@ -99,3 +99,22 @@ describe('browse CLI server lock diagnostics (#1084)', () => { }); }); }); + +// #2732 absorption (wave-added test): cli.ts's profile-lock cleanup and orphan +// kill must resolve the profile dir through the canonical resolver — a +// hardcoded ~/.gstack/chromium-profile here silently ignored $CHROMIUM_PROFILE +// and $GSTACK_HOME, so `browse stop` unlinked locks and SIGKILLed a PID +// belonging to an UNRELATED browser whenever a custom profile was active. +// resolveChromiumProfile's env behavior is pinned in browse/test/config.test.ts; +// this pins the cli.ts wiring to it. +describe('chromiumProfileDir wiring (#2732)', () => { + const cliSrc = fs.readFileSync(path.join(import.meta.dir, '..', 'src', 'cli.ts'), 'utf-8'); + + test('cli.ts delegates to resolveChromiumProfile', () => { + expect(cliSrc).toMatch(/function chromiumProfileDir\(\): string \{\s*return resolveChromiumProfile\(\);/); + }); + + test('no hardcoded chromium-profile path remains in cli.ts', () => { + expect(cliSrc).not.toMatch(/['"]\.gstack['"],\s*['"]chromium-profile['"]/); + }); +});