Validate bootstrap timeout configuration at startup
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
a201790c40
commit
5326137670
2 files changed
+26
No files matched your search
@@ -203,6 +203,26 @@ describe("runtimeApiServer", () => {
|
||||
).rejects.toThrow("Invalid launchCwd: expected directory path");
|
||||
});
|
||||
|
||||
it("rejects non-positive bootstrap timeout configuration", async () => {
|
||||
await expect(
|
||||
startRuntimeApiServer({
|
||||
port: 0,
|
||||
launchCwd: process.cwd(),
|
||||
bootstrapSessionTimeoutMs: 0,
|
||||
}),
|
||||
).rejects.toThrow("Invalid bootstrapSessionTimeoutMs");
|
||||
});
|
||||
|
||||
it("rejects non-integer bootstrap timeout configuration", async () => {
|
||||
await expect(
|
||||
startRuntimeApiServer({
|
||||
port: 0,
|
||||
launchCwd: process.cwd(),
|
||||
bootstrapSessionTimeoutMs: 1.5,
|
||||
}),
|
||||
).rejects.toThrow("Invalid bootstrapSessionTimeoutMs");
|
||||
});
|
||||
|
||||
it("rejects empty auth token configuration", async () => {
|
||||
await expect(
|
||||
startRuntimeApiServer({
|
||||
|
||||
@@ -348,6 +348,12 @@ export async function startRuntimeApiServer(
|
||||
}
|
||||
const bootstrapSessionTimeoutMs =
|
||||
options.bootstrapSessionTimeoutMs ?? BOOTSTRAP_SESSION_TIMEOUT_MS;
|
||||
if (
|
||||
!Number.isInteger(bootstrapSessionTimeoutMs) ||
|
||||
bootstrapSessionTimeoutMs <= 0
|
||||
) {
|
||||
throw new Error("Invalid bootstrapSessionTimeoutMs: expected positive integer.");
|
||||
}
|
||||
const providerManager = new ProviderManager();
|
||||
const processManager = new ProcessManager();
|
||||
const todoStore = new TodoStore(path.join(os.homedir(), ".t3", "todos.json"));
|
||||
|
||||
Reference in new issue
Block a user