Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ const makeTest = Effect.fn("ServerConfig.makeTest")(function* (
baseDir,
...derivedPaths,
mode: "web",
// The test process already has its PATH; a login-shell probe blocks each boot for ~1s.
shellEnvironmentPrepared: true,
autoBootstrapProjectFromCwd: false,
logWebSocketEvents: false,
tailscaleServeEnabled: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export function makeReplayServerConfig(
tailscaleServeEnabled: false,
tailscaleServePort: 443,
desktopBootstrapToken: undefined,
// The test process already has its PATH; a login-shell probe blocks each boot for ~1s.
shellEnvironmentPrepared: true,
autoBootstrapProjectFromCwd: false,
logWebSocketEvents: false,
stateDir,
Expand Down
9 changes: 7 additions & 2 deletions apps/server/src/plugins/PluginHost.testkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ const encode = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
/**
* Pipe-backed stand-in for Bun's PTY. The shell leads its own process group so
* signals reach the scripts it runs, as a terminal session's hangup does;
* signalling only the shell would orphan a script blocked on a gate.
* signalling only the shell would orphan a script blocked on a gate. It echoes input and
* prints a line-editor prompt like a terminal, or the setup runner waits on real timers.
*/
const PROMPT = "printf '\\033[?2004h$ '\n";
const scriptRuntime: typeof BunPtyRuntime.Service = {
spawn: (command, options) => {
const child = NodeChildProcess.spawn(command[0]!, command.slice(1), {
Expand All @@ -76,12 +78,15 @@ const scriptRuntime: typeof BunPtyRuntime.Service = {
child.once("exit", () => signalGroup("SIGHUP"));
const terminal = {
write: (data: string) => {
child.stdin.write(data.replaceAll("\r", "\n"));
const input = data.replaceAll("\r", "\n");
options.terminal.data(terminal, Buffer.from(input));
child.stdin.write(input.endsWith("\n") ? input + PROMPT : input);
return Buffer.byteLength(data);
},
resize: () => {},
close: () => child.stdin.end(),
};
child.stdin.write(PROMPT);
child.stdout.on("data", (data: Buffer) => options.terminal.data(terminal, data));
child.stderr.on("data", (data: Buffer) => options.terminal.data(terminal, data));
const exited = new Promise<number>((resolve, reject) => {
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/plugins/WorkflowsProvider.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ it.live.each([
supported = !scenario.startsWith("unsupported");
available = !scenario.startsWith("unavailable");
modeAllowed = scenario !== "runtime-mode-startup";
// Drains are serialized: settle any that validated the old providers while launches still fail.
if (scenario.endsWith("direct")) yield* runtime.invoke("reconcile", test.scope);
outage = false;
if (!scenario.endsWith("direct")) {
runtime = yield* test.boot(host, selected);
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/plugins/WorkflowsSkill.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ it.live.each([
yield* fs.writeFileString(path, "# Skill\nOriginal work");
}
if (scenario === "disabled") enabled = false;
// Drains are serialized: settle any that validated the old skill while launches still fail.
if (scenario === "changed-source-direct") yield* runtime.invoke("reconcile", test.scope);
unavailable = false;
if (scenario !== "changed-source-direct") {
runtime = yield* test.boot(host);
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/testUtils/telemetry.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Servers booted by tests would otherwise post analytics to the real ingest host and wait on its shutdown flush.
process.env.T3CODE_TELEMETRY_ENABLED = "false";
5 changes: 3 additions & 2 deletions apps/server/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ export default mergeConfig(
},
},
test: {
// Parallel sqlite/git/worktree/orchestration tests introduce load-sensitive flakes.
fileParallelism: false,
// Real git, sqlite and server fixtures; leave headroom so load does not stretch their waits.
maxWorkers: "75%",
sequence: { sequencer: WeightedShardSequencer },
setupFiles: [
"./src/testUtils/gitConfig.setup.ts",
"./src/testUtils/managedServiceEnv.setup.ts",
"./src/testUtils/telemetry.setup.ts",
],
hookTimeout: 120_000,
testTimeout: 120_000,
Expand Down
Loading