Add explicit "no protection device" state for circuits

Circuits can now record that they deliberately have no protection device
(type NONE, shown as "–"), separate from circuits whose protection is
still open. Migration 0017 makes rated_current_a nullable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian Appel 2026-10-30 13:11:28 +01:00
parent 1f3b903809
commit 38019fe087
27 changed files with 3673 additions and 132 deletions

View file

@ -160,6 +160,47 @@ describe("circuit grid clipboard", () => {
);
});
it("copies an explicit no-protection decision onto other circuits", () => {
const none = makeCircuit("circuit-5", [makeDevice("row-5", 0.1)], {
protectionDevice: { type: "NONE" },
});
const noneRows = buildVisibleGridRowsWithStructure(
[{ ...sections[0], circuits: [none, target] }],
{ headerComponents: [], footerComponents: [] }
);
const [noneRow, targetRow] = ["circuitCompact:circuit-5", "circuitCompact:circuit-2"].map(
(rowKey) => noneRows.find((row) => row.rowKey === rowKey)!
);
const clipboard = buildCellClipboard([noneRow], ["protectionSummary"]);
assert.equal(clipboard.text, "–");
const plan = planCellWrites([
{ row: targetRow, cellKey: "protectionSummary", value: clipboard.cells[0][0] },
]);
assert.deepEqual(plan.updates.map((update) => update.payload), [
{
circuitId: "circuit-2",
expected: {
circuitId: "circuit-2",
type: "LS",
ratedCurrentA: 10,
fuseUtilizationCategory: null,
tripCharacteristic: "B",
rcdType: null,
ratedResidualCurrentMa: null,
},
target: {
circuitId: "circuit-2",
type: "NONE",
ratedCurrentA: null,
fuseUtilizationCategory: null,
tripCharacteristic: null,
rcdType: null,
ratedResidualCurrentMa: null,
},
},
]);
});
it("fills one value into every selected row and skips rows that cannot take it", () => {
const selectedRowKeys = [
"circuitCompact:circuit-1",