chore(sim): log circuit pre-flight verification outcome (observability)

Verification failing silently in production is otherwise hard to spot — the
rules read 0 A when branch currents are missing. Log the errors/warnings,
whether a solve landed, and which branch/node vectors came back.
This commit is contained in:
David Montero 2026-06-17 20:52:10 +02:00
parent 3372151405
commit f523dfb554
1 changed files with 14 additions and 1 deletions

View File

@ -639,7 +639,20 @@ export const EditorToolbar = ({
}),
};
const input = buildInputFromStore(snap);
return await verifyCircuit(input);
const result = await verifyCircuit(input);
// Concise outcome log — verification failing silently in production is
// hard to spot otherwise (the rules read 0 A when currents are missing).
console.log(
'[verify]',
JSON.stringify({
errors: result.errors.map((e) => e.code),
warnings: result.warnings.map((w) => w.code),
solved: !!result.solve,
branches: result.solve ? Object.keys(result.solve.branchCurrents) : null,
nodes: result.solve ? Object.keys(result.solve.nodeVoltages) : null,
}),
);
return result;
} catch (err) {
console.warn('[verifyCircuit] failed', err);
return null;