fix(docker): run real questions through trusted Pi gate

This commit is contained in:
2026-07-12 19:20:10 +02:00
parent c446d40e1f
commit 7628eaa579
16 changed files with 266 additions and 14 deletions
+11
View File
@@ -127,6 +127,17 @@ test("spawnFor default (new) mode sends /nuova-domanda", async () => {
mgr.teardown("sid-10");
});
test("spawnFor new mode forwards the real question instead of kickoff", async () => {
const cfg = loadConfig({});
const child = recordingChild();
const mgr = new PiProcessManager(cfg, { spawnFn: () => child as any });
await mgr.spawnFor("sid-question", { question: "pazienti con cardioversione e ILR" });
const prompt = JSON.parse(child._writes.at(-1)!);
expect(prompt.message).toBe('/nuova-domanda "pazienti con cardioversione e ILR"');
expect(prompt.message).not.toContain("kickoff");
mgr.teardown("sid-question");
});
test("production spawn uses explicit Pi path and passes portable data root without rewriting PATH", async () => {
vi.stubEnv("PATH", "/usr/local/bin:/usr/bin");
vi.stubEnv("PI_PROVIDER_API_KEY", "provider-secret");