feat: add one-turn situation graph update UI
This commit is contained in:
@@ -55,11 +55,21 @@ export default function DiagnosticsView({ result }) {
|
||||
},
|
||||
{
|
||||
label: "Node count",
|
||||
value: diagnostics.nodeCount != null ? diagnostics.nodeCount : "?",
|
||||
value:
|
||||
diagnostics.nodeCount != null
|
||||
? diagnostics.nodeCount
|
||||
: diagnostics.graphNodeCount != null
|
||||
? diagnostics.graphNodeCount
|
||||
: "?",
|
||||
},
|
||||
{
|
||||
label: "Edge count",
|
||||
value: diagnostics.edgeCount != null ? diagnostics.edgeCount : "?",
|
||||
value:
|
||||
diagnostics.edgeCount != null
|
||||
? diagnostics.edgeCount
|
||||
: diagnostics.graphEdgeCount != null
|
||||
? diagnostics.graphEdgeCount
|
||||
: "?",
|
||||
},
|
||||
{
|
||||
label: "Graph references",
|
||||
@@ -75,6 +85,9 @@ export default function DiagnosticsView({ result }) {
|
||||
const errors = [
|
||||
...(result.errors || []),
|
||||
...(result.validationErrors || []),
|
||||
...(result.graphValidationErrors || []),
|
||||
...(result.proposalErrors || []),
|
||||
...(result.providerErrors || []),
|
||||
...(result.analysisErrors || []),
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
import React from "react";
|
||||
|
||||
function ListSection({ title, items, renderItem = (item) => item }) {
|
||||
if (!items?.length) return null;
|
||||
|
||||
return (
|
||||
<section className="rounded-lg border border-gray-200 bg-white p-4">
|
||||
<h3 className="mb-2 text-sm font-semibold text-gray-800">{title}</h3>
|
||||
<ul className="space-y-1 text-sm text-gray-700">
|
||||
{items.map((item, index) => (
|
||||
<li key={`${title}-${index}`}>{renderItem(item)}</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default function GraphUpdateView({ updateResult }) {
|
||||
if (!updateResult?.proposal) return null;
|
||||
|
||||
const {
|
||||
resolvedUnknownNodeIds,
|
||||
affectedNodeIds,
|
||||
previousActiveUnknownNodeId,
|
||||
newActiveUnknownNodeId,
|
||||
changesApplied,
|
||||
proposal,
|
||||
previousSituationGraph,
|
||||
updatedSituationGraph,
|
||||
} = updateResult;
|
||||
|
||||
const previousNodesById = new Map(
|
||||
(previousSituationGraph?.nodes || []).map((node) => [node.id, node]),
|
||||
);
|
||||
const updatedNodesById = new Map(
|
||||
(updatedSituationGraph?.nodes || []).map((node) => [node.id, node]),
|
||||
);
|
||||
const proposalUpdatesByNodeId = new Map(
|
||||
(proposal.updatedNodes || []).map((update) => [update.nodeId, update]),
|
||||
);
|
||||
|
||||
function resolveNodePresentation(nodeId) {
|
||||
const previousNode = previousNodesById.get(nodeId) || null;
|
||||
const updatedNode = updatedNodesById.get(nodeId) || null;
|
||||
const node = updatedNode || previousNode;
|
||||
const update = proposalUpdatesByNodeId.get(nodeId) || null;
|
||||
|
||||
if (!node) {
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<div className="font-medium text-gray-900">Unknown node (ID: {nodeId})</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<div className="font-medium text-gray-900">{node.label}</div>
|
||||
<div className="text-xs text-gray-600">
|
||||
{node.kind} · {node.confidence}
|
||||
</div>
|
||||
{(update?.previousStatus || update?.newStatus || node.status) && (
|
||||
<div className="text-xs text-gray-700">
|
||||
{update?.previousStatus ? `Previous status: ${update.previousStatus}` : null}
|
||||
{update?.previousStatus && update?.newStatus ? " → " : null}
|
||||
{update?.newStatus
|
||||
? `New status: ${update.newStatus}`
|
||||
: !update?.previousStatus
|
||||
? `Status: ${node.status}`
|
||||
: null}
|
||||
</div>
|
||||
)}
|
||||
{update?.reason && <div className="text-xs text-gray-700">{update.reason}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function resolveActiveUnknown(nodeId) {
|
||||
if (!nodeId) return null;
|
||||
|
||||
const node = updatedNodesById.get(nodeId) || previousNodesById.get(nodeId);
|
||||
if (!node) {
|
||||
return `Unknown node (ID: ${nodeId})`;
|
||||
}
|
||||
|
||||
return `${node.label} · ${node.status} · ${node.confidence}`;
|
||||
}
|
||||
|
||||
const changeItems = [
|
||||
changesApplied?.addedNodeCount
|
||||
? `${changesApplied.addedNodeCount} node(s) added`
|
||||
: null,
|
||||
changesApplied?.updatedNodeCount
|
||||
? `${changesApplied.updatedNodeCount} node(s) updated`
|
||||
: null,
|
||||
changesApplied?.addedEdgeCount
|
||||
? `${changesApplied.addedEdgeCount} edge(s) added`
|
||||
: null,
|
||||
changesApplied?.removedEdgeCount
|
||||
? `${changesApplied.removedEdgeCount} edge(s) removed`
|
||||
: null,
|
||||
changesApplied?.resolvedUnknownCount
|
||||
? `${changesApplied.resolvedUnknownCount} unknown(s) resolved`
|
||||
: null,
|
||||
].filter(Boolean);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<section className="rounded-lg border border-blue-200 bg-blue-50 p-4">
|
||||
<h2 className="mb-2 text-base font-semibold text-blue-900">
|
||||
Graph update applied
|
||||
</h2>
|
||||
<div className="grid gap-2 text-sm text-blue-950 sm:grid-cols-2">
|
||||
{previousActiveUnknownNodeId && (
|
||||
<div>
|
||||
<span className="font-medium">Previous active unknown:</span>{" "}
|
||||
{resolveActiveUnknown(previousActiveUnknownNodeId)}
|
||||
</div>
|
||||
)}
|
||||
{newActiveUnknownNodeId && (
|
||||
<div>
|
||||
<span className="font-medium">New active unknown:</span>{" "}
|
||||
{resolveActiveUnknown(newActiveUnknownNodeId)}
|
||||
</div>
|
||||
)}
|
||||
{!newActiveUnknownNodeId && previousActiveUnknownNodeId && (
|
||||
<div>
|
||||
<span className="font-medium">Next question status:</span> No next
|
||||
question selected yet.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<ListSection
|
||||
title="Resolved unknowns"
|
||||
items={resolvedUnknownNodeIds}
|
||||
renderItem={resolveNodePresentation}
|
||||
/>
|
||||
<ListSection
|
||||
title="Affected nodes"
|
||||
items={affectedNodeIds}
|
||||
renderItem={resolveNodePresentation}
|
||||
/>
|
||||
<ListSection title="Applied changes" items={changeItems} />
|
||||
|
||||
<details className="rounded-lg border border-gray-200 bg-gray-50 p-4">
|
||||
<summary className="cursor-pointer text-sm font-medium text-gray-700 underline">
|
||||
Proposal details
|
||||
</summary>
|
||||
<pre className="mt-3 overflow-auto rounded bg-gray-900 p-3 text-xs text-green-400">
|
||||
{JSON.stringify(proposal, null, 2)}
|
||||
</pre>
|
||||
<pre className="mt-3 overflow-auto rounded bg-gray-900 p-3 text-xs text-green-400">
|
||||
{JSON.stringify(
|
||||
{
|
||||
previousActiveUnknownNodeId,
|
||||
newActiveUnknownNodeId,
|
||||
resolvedUnknownNodeIds,
|
||||
affectedNodeIds,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}
|
||||
</pre>
|
||||
</details>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
import React from "react";
|
||||
import { useState, useRef } from "react";
|
||||
import DiagnosticsView from "@/components/diagnostics-view";
|
||||
import GraphUpdateView from "@/components/graph-update-view";
|
||||
import SituationGraphView from "@/components/situation-graph-view";
|
||||
|
||||
const MAX_LENGTH = 10000;
|
||||
@@ -15,6 +16,45 @@ export async function submitScenarioForStartCase(fetchImpl, scenario) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function submitAnswerForUpdateCase(
|
||||
fetchImpl,
|
||||
{ situationGraph, previousQuestion, answer },
|
||||
) {
|
||||
if (!answer?.trim()) {
|
||||
return {
|
||||
ok: false,
|
||||
skipped: true,
|
||||
data: {
|
||||
success: false,
|
||||
stage: "request_validation",
|
||||
error: "Please enter an answer before updating.",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const response = await fetchImpl("/api/cases/update", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ situationGraph, previousQuestion, answer }),
|
||||
});
|
||||
|
||||
return {
|
||||
ok: response.ok,
|
||||
skipped: false,
|
||||
data: await response.json(),
|
||||
};
|
||||
}
|
||||
|
||||
function normaliseStartResult(data) {
|
||||
return {
|
||||
...data,
|
||||
selectedQuestion:
|
||||
typeof data?.selectedQuestion === "string"
|
||||
? data.selectedQuestion
|
||||
: data?.selectedQuestion?.question ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
export function ScenarioResultPanels({ status, result }) {
|
||||
if (!result) return null;
|
||||
|
||||
@@ -51,16 +91,58 @@ export function ScenarioResultPanels({ status, result }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function UpdateErrorPanel({ updateError }) {
|
||||
if (!updateError) return null;
|
||||
|
||||
const errors = [
|
||||
...(updateError.errors || []),
|
||||
...(updateError.validationErrors || []),
|
||||
...(updateError.graphValidationErrors || []),
|
||||
...(updateError.proposalErrors || []),
|
||||
...(updateError.providerErrors || []),
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="rounded-lg border border-red-300 bg-red-50 px-4 py-3 text-sm text-red-700 whitespace-pre-wrap">
|
||||
Update error: {updateError.error}
|
||||
</div>
|
||||
{errors.length > 0 && (
|
||||
<details className="rounded-lg border border-red-200 bg-red-50 px-4 py-3">
|
||||
<summary className="cursor-pointer text-sm font-medium text-red-700 underline">
|
||||
Update details ({errors.length})
|
||||
</summary>
|
||||
<ul className="mt-2 space-y-1 text-sm text-red-700">
|
||||
{errors.map((item, index) => (
|
||||
<li key={index}>
|
||||
{typeof item === "string" ? item : item?.message || JSON.stringify(item)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ScenarioForm() {
|
||||
const [scenario, setScenario] = useState("");
|
||||
const [status, setStatus] = useState("idle"); // idle | loading | error | success
|
||||
const [result, setResult] = useState(null);
|
||||
const [answer, setAnswer] = useState("");
|
||||
const [updateStatus, setUpdateStatus] = useState("idle"); // idle | loading | error | success
|
||||
const [updateError, setUpdateError] = useState(null);
|
||||
const [updateResult, setUpdateResult] = useState(null);
|
||||
const textareaRef = useRef(null);
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
setStatus("loading");
|
||||
setResult(null);
|
||||
setAnswer("");
|
||||
setUpdateStatus("idle");
|
||||
setUpdateError(null);
|
||||
setUpdateResult(null);
|
||||
|
||||
try {
|
||||
const res = await submitScenarioForStartCase(fetch, scenario);
|
||||
@@ -69,10 +151,10 @@ export default function ScenarioForm() {
|
||||
|
||||
if (res.ok && data.success) {
|
||||
setStatus("success");
|
||||
setResult(data);
|
||||
setResult(normaliseStartResult(data));
|
||||
} else {
|
||||
setStatus("error");
|
||||
setResult(data);
|
||||
setResult(normaliseStartResult(data));
|
||||
}
|
||||
} catch (err) {
|
||||
setStatus("error");
|
||||
@@ -80,6 +162,55 @@ export default function ScenarioForm() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleUpdate = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const submission = await submitAnswerForUpdateCase(fetch, {
|
||||
situationGraph: result?.situationGraph,
|
||||
previousQuestion: result?.selectedQuestion,
|
||||
answer,
|
||||
});
|
||||
|
||||
if (submission.skipped) {
|
||||
setUpdateStatus("error");
|
||||
setUpdateError(submission.data);
|
||||
return;
|
||||
}
|
||||
|
||||
setUpdateStatus("loading");
|
||||
setUpdateError(null);
|
||||
|
||||
try {
|
||||
const outcome = submission.data;
|
||||
|
||||
if (submission.ok && outcome.success) {
|
||||
setUpdateStatus("success");
|
||||
setUpdateResult({
|
||||
...outcome,
|
||||
previousSituationGraph: result?.situationGraph ?? null,
|
||||
});
|
||||
setResult((current) => ({
|
||||
...current,
|
||||
situationGraph: outcome.updatedSituationGraph,
|
||||
selectedQuestion: null,
|
||||
diagnostics: outcome.diagnostics,
|
||||
}));
|
||||
setAnswer("");
|
||||
} else {
|
||||
setUpdateStatus("error");
|
||||
setUpdateError(outcome);
|
||||
}
|
||||
} catch (err) {
|
||||
setUpdateStatus("error");
|
||||
setUpdateError({ error: err.message || "Network request failed" });
|
||||
}
|
||||
};
|
||||
|
||||
const canRenderAnswerForm =
|
||||
status === "success" &&
|
||||
Boolean(result?.situationGraph) &&
|
||||
Boolean(result?.selectedQuestion);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
@@ -105,9 +236,56 @@ export default function ScenarioForm() {
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{canRenderAnswerForm && (
|
||||
<form onSubmit={handleUpdate} className="space-y-4 rounded-lg border border-gray-200 bg-white p-4">
|
||||
<div>
|
||||
<h2 className="text-base font-semibold text-gray-900">Selected Question</h2>
|
||||
<p className="mt-1 text-sm text-gray-700">{result.selectedQuestion}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="answer-textarea" className="mb-2 block text-sm font-medium text-gray-700">
|
||||
Your answer
|
||||
</label>
|
||||
<textarea
|
||||
id="answer-textarea"
|
||||
value={answer}
|
||||
onChange={(e) => setAnswer(e.target.value)}
|
||||
rows={4}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-sm focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400"
|
||||
placeholder="Enter the answer to the selected question..."
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<p className="text-xs text-gray-500">
|
||||
{updateStatus === "loading"
|
||||
? "Applying validated graph update..."
|
||||
: "One update turn only in this prototype."}
|
||||
</p>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={updateStatus === "loading"}
|
||||
className="rounded-lg bg-blue-700 px-4 py-2 text-sm font-medium text-white transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{updateStatus === "loading" ? "Updating..." : "Update situation"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
|
||||
<UpdateErrorPanel updateError={updateError} />
|
||||
|
||||
{updateStatus === "success" && updateResult && (
|
||||
<>
|
||||
<div className="rounded-lg border border-yellow-300 bg-yellow-50 px-4 py-3 text-sm text-yellow-800">
|
||||
No next question selected yet.
|
||||
</div>
|
||||
<GraphUpdateView updateResult={updateResult} />
|
||||
</>
|
||||
)}
|
||||
|
||||
<ScenarioResultPanels status={status} result={result} />
|
||||
|
||||
{status === "loading" && (
|
||||
{(status === "loading" || updateStatus === "loading") && (
|
||||
<div className="py-12 text-center text-sm text-gray-400">
|
||||
Waiting for model response...
|
||||
</div>
|
||||
|
||||
@@ -55,6 +55,11 @@ export default function SituationGraphView({
|
||||
}) {
|
||||
if (!situationGraph) return null;
|
||||
|
||||
const selectedQuestionText =
|
||||
typeof selectedQuestion === "string"
|
||||
? selectedQuestion
|
||||
: selectedQuestion?.question ?? null;
|
||||
|
||||
const activeUnknown = situationGraph.activeUnknownNodeId
|
||||
? situationGraph.nodes.find((node) => node.id === situationGraph.activeUnknownNodeId)
|
||||
: null;
|
||||
@@ -67,10 +72,10 @@ export default function SituationGraphView({
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{selectedQuestion?.question && (
|
||||
{selectedQuestionText && (
|
||||
<section className="rounded-lg border-2 border-green-300 bg-green-50 p-5">
|
||||
<h2 className="mb-2 text-base font-bold text-green-800">Selected Question</h2>
|
||||
<p className="text-base font-medium text-gray-900">{selectedQuestion.question}</p>
|
||||
<p className="text-base font-medium text-gray-900">{selectedQuestionText}</p>
|
||||
</section>
|
||||
)}
|
||||
|
||||
|
||||
+145
-1
@@ -34,6 +34,140 @@ function collectDuplicateEdgeIds(edges) {
|
||||
.map(([edgeId, count]) => ({ edgeId, count }));
|
||||
}
|
||||
|
||||
function normaliseText(value) {
|
||||
return String(value || "")
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function buildResolvedUnknownUpdate(node) {
|
||||
return {
|
||||
nodeId: node.id,
|
||||
previousStatus: node.status ?? null,
|
||||
newStatus: "resolved",
|
||||
previousValue: node.value ?? null,
|
||||
newValue: node.value ?? null,
|
||||
reason:
|
||||
"Resolved because the proposal explicitly marked this unknown as resolved.",
|
||||
};
|
||||
}
|
||||
|
||||
function reconcileResolutionSemantics(graph, proposal) {
|
||||
const nextProposal = cloneJsonSafe(proposal);
|
||||
const errors = [];
|
||||
const graphNodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
||||
const updatedNodeById = new Map(
|
||||
nextProposal.updatedNodes.map((nodeUpdate) => [
|
||||
nodeUpdate.nodeId,
|
||||
nodeUpdate,
|
||||
]),
|
||||
);
|
||||
|
||||
for (const resolvedUnknownNodeId of nextProposal.resolvedUnknownNodeIds) {
|
||||
const existingNode = graphNodeById.get(resolvedUnknownNodeId);
|
||||
|
||||
if (!existingNode) {
|
||||
errors.push(
|
||||
`Resolved unknown must reference an existing node: "${resolvedUnknownNodeId}"`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (existingNode.kind !== "unknown") {
|
||||
errors.push(
|
||||
`Resolved unknown must reference an existing unknown node: "${resolvedUnknownNodeId}"`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
const existingUpdate = updatedNodeById.get(resolvedUnknownNodeId);
|
||||
if (!existingUpdate) {
|
||||
const syntheticUpdate = buildResolvedUnknownUpdate(existingNode);
|
||||
nextProposal.updatedNodes.push(syntheticUpdate);
|
||||
updatedNodeById.set(resolvedUnknownNodeId, syntheticUpdate);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (existingUpdate.newStatus !== "resolved") {
|
||||
existingUpdate.newStatus = "resolved";
|
||||
if (existingUpdate.previousStatus == null) {
|
||||
existingUpdate.previousStatus = existingNode.status ?? null;
|
||||
}
|
||||
if (existingUpdate.previousValue === undefined) {
|
||||
existingUpdate.previousValue = existingNode.value ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const update of nextProposal.updatedNodes) {
|
||||
const existingNode = graphNodeById.get(update.nodeId);
|
||||
if (
|
||||
existingNode?.kind === "unknown" &&
|
||||
update.newStatus === "resolved" &&
|
||||
!nextProposal.resolvedUnknownNodeIds.includes(update.nodeId)
|
||||
) {
|
||||
errors.push(
|
||||
`Unknown node updated to resolved must also appear in resolvedUnknownNodeIds: "${update.nodeId}"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
proposal: nextProposal,
|
||||
errors,
|
||||
};
|
||||
}
|
||||
|
||||
function validateSemanticDuplicateUnknowns(graph, proposal) {
|
||||
const errors = [];
|
||||
const unresolvedUnknowns = graph.nodes.filter(
|
||||
(node) =>
|
||||
node.kind === "unknown" &&
|
||||
!proposal.resolvedUnknownNodeIds.includes(node.id),
|
||||
);
|
||||
|
||||
for (const addedNode of proposal.addedNodes) {
|
||||
const addedTexts = [
|
||||
normaliseText(addedNode.label),
|
||||
normaliseText(addedNode.description),
|
||||
].filter(Boolean);
|
||||
|
||||
for (const unresolvedUnknown of unresolvedUnknowns) {
|
||||
const unresolvedTexts = [
|
||||
normaliseText(unresolvedUnknown.label),
|
||||
normaliseText(unresolvedUnknown.description),
|
||||
].filter(Boolean);
|
||||
|
||||
const duplicatesMeaning = addedTexts.some((text) =>
|
||||
unresolvedTexts.includes(text),
|
||||
);
|
||||
|
||||
if (!duplicatesMeaning) continue;
|
||||
|
||||
const linkedToUnknown = proposal.addedEdges.some(
|
||||
(edge) =>
|
||||
(edge.fromNodeId === addedNode.id &&
|
||||
edge.toNodeId === unresolvedUnknown.id) ||
|
||||
(edge.toNodeId === addedNode.id &&
|
||||
edge.fromNodeId === unresolvedUnknown.id),
|
||||
);
|
||||
|
||||
const updatedUnknown = proposal.updatedNodes.some(
|
||||
(update) => update.nodeId === unresolvedUnknown.id,
|
||||
);
|
||||
|
||||
if (!linkedToUnknown && !updatedUnknown) {
|
||||
errors.push(
|
||||
`Proposal adds a node duplicating unresolved unknown meaning without linking or resolving it: "${unresolvedUnknown.id}"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
function buildAffectedNodeIds(graph, proposal) {
|
||||
const affected = new Set(proposal.affectedNodeIds ?? []);
|
||||
|
||||
@@ -116,8 +250,13 @@ export function applyValidatedProposal({ situationGraph, proposal }) {
|
||||
};
|
||||
}
|
||||
|
||||
const validatedProposal = proposalValidation.data;
|
||||
const reconciledProposal = reconcileResolutionSemantics(
|
||||
situationGraph,
|
||||
proposalValidation.data,
|
||||
);
|
||||
const validatedProposal = reconciledProposal.proposal;
|
||||
const proposalCompatibilityErrors = [];
|
||||
proposalCompatibilityErrors.push(...reconciledProposal.errors);
|
||||
const proposalGraphValidation = validateGraphUpdate(
|
||||
situationGraph,
|
||||
validatedProposal,
|
||||
@@ -180,6 +319,10 @@ export function applyValidatedProposal({ situationGraph, proposal }) {
|
||||
),
|
||||
);
|
||||
|
||||
proposalCompatibilityErrors.push(
|
||||
...validateSemanticDuplicateUnknowns(situationGraph, validatedProposal),
|
||||
);
|
||||
|
||||
if (proposalCompatibilityErrors.length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -288,5 +431,6 @@ export function applyValidatedProposal({ situationGraph, proposal }) {
|
||||
previousActiveUnknownNodeId,
|
||||
newActiveUnknownNodeId,
|
||||
changesApplied: buildChangesApplied(validatedProposal, affectedNodeIds),
|
||||
graphReferenceValidation: resultReferenceValidation,
|
||||
};
|
||||
}
|
||||
|
||||
+41
-16
@@ -46,6 +46,29 @@ function buildDiagnostics({ analysis, graph, graphReferenceValidation }) {
|
||||
};
|
||||
}
|
||||
|
||||
function buildUpdateDiagnostics({
|
||||
promptVersion,
|
||||
modelName,
|
||||
responseDurationMs,
|
||||
normalisationsApplied,
|
||||
graph,
|
||||
graphReferenceValidation,
|
||||
}) {
|
||||
return {
|
||||
promptVersion: promptVersion ?? "v0.4",
|
||||
modelName: modelName ?? null,
|
||||
responseDurationMs: responseDurationMs ?? null,
|
||||
validationStatus: "valid",
|
||||
nodeCount: graph?.nodes?.length ?? 0,
|
||||
edgeCount: graph?.edges?.length ?? 0,
|
||||
graphReferenceValidation: graphReferenceValidation ?? {
|
||||
valid: true,
|
||||
errors: [],
|
||||
},
|
||||
normalisationsApplied: normalisationsApplied ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
export async function startCase(body) {
|
||||
const parsedRequest = startCaseRequestSchema.safeParse(body);
|
||||
|
||||
@@ -254,12 +277,14 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
|
||||
stage: applicationResult.stage,
|
||||
errors: applicationResult.errors,
|
||||
diagnostics: {
|
||||
promptVersion: promptVersion ?? null,
|
||||
modelName,
|
||||
responseDurationMs,
|
||||
normalisationsApplied: parsedProposal.normalisationsApplied,
|
||||
graphNodeCount: situationGraph.nodes.length,
|
||||
graphEdgeCount: situationGraph.edges.length,
|
||||
...buildUpdateDiagnostics({
|
||||
promptVersion,
|
||||
modelName,
|
||||
responseDurationMs,
|
||||
normalisationsApplied: parsedProposal.normalisationsApplied,
|
||||
graph: situationGraph,
|
||||
graphReferenceValidation: graphReferenceValidation,
|
||||
}),
|
||||
},
|
||||
statusCode:
|
||||
applicationResult.stage === "application" ||
|
||||
@@ -280,14 +305,14 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
|
||||
applicationResult.previousActiveUnknownNodeId,
|
||||
newActiveUnknownNodeId: applicationResult.newActiveUnknownNodeId,
|
||||
changesApplied: applicationResult.changesApplied,
|
||||
diagnostics: {
|
||||
promptVersion: promptVersion ?? null,
|
||||
diagnostics: buildUpdateDiagnostics({
|
||||
promptVersion,
|
||||
modelName,
|
||||
responseDurationMs,
|
||||
normalisationsApplied: parsedProposal.normalisationsApplied,
|
||||
graphNodeCount: applicationResult.updatedSituationGraph.nodes.length,
|
||||
graphEdgeCount: applicationResult.updatedSituationGraph.edges.length,
|
||||
},
|
||||
graph: applicationResult.updatedSituationGraph,
|
||||
graphReferenceValidation: applicationResult.graphReferenceValidation,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -295,13 +320,13 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
|
||||
success: true,
|
||||
stage: "proposal_ready",
|
||||
proposal: parsedProposal.proposal,
|
||||
diagnostics: {
|
||||
promptVersion: promptVersion ?? null,
|
||||
diagnostics: buildUpdateDiagnostics({
|
||||
promptVersion,
|
||||
modelName,
|
||||
responseDurationMs,
|
||||
normalisationsApplied: parsedProposal.normalisationsApplied,
|
||||
graphNodeCount: situationGraph.nodes.length,
|
||||
graphEdgeCount: situationGraph.edges.length,
|
||||
},
|
||||
graph: situationGraph,
|
||||
graphReferenceValidation,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ The JSON object must contain exactly these top-level fields:
|
||||
|
||||
## Additional Guidance
|
||||
- If the answer only clarifies an existing unknown, prefer updatedNodes and resolvedUnknownNodeIds over creating duplicate nodes.
|
||||
- When an answer resolves an existing unknown, include that existing node ID in resolvedUnknownNodeIds and update that node rather than creating only a parallel observation.
|
||||
- If a new metric or observation is necessary, add the smallest set of nodes and edges needed.
|
||||
- If the answer does not justify a change, return empty arrays for every category.
|
||||
|
||||
|
||||
@@ -280,6 +280,60 @@ describe("applyValidatedProposal", () => {
|
||||
expect(result.updatedSituationGraph.resolvedNodeIds).toContain(
|
||||
ids.complaintRateUnknown,
|
||||
);
|
||||
expect(
|
||||
result.updatedSituationGraph.nodes.find(
|
||||
(node) => node.id === ids.complaintRateUnknown,
|
||||
)?.status,
|
||||
).toBe("resolved");
|
||||
});
|
||||
|
||||
it("rejects resolvedUnknownNodeIds that do not reference actual unknown nodes", () => {
|
||||
const { graph, proposal, ids } = makeApplicationFixture();
|
||||
|
||||
const result = applyValidatedProposal({
|
||||
situationGraph: graph,
|
||||
proposal: {
|
||||
...proposal,
|
||||
resolvedUnknownNodeIds: [ids.qualityDeterioration],
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.stage).toBe("proposal_compatibility");
|
||||
expect(result.errors.join(" ")).toContain(
|
||||
"Resolved unknown must reference an existing unknown node",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects a duplicate semantic node without resolution", () => {
|
||||
const { graph, proposal } = makeApplicationFixture();
|
||||
|
||||
const result = applyValidatedProposal({
|
||||
situationGraph: graph,
|
||||
proposal: {
|
||||
...proposal,
|
||||
resolvedUnknownNodeIds: [],
|
||||
updatedNodes: proposal.updatedNodes.filter(
|
||||
(update) => update.nodeId !== "n-complaint-rate-unknown",
|
||||
),
|
||||
addedNodes: [
|
||||
makeNode({
|
||||
id: "n-parallel-rate",
|
||||
label: "Complaint rate",
|
||||
description: "Need the complaint rate per 100 units",
|
||||
kind: "observation",
|
||||
status: "supported",
|
||||
confidence: "medium",
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.stage).toBe("proposal_compatibility");
|
||||
expect(result.errors.join(" ")).toContain(
|
||||
"duplicating unresolved unknown meaning",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps the active unknown when it remains unresolved", () => {
|
||||
|
||||
@@ -13,9 +13,9 @@ function makeAnalysisResult(overrides = {}) {
|
||||
return {
|
||||
success: true,
|
||||
validationStatus: "valid",
|
||||
modelName: "llama3",
|
||||
modelName: "configured-model",
|
||||
responseDurationMs: 321,
|
||||
rawResponse: "{}",
|
||||
rawResponse: undefined,
|
||||
promptVersion: "v0.3",
|
||||
reconstruction: {
|
||||
summary: "Revenue and complaints diverge",
|
||||
@@ -164,7 +164,7 @@ describe("lib/graph/orchestrator startCase", () => {
|
||||
expect(result.situationGraph.currentSummary).toContain("Nodes:");
|
||||
expect(result.diagnostics).toMatchObject({
|
||||
validationStatus: "valid",
|
||||
modelName: "llama3",
|
||||
modelName: "configured-model",
|
||||
graphReferenceValidation: { valid: true, errors: [] },
|
||||
});
|
||||
});
|
||||
@@ -208,7 +208,7 @@ describe("lib/graph/orchestrator startCase", () => {
|
||||
error: "Provider unavailable",
|
||||
errors: ["socket hang up"],
|
||||
rawResponse: null,
|
||||
modelName: "llama3",
|
||||
modelName: "configured-model",
|
||||
responseDurationMs: 99,
|
||||
promptVersion: "v0.3",
|
||||
validationStatus: "invalid",
|
||||
@@ -279,8 +279,9 @@ describe("lib/graph/orchestrator startCase", () => {
|
||||
diagnostics: {
|
||||
promptVersion: "v0.4",
|
||||
modelName: "configured",
|
||||
graphNodeCount: 2,
|
||||
graphEdgeCount: 0,
|
||||
nodeCount: 2,
|
||||
edgeCount: 0,
|
||||
validationStatus: "valid",
|
||||
},
|
||||
});
|
||||
expect(provider.generateReconstruction).toHaveBeenCalledTimes(1);
|
||||
|
||||
+43
-12
@@ -4,7 +4,7 @@ const BASE_URL = process.env.PLAYWRIGHT_BASE_URL || "http://localhost:3000";
|
||||
|
||||
test.setTimeout(300000);
|
||||
|
||||
test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
test("graph-backed one-turn update smoke test", async ({ page }) => {
|
||||
await page.goto(BASE_URL);
|
||||
|
||||
// Page should load without error
|
||||
@@ -26,7 +26,11 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
await page.getByRole("button", { name: /Analyse/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByRole("heading", { name: /Selected Question/i }),
|
||||
page
|
||||
.locator("section")
|
||||
.filter({ hasText: /Selected Question/i })
|
||||
.last()
|
||||
.getByRole("heading", { name: /Selected Question/i }),
|
||||
).toBeVisible({ timeout: 180000 });
|
||||
await expect(
|
||||
page.getByRole("heading", { name: /Situation Graph/i }),
|
||||
@@ -40,13 +44,43 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
await rawJsonToggle.click();
|
||||
await expect(page.getByText(/centralStatement/i)).toBeVisible();
|
||||
|
||||
const selectedQuestionSections = page
|
||||
.locator("section")
|
||||
.filter({ hasText: "Selected Question" });
|
||||
await expect(selectedQuestionSections).toHaveCount(1);
|
||||
const questionText = await selectedQuestionSections.first().innerText();
|
||||
expect(questionText.length).toBeGreaterThan(25);
|
||||
|
||||
const answerTextarea = page.locator(
|
||||
"textarea[placeholder*='Enter the answer']",
|
||||
);
|
||||
await expect(answerTextarea).toBeVisible();
|
||||
await answerTextarea.fill(
|
||||
"The complaint rate fell from 2.0 complaints per 100 units to 1.9 complaints per 100 units.",
|
||||
);
|
||||
await page.getByRole("button", { name: /Update situation/i }).click();
|
||||
|
||||
await expect(page.getByText(/Graph update applied/i)).toBeVisible({
|
||||
timeout: 240000,
|
||||
});
|
||||
await expect(page.getByText(/Resolved unknowns/i)).toBeVisible();
|
||||
await expect(page.getByText(/Affected nodes/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/No next question selected yet\./i),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText(/Error:/i)).toHaveCount(0);
|
||||
await expect(page.getByText(/Update error:/i)).toHaveCount(0);
|
||||
await expect(answerTextarea).toHaveValue("");
|
||||
|
||||
const proposalToggle = page.getByText(/Proposal details/i);
|
||||
await expect(proposalToggle).toBeVisible();
|
||||
|
||||
await rawJsonToggle.click();
|
||||
await expect(page.getByText(/resolvedNodeIds/i)).toBeVisible();
|
||||
|
||||
// Get full body text for verification
|
||||
const bodyText = await page.locator("body").innerText();
|
||||
|
||||
console.log("\n=== UI Smoke Test Results ===");
|
||||
console.log("Page title:", await page.title());
|
||||
console.log("Body content length:", bodyText.length);
|
||||
|
||||
// Check key content indicators
|
||||
const hasSelectedQuestion = bodyText.includes("Selected Question");
|
||||
const hasComplaints =
|
||||
@@ -59,12 +93,9 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
bodyText.toLowerCase().includes("denominator") ||
|
||||
bodyText.toLowerCase().includes("per-unit");
|
||||
|
||||
console.log("Has selected question heading:", hasSelectedQuestion);
|
||||
console.log("Has complaints reference:", hasComplaints);
|
||||
console.log("Has production reference:", hasProduction);
|
||||
console.log("Has rate context (rate/unit/denominator):", hasRateContext);
|
||||
|
||||
// Basic structural checks
|
||||
expect(bodyText.length).toBeGreaterThan(200);
|
||||
expect(bodyText.length).toBeGreaterThan(400);
|
||||
expect(hasSelectedQuestion).toBe(true);
|
||||
expect(bodyText.includes("Resolved unknowns")).toBe(true);
|
||||
expect(bodyText.includes("Affected nodes")).toBe(true);
|
||||
});
|
||||
|
||||
@@ -2,9 +2,12 @@ import React from "react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import DiagnosticsView from "@/components/diagnostics-view.jsx";
|
||||
import GraphUpdateView from "@/components/graph-update-view.jsx";
|
||||
import SituationGraphView from "@/components/situation-graph-view.jsx";
|
||||
import {
|
||||
ScenarioResultPanels,
|
||||
UpdateErrorPanel,
|
||||
submitAnswerForUpdateCase,
|
||||
submitScenarioForStartCase,
|
||||
} from "@/components/scenario-form.jsx";
|
||||
|
||||
@@ -70,6 +73,73 @@ function makeGraphResult(overrides = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function makeUpdateSuccess(overrides = {}) {
|
||||
return {
|
||||
success: true,
|
||||
stage: "update_applied",
|
||||
updatedSituationGraph: {
|
||||
centralStatement: "Complaints increased while production increased.",
|
||||
currentSummary: "Updated summary",
|
||||
activeUnknownNodeId: "n-next-unknown",
|
||||
resolvedNodeIds: ["n-unknown"],
|
||||
nodes: [
|
||||
{
|
||||
id: "n-1",
|
||||
label: "Complaints up 35%",
|
||||
description: "Complaints increased by 35%",
|
||||
kind: "observation",
|
||||
status: "supported",
|
||||
confidence: "high",
|
||||
value: 35,
|
||||
unit: "%",
|
||||
},
|
||||
{
|
||||
id: "n-conclusion",
|
||||
label: "Quality deterioration",
|
||||
description: "Quality deterioration conclusion",
|
||||
kind: "conclusion",
|
||||
status: "weakened",
|
||||
confidence: "medium",
|
||||
value: null,
|
||||
unit: null,
|
||||
},
|
||||
{
|
||||
id: "n-unknown",
|
||||
label: "Complaint rate denominator",
|
||||
description: "Need the denominator for complaint rate",
|
||||
kind: "unknown",
|
||||
status: "resolved",
|
||||
confidence: "medium",
|
||||
value: "1.9 complaints per 100 units",
|
||||
unit: null,
|
||||
},
|
||||
],
|
||||
edges: [],
|
||||
},
|
||||
proposal: {
|
||||
addedNodes: [],
|
||||
updatedNodes: [
|
||||
{ nodeId: "n-unknown", newStatus: "resolved", reason: "answered" },
|
||||
],
|
||||
addedEdges: [],
|
||||
removedEdgeIds: [],
|
||||
resolvedUnknownNodeIds: ["n-unknown"],
|
||||
affectedNodeIds: ["n-conclusion"],
|
||||
},
|
||||
affectedNodeIds: ["n-conclusion"],
|
||||
resolvedUnknownNodeIds: ["n-unknown"],
|
||||
previousActiveUnknownNodeId: "n-unknown",
|
||||
newActiveUnknownNodeId: "n-next-unknown",
|
||||
changesApplied: {
|
||||
updatedNodeCount: 2,
|
||||
resolvedUnknownCount: 1,
|
||||
affectedNodeCount: 1,
|
||||
},
|
||||
diagnostics: { responseDurationMs: 100 },
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("scenario-form UI helpers", () => {
|
||||
it("submits to /api/cases/start", async () => {
|
||||
const fetchImpl = vi.fn().mockResolvedValue({ ok: true });
|
||||
@@ -84,6 +154,46 @@ describe("scenario-form UI helpers", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("empty answer is rejected without fetch", async () => {
|
||||
const fetchImpl = vi.fn();
|
||||
|
||||
const result = await submitAnswerForUpdateCase(fetchImpl, {
|
||||
situationGraph: { nodes: [] },
|
||||
previousQuestion: "What changed?",
|
||||
answer: " ",
|
||||
});
|
||||
|
||||
expect(result.skipped).toBe(true);
|
||||
expect(fetchImpl).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("update request body contains graph, previousQuestion and answer", async () => {
|
||||
const fetchImpl = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({ success: true }),
|
||||
});
|
||||
const graph = { nodes: [{ id: "n1" }], edges: [] };
|
||||
|
||||
await submitAnswerForUpdateCase(fetchImpl, {
|
||||
situationGraph: graph,
|
||||
previousQuestion: "What changed?",
|
||||
answer: "The rate fell.",
|
||||
});
|
||||
|
||||
expect(fetchImpl).toHaveBeenCalledWith(
|
||||
"/api/cases/update",
|
||||
expect.objectContaining({
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
situationGraph: graph,
|
||||
previousQuestion: "What changed?",
|
||||
answer: "The rate fell.",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("graph-backed UI rendering", () => {
|
||||
@@ -128,6 +238,17 @@ describe("graph-backed UI rendering", () => {
|
||||
).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("no answer form appears when selectedQuestion is null", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<SituationGraphView
|
||||
situationGraph={makeGraphResult().situationGraph}
|
||||
selectedQuestion={null}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).not.toContain("Update situation");
|
||||
});
|
||||
|
||||
it("renders diagnostics", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<DiagnosticsView result={makeGraphResult()} />,
|
||||
@@ -187,4 +308,121 @@ describe("graph-backed UI rendering", () => {
|
||||
expect(html).toContain("Raw graph JSON");
|
||||
expect(html).toContain(""centralStatement"");
|
||||
});
|
||||
|
||||
it("resolved unknowns render", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView
|
||||
updateResult={{
|
||||
...makeUpdateSuccess(),
|
||||
previousSituationGraph: makeGraphResult().situationGraph,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Resolved unknowns");
|
||||
expect(html).toContain("Complaint rate denominator");
|
||||
});
|
||||
|
||||
it("affected nodes render", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView
|
||||
updateResult={{
|
||||
...makeUpdateSuccess(),
|
||||
previousSituationGraph: makeGraphResult().situationGraph,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Affected nodes");
|
||||
expect(html).toContain("Quality deterioration");
|
||||
});
|
||||
|
||||
it("no fake next question appears", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView
|
||||
updateResult={{
|
||||
...makeUpdateSuccess({ newActiveUnknownNodeId: null }),
|
||||
previousSituationGraph: makeGraphResult().situationGraph,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("No next question selected yet.");
|
||||
});
|
||||
|
||||
it("previous and new active unknowns render labels", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView
|
||||
updateResult={{
|
||||
...makeUpdateSuccess(),
|
||||
previousSituationGraph: makeGraphResult().situationGraph,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Previous active unknown");
|
||||
expect(html).toContain("Complaint rate denominator");
|
||||
expect(html).toContain("New active unknown");
|
||||
expect(html).toContain("Unknown node (ID: n-next-unknown)");
|
||||
});
|
||||
|
||||
it("raw ids remain only in collapsed proposal details", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView
|
||||
updateResult={{
|
||||
...makeUpdateSuccess(),
|
||||
previousSituationGraph: makeGraphResult().situationGraph,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Proposal details");
|
||||
expect(html).toContain(""resolvedUnknownNodeIds"");
|
||||
});
|
||||
|
||||
it("update diagnostics render valid values", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<DiagnosticsView
|
||||
result={{
|
||||
diagnostics: {
|
||||
promptVersion: "v0.4",
|
||||
modelName: "configured-model",
|
||||
responseDurationMs: 456,
|
||||
validationStatus: "valid",
|
||||
nodeCount: 7,
|
||||
edgeCount: 3,
|
||||
graphReferenceValidation: { valid: true, errors: [] },
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("v0.4");
|
||||
expect(html).toContain("456ms");
|
||||
expect(html).toContain("7");
|
||||
expect(html).toContain("3");
|
||||
expect(html).toContain("✅ valid");
|
||||
});
|
||||
|
||||
it("structured update error renders", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<UpdateErrorPanel
|
||||
updateError={{
|
||||
error: "Invalid graph update proposal",
|
||||
proposalErrors: [{ message: "bad proposal" }],
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("Update error: Invalid graph update proposal");
|
||||
expect(html).toContain("bad proposal");
|
||||
});
|
||||
|
||||
it("proposal details remain collapsible", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<GraphUpdateView updateResult={makeUpdateSuccess()} />,
|
||||
);
|
||||
|
||||
expect(html).toContain("Proposal details");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user