Skip to content

Commit 8e09568

Browse files
committed
perf: expand base vitest thread lanes
1 parent 412a3eb commit 8e09568

8 files changed

Lines changed: 183 additions & 10 deletions

‎scripts/test-find-thread-candidates.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export function parseArgs(argv) {
8080

8181
export function getExistingThreadCandidateExclusions(behavior) {
8282
return new Set([
83+
...(behavior.base?.threadSingleton ?? []).map((entry) => entry.file),
8384
...(behavior.unit?.isolated ?? []).map((entry) => entry.file),
8485
...(behavior.unit?.singletonIsolated ?? []).map((entry) => entry.file),
8586
...(behavior.unit?.threadSingleton ?? []).map((entry) => entry.file),

‎scripts/test-parallel.mjs‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const cleanupTempArtifacts = () => {
4949
tempArtifactDir = null;
5050
};
5151
const existingUnitConfigFiles = (entries) => existingFiles(entries).filter(isUnitConfigTestFile);
52+
const baseThreadSingletonFiles = existingFiles(behaviorManifest.base?.threadSingleton ?? []);
5253
const unitBehaviorIsolatedFiles = existingUnitConfigFiles(behaviorManifest.unit.isolated);
5354
const unitSingletonIsolatedFiles = existingUnitConfigFiles(behaviorManifest.unit.singletonIsolated);
5455
const unitThreadSingletonFiles = existingUnitConfigFiles(behaviorManifest.unit.threadSingleton);
@@ -611,6 +612,7 @@ const resolveFilterMatches = (fileFilter) => {
611612
};
612613
const isVmForkSingletonUnitFile = (fileFilter) => unitVmForkSingletonFiles.includes(fileFilter);
613614
const isThreadSingletonUnitFile = (fileFilter) => unitThreadSingletonFiles.includes(fileFilter);
615+
const isBaseThreadSingletonFile = (fileFilter) => baseThreadSingletonFiles.includes(fileFilter);
614616
const createTargetedEntry = (owner, isolated, filters) => {
615617
const name = isolated ? `${owner}-isolated` : owner;
616618
const forceForks = isolated;
@@ -648,6 +650,12 @@ const createTargetedEntry = (owner, isolated, filters) => {
648650
args: ["vitest", "run", "--config", "vitest.unit.config.ts", "--pool=threads", ...filters],
649651
};
650652
}
653+
if (owner === "base-threads") {
654+
return {
655+
name,
656+
args: ["vitest", "run", "--config", "vitest.config.ts", "--pool=threads", ...filters],
657+
};
658+
}
651659
if (owner === "extensions") {
652660
return {
653661
name,
@@ -718,7 +726,9 @@ const createPerFileTargetedEntry = (file) => {
718726
? "unit-threads"
719727
: isVmForkSingletonUnitFile(file)
720728
? "unit-vmforks"
721-
: target.owner;
729+
: isBaseThreadSingletonFile(file)
730+
? "base-threads"
731+
: target.owner;
722732
return {
723733
...createTargetedEntry(owner, target.isolated, [file]),
724734
name: formatPerFileEntryName(owner, file),
@@ -747,7 +757,9 @@ const targetedEntries = (() => {
747757
? "unit-threads"
748758
: isVmForkSingletonUnitFile(normalizedFile)
749759
? "unit-vmforks"
750-
: target.owner;
760+
: isBaseThreadSingletonFile(normalizedFile)
761+
? "base-threads"
762+
: target.owner;
751763
const key = `${owner}:${target.isolated ? "isolated" : "default"}`;
752764
const files = acc.get(key) ?? [];
753765
files.push(normalizedFile);
@@ -760,7 +772,9 @@ const targetedEntries = (() => {
760772
? "unit-threads"
761773
: isVmForkSingletonUnitFile(matchedFile)
762774
? "unit-vmforks"
763-
: target.owner;
775+
: isBaseThreadSingletonFile(matchedFile)
776+
? "base-threads"
777+
: target.owner;
764778
const key = `${owner}:${target.isolated ? "isolated" : "default"}`;
765779
const files = acc.get(key) ?? [];
766780
files.push(matchedFile);

‎scripts/test-runner-manifest.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ const normalizeManifestEntries = (entries) =>
3030
export function loadTestRunnerBehavior() {
3131
const raw = tryReadJsonFile(behaviorManifestPath, {});
3232
const unit = raw.unit ?? {};
33+
const base = raw.base ?? {};
3334
return {
35+
base: {
36+
threadSingleton: normalizeManifestEntries(base.threadSingleton ?? []),
37+
},
3438
unit: {
3539
isolated: normalizeManifestEntries(unit.isolated ?? []),
3640
singletonIsolated: normalizeManifestEntries(unit.singletonIsolated ?? []),

‎src/config/types.models.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type SupportedOpenAICompatFields = Pick<
2929

3030
type SupportedThinkingFormat =
3131
| NonNullable<OpenAICompletionsCompat["thinkingFormat"]>
32+
| "openrouter"
3233
| "qwen-chat-template";
3334

3435
export type ModelCompatConfig = SupportedOpenAICompatFields & {

‎src/tui/components/filterable-select-list.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { Component } from "@mariozechner/pi-tui";
22
import {
33
Input,
4+
Key,
45
matchesKey,
56
type SelectItem,
67
SelectList,
78
type SelectListTheme,
8-
getKeybindings,
99
} from "@mariozechner/pi-tui";
1010
import chalk from "chalk";
1111
import { fuzzyFilterLower, prepareSearchItems } from "./fuzzy-filter.js";
@@ -110,8 +110,7 @@ export class FilterableSelectList implements Component {
110110
}
111111

112112
// Escape: clear filter or cancel
113-
const kb = getKeybindings();
114-
if (kb.matches(keyData, "tui.select.cancel")) {
113+
if (matchesKey(keyData, Key.escape) || matchesKey(keyData, Key.ctrl("c"))) {
115114
if (this.filterText) {
116115
this.filterText = "";
117116
this.input.setValue("");

‎src/tui/components/searchable-select-list.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
type Component,
3-
getKeybindings,
43
Input,
4+
Key,
55
isKeyRelease,
66
matchesKey,
77
type SelectItem,
@@ -362,8 +362,7 @@ export class SearchableSelectList implements Component {
362362
return;
363363
}
364364

365-
const kb = getKeybindings();
366-
if (kb.matches(keyData, "tui.select.cancel")) {
365+
if (matchesKey(keyData, Key.escape) || matchesKey(keyData, Key.ctrl("c"))) {
367366
if (this.onCancel) {
368367
this.onCancel();
369368
}

‎test/fixtures/test-parallel.behavior.json‎

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,140 @@
11
{
2+
"base": {
3+
"threadSingleton": [
4+
{
5+
"file": "src/commands/backup.test.ts",
6+
"reason": "Measured ~16% faster under threads than forks on base config after removing process.chdir() from the test."
7+
},
8+
{
9+
"file": "src/auto-reply/reply/commands-acp/install-hints.test.ts",
10+
"reason": "Measured ~35% faster under threads than forks on base config after removing process.chdir() from the test."
11+
},
12+
{
13+
"file": "src/agents/pi-extensions/compaction-safeguard.test.ts",
14+
"reason": "Measured ~27% faster under threads than forks on base config after removing process.chdir() from the test."
15+
},
16+
{
17+
"file": "test/git-hooks-pre-commit.test.ts",
18+
"reason": "Measured ~12% faster under threads than forks on base config while keeping the file green."
19+
},
20+
{
21+
"file": "test/web-search-provider-boundary.test.ts",
22+
"reason": "Measured ~13% faster under threads than forks on base config while keeping the boundary checks green."
23+
},
24+
{
25+
"file": "test/scripts/test-runner-manifest.test.ts",
26+
"reason": "Measured ~10% faster under threads than forks on base config while keeping the manifest routing checks green."
27+
},
28+
{
29+
"file": "test/architecture-smells.test.ts",
30+
"reason": "Measured ~14% faster under threads than forks on base config while keeping the architecture guardrails green."
31+
},
32+
{
33+
"file": "test/scripts/test-extension.test.ts",
34+
"reason": "Measured ~10% faster under threads than forks on base config while keeping the extension script checks green."
35+
},
36+
{
37+
"file": "test/vitest-unit-config.test.ts",
38+
"reason": "Measured ~13% faster under threads than forks on base config while keeping the Vitest config checks green."
39+
},
40+
{
41+
"file": "test/release-check.test.ts",
42+
"reason": "Measured ~11% faster under threads than forks on base config while keeping the release checks green."
43+
},
44+
{
45+
"file": "src/cli/secrets-cli.test.ts",
46+
"reason": "Measured ~11% faster under threads than forks on base config while keeping secrets CLI coverage green."
47+
},
48+
{
49+
"file": "src/cli/plugin-registry.test.ts",
50+
"reason": "Measured ~11% faster under threads than forks on base config while keeping plugin registry CLI coverage green."
51+
},
52+
{
53+
"file": "src/cli/route.test.ts",
54+
"reason": "Measured ~12% faster under threads than forks on base config while keeping route CLI coverage green."
55+
},
56+
{
57+
"file": "src/cli/exec-approvals-cli.test.ts",
58+
"reason": "Measured ~15% faster under threads than forks on base config while keeping approvals CLI coverage green."
59+
},
60+
{
61+
"file": "src/cli/browser-cli-manage.timeout-option.test.ts",
62+
"reason": "Measured ~14% faster under threads than forks on base config while keeping browser manage timeout coverage green."
63+
},
64+
{
65+
"file": "src/cli/browser-cli-manage.test.ts",
66+
"reason": "Measured ~14% faster under threads than forks on base config while keeping browser manage coverage green."
67+
},
68+
{
69+
"file": "src/cli/deps.test.ts",
70+
"reason": "Measured ~81% faster under threads than forks on base config while keeping dependency checks green."
71+
},
72+
{
73+
"file": "src/cli/nodes-cli.coverage.test.ts",
74+
"reason": "Measured ~12% faster under threads than forks on base config while keeping nodes CLI coverage green."
75+
},
76+
{
77+
"file": "src/cli/daemon-cli/restart-health.test.ts",
78+
"reason": "Measured ~35% faster under threads than forks on base config while keeping daemon restart health coverage green."
79+
},
80+
{
81+
"file": "src/cli/program/config-guard.test.ts",
82+
"reason": "Measured ~14% faster under threads than forks on base config while keeping program config guard coverage green."
83+
},
84+
{
85+
"file": "src/cli/update-cli/restart-helper.test.ts",
86+
"reason": "Measured ~12% faster under threads than forks on base config while keeping update restart helper coverage green."
87+
},
88+
{
89+
"file": "src/cli/security-cli.test.ts",
90+
"reason": "Measured ~31% faster under threads than forks on base config while keeping security CLI coverage green."
91+
},
92+
{
93+
"file": "src/cli/channel-options.test.ts",
94+
"reason": "Measured ~13% faster under threads than forks on base config while keeping channel options coverage green."
95+
},
96+
{
97+
"file": "src/cli/log-level-option.test.ts",
98+
"reason": "Measured ~11% faster under threads than forks on base config while keeping log level option coverage green."
99+
},
100+
{
101+
"file": "src/cli/plugin-install-plan.test.ts",
102+
"reason": "Measured ~14% faster under threads than forks on base config while keeping plugin install planning coverage green."
103+
},
104+
{
105+
"file": "src/cli/memory-cli.test.ts",
106+
"reason": "Measured ~50% faster under threads than forks on base config while keeping memory CLI coverage green."
107+
},
108+
{
109+
"file": "src/cli/program.nodes-test-helpers.test.ts",
110+
"reason": "Measured ~22% faster under threads than forks on base config while keeping nodes test helper coverage green."
111+
},
112+
{
113+
"file": "src/cli/skills-cli.test.ts",
114+
"reason": "Measured ~27% faster under threads than forks on base config while keeping skills CLI coverage green."
115+
},
116+
{
117+
"file": "src/cli/run-main.exit.test.ts",
118+
"reason": "Measured ~12% faster under threads than forks on base config while keeping run-main exit coverage green."
119+
},
120+
{
121+
"file": "src/cli/completion-fish.test.ts",
122+
"reason": "Measured ~41% faster under threads than forks on base config while keeping fish completion coverage green."
123+
},
124+
{
125+
"file": "src/cli/config-set-mode.test.ts",
126+
"reason": "Measured ~11% faster under threads than forks on base config while keeping config set mode coverage green."
127+
},
128+
{
129+
"file": "src/cli/program/build-program.version-alias.test.ts",
130+
"reason": "Measured ~13% faster under threads than forks on base config while keeping version alias coverage green."
131+
},
132+
{
133+
"file": "src/cli/program/register.agent.test.ts",
134+
"reason": "Measured ~11% faster under threads than forks on base config while keeping register agent coverage green."
135+
}
136+
]
137+
},
2138
"unit": {
3139
"isolated": [
4140
{
@@ -377,6 +513,10 @@
377513
"file": "src/plugins/status.test.ts",
378514
"reason": "Measured ~10% faster under threads than forks on this host while keeping the file green."
379515
},
516+
{
517+
"file": "src/plugins/bundled-dir.test.ts",
518+
"reason": "Measured ~11% faster under threads than forks on this host while keeping the file green."
519+
},
380520
{
381521
"file": "src/plugins/sdk-alias.test.ts",
382522
"reason": "Measured ~17% faster under threads than forks on this host after removing process.chdir() from the test."
@@ -641,6 +781,10 @@
641781
"file": "src/cli/daemon-cli/install.integration.test.ts",
642782
"reason": "Measured ~12% faster under threads than forks on this host while keeping the file green."
643783
},
784+
{
785+
"file": "src/cli/mcp-cli.test.ts",
786+
"reason": "Measured ~12% faster under threads than forks on this host while keeping the file green."
787+
},
644788
{
645789
"file": "src/channels/channels-misc.test.ts",
646790
"reason": "Measured ~12% faster under threads than forks on this host while keeping the file green."

‎test/scripts/test-find-thread-candidates.test.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,25 @@ describe("scripts/test-find-thread-candidates exclusions", () => {
4444
it("collects already-pinned files across behavior buckets", () => {
4545
expect(
4646
getExistingThreadCandidateExclusions({
47+
base: {
48+
threadSingleton: [{ file: "src/base-a.test.ts" }],
49+
},
4750
unit: {
4851
isolated: [{ file: "src/a.test.ts" }],
4952
singletonIsolated: [{ file: "src/b.test.ts" }],
5053
threadSingleton: [{ file: "src/c.test.ts" }],
5154
vmForkSingleton: [{ file: "src/d.test.ts" }],
5255
},
5356
}),
54-
).toEqual(new Set(["src/a.test.ts", "src/b.test.ts", "src/c.test.ts", "src/d.test.ts"]));
57+
).toEqual(
58+
new Set([
59+
"src/base-a.test.ts",
60+
"src/a.test.ts",
61+
"src/b.test.ts",
62+
"src/c.test.ts",
63+
"src/d.test.ts",
64+
]),
65+
);
5566
});
5667
});
5768

0 commit comments

Comments
 (0)