test(confidence-engine): prove direct helper production seam
This commit is contained in:
@@ -266,4 +266,80 @@ describe("start-case-experiment-helper.cjs apparatus", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── H — Import-only mode (production seam verification) ────────
|
||||
|
||||
describe("H — import-only mode", () => {
|
||||
it("uses plain node subprocess with IMPORT_ONLY=1", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
expect(result.exitCode).not.toBe(0);
|
||||
// exit non-zero because @/ alias blocks real orchestrator import (apparatus evidence)
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed).not.toBeNull();
|
||||
expect(typeof parsed.success).toBe("boolean");
|
||||
});
|
||||
|
||||
it("stdout contains exactly one valid JSON result with mode=import-only", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
const trimmed = result.stdout.trim();
|
||||
expect(trimmed.split("\n").filter(l => l.trim()).length).toBe(1);
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed).not.toBeNull();
|
||||
expect(parsed.mode).toBe("import-only");
|
||||
});
|
||||
|
||||
it("startCaseResolved is documented (false when @/ alias blocks import)", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed).toHaveProperty("startCaseResolved");
|
||||
// startCaseResolved reflects whether the real production import succeeded
|
||||
expect(typeof parsed.startCaseResolved).toBe("boolean");
|
||||
});
|
||||
|
||||
it("documented failureReason is a string (module resolution evidence)", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed).toHaveProperty("failureReason");
|
||||
expect(typeof parsed.failureReason).toBe("string");
|
||||
expect(parsed.failureReason.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("no semantic result fields present (no situationGraph, no error from startCase)", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed).not.toHaveProperty("situationGraphNodeCount");
|
||||
expect(parsed).not.toHaveProperty("situationGraphEdgeCount");
|
||||
expect(parsed).not.toHaveProperty("assessmentPhase");
|
||||
expect(parsed).not.toHaveProperty("endToEndElapsedMs");
|
||||
});
|
||||
|
||||
it("no retry — single JSON output only", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
const lineCount = result.stdout.trim().split("\n").filter(l => l.trim()).length;
|
||||
expect(lineCount).toBe(1);
|
||||
});
|
||||
|
||||
it("no network/provider invocation — import-only mode structurally stops before any provider use", async () => {
|
||||
const result = await runHelper([], {
|
||||
START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY: "1",
|
||||
});
|
||||
// The process exits with the documented import failure reason.
|
||||
// It never reaches OLLAMA_BASE_URL check or startCase invocation.
|
||||
const parsed = parseOutput(result);
|
||||
expect(parsed.mode).toBe("import-only");
|
||||
expect(typeof parsed.failureReason).toBe("string");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user