import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; // Source conventions of the system panel and its issue rows; proves no rendering. // Injection, the polling gate, issue and agent routing, the dispatch close, keyboard // reveal, row severity and glyphs, and the process line order are behaviour-proven by // `just load-test system`, the reactivity test and `just ui-test system`. const read = name => readFileSync(new URL(name, import.meta.url), "utf8"); const system = read("SystemPanel.qml"); assert.doesNotMatch(system, /childrenRect|\bsurfaces\b|\bbarWindow\b/, "panel has no host geometry dependency"); assert.doesNotMatch(read("../../PopupHost.qml"), /agentDispatched|SystemPanel/, "the host never names the system feature's signal or panel"); const issueRow = read("SystemIssueRow.qml"); // \uF08E is the open icon. assert.match(issueRow, /color: root\.historical \? root\.theme\.ui\.minor/); // Source order is layout order: problems or all ok lead, then live resources, // incident history, and the machine disclosure last; the suite proves the geometry. const order = ['text: "all ok"', 'text: "needs attention"', 'text: "live"', 'text: "incident history"', 'text: "machine"'].map(text => system.indexOf(text)); assert(order.every((at, index) => at >= 0 && (index === 0 || at > order[index - 1])), "panel sections in spec order: " + order); // The heading is the issue's identity as a human label (human.js). assert.match(issueRow, /readonly property string heading: Human\.text\(Res\.issueHeading\(issue\), "app"\)/); assert.match(issueRow, /icon: "\uF08E"[\s\S]*text: root\.issue\.events \? "open latest crash for " \+ root\.heading : root\.historical \? "open record for " \+ root\.heading : "open " \+ String\(root\.issue\.label \|\| "issue"\)[\s\S]*showText: false/, "open actions name the group identity and latest-crash scope"); assert.match(issueRow, /icon: "󰨈"[\s\S]*"arrrgh"[\s\S]*accessibleName: root\.issue\.events \? "assess crashes: " \+ root\.heading : "fix with agent: "/); assert.match(issueRow, /textFormat: Text\.PlainText/, "incident metadata is never interpreted as markup"); assert.match(system, /property bool machineExpanded: false/, "the machine disclosure is panel state the host retains"); assert.match(system, /property string expandedIncident: ""/, "the incident details disclosure is panel state the host retains"); assert.match(read("../../Registry.qml"), /"machineExpanded": false,\s*"expandedIncident": ""/, "the system entry retains both disclosures"); assert.equal((system.match(/MetricRow \{/g) || []).length, 6); assert.match(system, /Sys\.formatBytes/); assert.match(system, /Sys\.formatRate/); console.log("system-panel.test.mjs: ALL PASS");