From c49b2ece150787e921574a71a0936342e1cbb670 Mon Sep 17 00:00:00 2001 From: Test Date: Sat, 29 Aug 2026 08:00:49 +0000 Subject: [PATCH] =?UTF-8?q?fix(test):=20per-shard=20CHROMIUM=5FPROFILE=20?= =?UTF-8?q?=E2=80=94=20the=20collision=20class=20duration=20packing=20expo?= =?UTF-8?q?sed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nine test files launch in-process persistent contexts or daemons that default to the SHARED ~/.gstack/chromium-profile. Two concurrent shard processes on one profile dir kill each other's browser — observed live on CI once duration packing recomposed shards: handoff's launchPersistentContext died 'Target page, context or browser has been closed' (--user-data-dir=~/.gstack/chromium-profile in the call log) while a sibling shard's daemon logged 'Chromium process crashed'. Hash sharding had masked the collision by chance placement; handoff passes standalone everywhere. Fix at the runner, not per file: each shard child gets CHROMIUM_PROFILE=/chromium-profile (the documented env knob, same isolation idea as the existing per-shard TMPDIR). Files within a shard run serially, so sharing the per-shard profile is safe; config.test's resolution-order tests save/restore the env around their assertions. Co-Authored-By: Claude Fable 5 --- scripts/test-free-shards.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/test-free-shards.ts b/scripts/test-free-shards.ts index 52216edd1..6c732c633 100755 --- a/scripts/test-free-shards.ts +++ b/scripts/test-free-shards.ts @@ -1111,6 +1111,17 @@ export async function runFreeShard( env.TMPDIR = childTmp; env.TEMP = childTmp; env.TMP = childTmp; + // Per-shard Chromium profile (same isolation idea as TMPDIR): nine test + // files launch in-process persistent contexts or daemons that default to + // the SHARED ~/.gstack/chromium-profile, and two concurrent shards on one + // profile dir kill each other's browser — observed live on CI once + // duration packing recomposed shards (handoff's launchPersistentContext + // died "Target page, context or browser has been closed" while a sibling + // shard's daemon logged "Chromium process crashed"). Hash sharding had + // masked the collision by chance placement. Within a shard, files run + // serially, so sharing the per-shard profile is safe; config tests that + // assert resolution order save/restore this env around their assertions. + env.CHROMIUM_PROFILE = path.join(stateDir, 'chromium-profile'); const startedAt = Date.now(); const child = spawn(command, args, {