test(reasoning): add customer signing followup fixture

This commit is contained in:
2026-08-14 08:02:45 +01:00
parent 870d325d08
commit bcbcb65020
2 changed files with 195 additions and 0 deletions
@@ -2,6 +2,11 @@ import { describe, it, expect } from "vitest";
import fs from "fs";
import { fileURLToPath } from "url";
import path from "path";
import { situationGraphSchema } from "@/lib/graph/schema.js";
import {
validateGraphReferences,
detectDuplicateNodeIds,
} from "@/lib/graph/utils.js";
// ── Load committed decision-options fixture directly (60A.7) ─────────────
const DECISION_OPTIONS_FIXTURE_PATH = path.resolve(
@@ -10,6 +15,14 @@ const DECISION_OPTIONS_FIXTURE_PATH = path.resolve(
);
const DECISION_OPTIONS_FIXTURE = JSON.parse(fs.readFileSync(DECISION_OPTIONS_FIXTURE_PATH, "utf-8"));
const PRODUCT_LAUNCH_CUSTOMER_SIGNING_FIXTURE_PATH = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"fixtures/pre-anchored-product-launch-customer-signing.json",
);
const PRODUCT_LAUNCH_CUSTOMER_SIGNING_FIXTURE = JSON.parse(
fs.readFileSync(PRODUCT_LAUNCH_CUSTOMER_SIGNING_FIXTURE_PATH, "utf-8"),
);
/**
* Synchronous simulator of the pre-anchored update-only mode with a custom fixture.
* Mirrors what reproduce-multi-turn-investigation.mjs does when FIXTURE_MODE is set
@@ -1372,6 +1385,62 @@ describe("reproduce-multi-turn-investigation harness: one-shot semantics", () =>
});
});
describe("pre-anchored product-launch customer-signing fixture", () => {
it("parses, validates, preserves identities, and exposes the customer unknown as the active target", () => {
const fixture = PRODUCT_LAUNCH_CUSTOMER_SIGNING_FIXTURE;
const graph = situationGraphSchema.parse(fixture.graph);
const graphReferenceValidation = validateGraphReferences(graph);
const duplicateNodeIds = detectDuplicateNodeIds(graph.nodes);
const decisionNodes = graph.nodes.filter((node) => node.id === "n_product_launch_decision");
const launchOptionNodes = graph.nodes.filter((node) => node.id === "opt_launch_this_year");
const waitOptionNodes = graph.nodes.filter((node) => node.id === "opt_wait_twelve_months");
const customerUnknownNodes = graph.nodes.filter(
(node) => node.id === "n_enterprise_customer_signing",
);
const additionalUnknownIds = graph.nodes
.filter(
(node) =>
node.kind === "unknown" &&
![
"n_product_launch_decision",
"n_enterprise_customer_signing",
].includes(node.id),
)
.map((node) => node.id);
expect(fixture.selectedQuestion?.question).toBe(
"What evidence would clarify whether one prospective enterprise customer will sign if we launch this year?",
);
expect(fixture.selectedQuestion?.nodeId).toBe("n_enterprise_customer_signing");
expect(decisionNodes).toHaveLength(1);
expect(decisionNodes[0].status).toBe("unknown");
expect(launchOptionNodes).toHaveLength(1);
expect(waitOptionNodes).toHaveLength(1);
expect(customerUnknownNodes).toHaveLength(1);
expect(customerUnknownNodes[0].status).toBe("unknown");
expect(customerUnknownNodes[0].kind).toBe("unknown");
expect(additionalUnknownIds).toEqual([]);
expect(graphReferenceValidation.valid).toBe(true);
expect(duplicateNodeIds).toEqual([]);
expect(graph.activeUnknownNodeId).toBe("n_enterprise_customer_signing");
expect(customerUnknownNodes[0].id).toBe(graph.activeUnknownNodeId);
const customerLinkage = graph.edges.filter(
(edge) =>
edge.fromNodeId === "n_enterprise_customer_signing" &&
edge.toNodeId === "opt_launch_this_year" &&
edge.relationship === "contained_in",
);
expect(customerLinkage).toHaveLength(1);
});
});
// ── Pre-anchored update-only mode (57J.74) ─────────────
/**