Skip to content

Commit 8fb28e1

Browse files
LocalServerStress: Minimize number of clients (#24700)
This change adds a minimizer for client selection which tries to reduce the number of clients, as synchronized clients are frequently interchangeable, and non-dependent changes may not need a specific client to run on. so far this does a good job of reducing the number of clients in the repos i'm playing with. --------- Co-authored-by: Copilot <[email protected]>
1 parent b27957d commit 8fb28e1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/test/local-server-stress-tests/src/localServerStressHarness.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,23 @@ function mixinClientSelection<TOperation extends BaseOperation>(
684684
};
685685
return {
686686
...model,
687+
minimizationTransforms: [
688+
...(model.minimizationTransforms ?? []),
689+
(op) => {
690+
// the clients are somewhat interchangeable, and the fewer clients
691+
// involved in a repro the easier it is to debug, so try to
692+
// reduce the client id
693+
if (hasSelectedClientSpec(op)) {
694+
const dashIndex = op.clientTag.lastIndexOf("-");
695+
if (dashIndex !== -1) {
696+
const id = Number.parseInt(op.clientTag.slice(dashIndex + 1), 10);
697+
if (id > 1) {
698+
op.clientTag = `client-${id - 1}`;
699+
}
700+
}
701+
}
702+
},
703+
],
687704
generatorFactory,
688705
reducer,
689706
};

0 commit comments

Comments
 (0)