From 1c649884b9f98a6ad1a0727d60c927c077af11b2 Mon Sep 17 00:00:00 2001 From: "Fusion (runfusion.ai)" Date: Mon, 18 May 2026 04:59:46 -0700 Subject: [PATCH] =?UTF-8?q?feat(FN-4989):=20complete=20Step=201=20?= =?UTF-8?q?=E2=80=94=20enforce=20minimum=20two-way=20splits=20above=20thre?= =?UTF-8?q?shold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fusion-Task-Id: FN-4989 Fusion-Task-Lineage: 7dc15ef5-3318-4611-9e3c-aebe3cb15952 --- scripts/ci-test-shard.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ci-test-shard.mjs b/scripts/ci-test-shard.mjs index 760840991..6a3ecd144 100644 --- a/scripts/ci-test-shard.mjs +++ b/scripts/ci-test-shard.mjs @@ -6,6 +6,8 @@ * Packages are weighted by discovered test-file count. Oversized packages are * rewritten into virtual shard entries `{ name, shardIndex, shardCount }` so * one package can execute across multiple CI shards via `vitest --shard`. + * Any package above `splitLimit` always splits at least 2 ways (up to shard + * count), even when it is smaller than one full per-shard budget. * The planner then uses a best-fit-decreasing strategy that packs each entry * toward the per-shard budget (or minimizes overshoot when necessary), while * keeping slices of the same package on different shards whenever possible. @@ -104,7 +106,7 @@ export function computeSplitPlan(packages, total, options = {}) { perShardBudget > 0 && pkg.testFileCount > splitLimit; const sliceCount = shouldConsiderSplit - ? Math.min(total, Math.ceil(pkg.testFileCount / perShardBudget)) + ? Math.min(total, Math.max(2, Math.ceil(pkg.testFileCount / perShardBudget))) : 1; if (sliceCount < 2) {