Show Error groups with max child severity (2.63.4).

PCB tree folders are Error / Warning / Info. U18 with PE-PLC-002
ERROR is ERROR, not WARNING. J2 and other connectors list with ICs.
PE-PLC stays in the PCB exam bucket. No deploy.
This commit is contained in:
2026-09-22 01:04:08 +02:00
parent 8f434ffd31
commit 8b4f7710cf
7 changed files with 212 additions and 106 deletions
@@ -2,6 +2,14 @@
What's new in Periscope. What's new in Periscope.
## 2.63.4 — 2026-09-22 — Report Error group, J2, U18 max severity
The findings tree always has an **Error** folder when ERROR findings are visible. Group badge is the worst child (U18 PE-PLC-002 ERROR is not labeled WARNING). Connectors (J2) sit in the same sidebar as U*. PE-PLC stays in the PCB exam bucket. No auth change.
- [Fixed] Status folders Error / Warning / Info; severity = max of children.
- [Fixed] J2 and other non-U refs listed with ICs.
- [Fixed] `isPcbExamFinding` matches layout findings (PE-PLC with PE-BOM).
## 2.63.3 — 2026-09-22 — Module die, truncated QFN pintable, QFN=VQFN ## 2.63.3 — 2026-09-22 — Module die, truncated QFN pintable, QFN=VQFN
HubAudio software leftovers on PE-BOM-010/011: a WROOM module is not the ESP32 die pintable; a QFN-48 land is not wrong because extraction stopped at pins 124; VQFN-24 4×4 is the same QFN family as datasheet QFN-24. Extra signal pads above the declared QFN-n still ERROR. Pad ≠ via. Kelvin unchanged. HubAudio software leftovers on PE-BOM-010/011: a WROOM module is not the ESP32 die pintable; a QFN-48 land is not wrong because extraction stopped at pins 124; VQFN-24 4×4 is the same QFN family as datasheet QFN-24. Extra signal pads above the declared QFN-n still ERROR. Pad ≠ via. Kelvin unchanged.
+3 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "periscope-web", "name": "periscope-web",
"version": "2.63.1", "version": "2.63.4",
"private": true, "private": true,
"scripts": { "scripts": {
"sync-version": "node scripts/sync-version.mjs", "sync-version": "node scripts/sync-version.mjs",
@@ -9,7 +9,8 @@
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "eslint" "lint": "eslint",
"test": "node --experimental-strip-types --test src/lib/findings-forest.test.ts"
}, },
"dependencies": { "dependencies": {
"@base-ui/react": "^1.3.0", "@base-ui/react": "^1.3.0",
@@ -9,13 +9,13 @@ import type {
Finding, Finding,
FindingComment, FindingComment,
FindingReview, FindingReview,
FindingStatus,
Collaborator, Collaborator,
Component, Component,
DesignGraph, DesignGraph,
} from "@/lib/types"; } from "@/lib/types";
import { cn, sortFindings, subtypeLabel } from "@/lib/utils"; import { cn, sortFindings, subtypeLabel } from "@/lib/utils";
import { isAfAiFinding, isPcbExamFinding } from "@/lib/layout-finding"; import { isAfAiFinding, isPcbExamFinding } from "@/lib/layout-finding";
import { groupByWorstStatus, worstStatus } from "@/lib/findings-forest";
interface FindingsTreeProps { interface FindingsTreeProps {
findings: Finding[]; findings: Finding[];
@@ -37,12 +37,6 @@ interface FindingsTreeProps {
onReviewSaved?: (findingId: string, review: FindingReview) => void; onReviewSaved?: (findingId: string, review: FindingReview) => void;
} }
function worstStatus(findings: Finding[]): FindingStatus {
if (findings.some((f) => f.status === "ERROR")) return "ERROR";
if (findings.some((f) => f.status === "WARNING")) return "WARNING";
return "INFO";
}
function pinNetLabel(f: Finding): string { function pinNetLabel(f: Finding): string {
const pin = (f.pins && f.pins[0]) || ""; const pin = (f.pins && f.pins[0]) || "";
const net = f.net || ""; const net = f.net || "";
@@ -131,76 +125,74 @@ function DesignatorForest({
graph, graph,
...cardProps ...cardProps
}: FindingsTreeProps) { }: FindingsTreeProps) {
const byDes = new Map<string, Finding[]>(); const folders = groupByWorstStatus(findings);
for (const f of sortFindings(findings)) {
const list = byDes.get(f.designator) ?? [];
list.push(f);
byDes.set(f.designator, list);
}
const designators = [...byDes.keys()].sort((a, b) => {
const wa = worstStatus(byDes.get(a)!);
const wb = worstStatus(byDes.get(b)!);
const order = { ERROR: 0, WARNING: 1, INFO: 2 } as const;
return order[wa] - order[wb] || a.localeCompare(b);
});
return ( return (
<div> <div>
{designators.map((d) => { {folders.map((folder) => (
const group = byDes.get(d)!; <TreeBranch
const component: Component | undefined = graph.components[d]; key={folder.status}
const extra = [ label={folder.label}
component?.mpn, findings={folder.findings}
component?.component_subtype ? subtypeLabel(component.component_subtype) : "", >
] {folder.designators.map((row) => {
.filter(Boolean) const d = row.designator;
.join(" · "); const group = row.findings;
const byLeaf = new Map<string, Finding[]>(); const component: Component | undefined = graph.components[d];
for (const f of group) { const extra = [
const label = pinNetLabel(f); component?.mpn,
const list = byLeaf.get(label) ?? []; component?.component_subtype ? subtypeLabel(component.component_subtype) : "",
list.push(f); ]
byLeaf.set(label, list); .filter(Boolean)
} .join(" · ");
const leaves = [...byLeaf.entries()].sort((a, b) => a[0].localeCompare(b[0])); const byLeaf = new Map<string, Finding[]>();
return ( for (const finding of group) {
<TreeBranch key={d} label={d} extra={extra} findings={group}> const label = pinNetLabel(finding);
{leaves.map(([label, items]) => ( const list = byLeaf.get(label) ?? [];
<TreeBranch key={`${d}:${label}`} label={label} findings={items}> list.push(finding);
<div className="space-y-3 py-2"> byLeaf.set(label, list);
{sortFindings(items).map((f) => { }
const key = cardProps.findingKeys.get(f); const leaves = [...byLeaf.entries()].sort((a, b) => a[0].localeCompare(b[0]));
return ( return (
<FindingCard <TreeBranch key={d} label={d} extra={extra} findings={group}>
key={key} {leaves.map(([label, items]) => (
finding={f} <TreeBranch key={`${d}:${label}`} label={label} findings={items}>
onViewReference={cardProps.onViewReference} <div className="space-y-3 py-2">
checked={key && cardProps.isReviewed ? cardProps.isReviewed(key) : undefined} {sortFindings(items).map((item) => {
onCheckedChange={ const key = cardProps.findingKeys.get(item);
key && cardProps.onToggleReviewed return (
? () => cardProps.onToggleReviewed!(key) <FindingCard
: undefined key={key}
} finding={item}
comments={f.finding_id ? cardProps.comments?.[f.finding_id] : undefined} onViewReference={cardProps.onViewReference}
projectId={cardProps.projectId} checked={key && cardProps.isReviewed ? cardProps.isReviewed(key) : undefined}
collaborators={cardProps.collaborators} onCheckedChange={
currentUserId={cardProps.currentUserId} key && cardProps.onToggleReviewed
currentUserName={cardProps.currentUserName} ? () => cardProps.onToggleReviewed!(key)
onCommentAdded={cardProps.onCommentAdded} : undefined
onCommentDeleted={cardProps.onCommentDeleted} }
onReportFinding={cardProps.onReportFinding} comments={item.finding_id ? cardProps.comments?.[item.finding_id] : undefined}
isReported={!!(f.finding_id && cardProps.reportedFindingIds?.has(f.finding_id))} projectId={cardProps.projectId}
review={f.finding_id ? cardProps.reviews?.[f.finding_id] : undefined} collaborators={cardProps.collaborators}
onReviewSaved={cardProps.onReviewSaved} currentUserId={cardProps.currentUserId}
/> currentUserName={cardProps.currentUserName}
); onCommentAdded={cardProps.onCommentAdded}
})} onCommentDeleted={cardProps.onCommentDeleted}
</div> onReportFinding={cardProps.onReportFinding}
isReported={!!(item.finding_id && cardProps.reportedFindingIds?.has(item.finding_id))}
review={item.finding_id ? cardProps.reviews?.[item.finding_id] : undefined}
onReviewSaved={cardProps.onReviewSaved}
/>
);
})}
</div>
</TreeBranch>
))}
</TreeBranch> </TreeBranch>
))} );
</TreeBranch> })}
); </TreeBranch>
})} ))}
</div> </div>
); );
} }
@@ -0,0 +1,62 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { groupByWorstStatus, worstStatus } from "./findings-forest.ts";
import { isPcbExamFinding } from "./layout-finding.ts";
import type { Finding } from "./types.ts";
function f(partial: Partial<Finding> & Pick<Finding, "designator" | "status">): Finding {
return {
finding_id: null,
mpn: "",
aspect: null,
finding: partial.finding ?? "",
why: "",
source_page: null,
reference: "",
...partial,
};
}
test("U18 worst status is ERROR when PE-PLC-002 is inside", () => {
const items = [
f({ designator: "U18", status: "ERROR", rule_id: "PE-PLC-002" }),
f({ designator: "U18", status: "WARNING" }),
f({ designator: "U18", status: "WARNING" }),
f({ designator: "U18", status: "WARNING" }),
f({ designator: "U18", status: "WARNING" }),
f({ designator: "U18", status: "WARNING" }),
];
assert.equal(worstStatus(items), "ERROR");
const groups = groupByWorstStatus(items);
assert.deepEqual(
groups.map((g) => g.label),
["Error"],
);
assert.equal(groups[0].designators[0].designator, "U18");
assert.equal(groups[0].findings.length, 6);
assert.equal(groups[0].status, "ERROR");
});
test("Error folder lists J2 connectors, not only U*", () => {
const groups = groupByWorstStatus([
f({ designator: "J2", status: "ERROR", rule_id: "PE-BOM-011" }),
f({ designator: "U11", status: "ERROR" }),
f({ designator: "U5", status: "WARNING" }),
]);
assert.equal(groups[0].label, "Error");
const refs = groups[0].designators.map((d) => d.designator);
assert.deepEqual(refs, ["J2", "U11"]);
assert.ok(!refs.every((r) => r.startsWith("U")));
assert.equal(groups[1].label, "Warning");
});
test("PE-PLC stays in the PCB exam bucket with PE-BOM", () => {
assert.equal(
isPcbExamFinding({ source: "placement_check", rule_id: "PE-PLC-002" }),
true,
);
assert.equal(
isPcbExamFinding({ source: "bom_pcb_check", rule_id: "PE-BOM-011" }),
true,
);
});
@@ -0,0 +1,70 @@
/** Group report findings for the tree: status folders, then every ref (J2 included). */
import type { Finding, FindingStatus } from "./types";
const RANK: Record<FindingStatus, number> = { ERROR: 0, WARNING: 1, INFO: 2 };
export const STATUS_FOLDER: Record<FindingStatus, string> = {
ERROR: "Error",
WARNING: "Warning",
INFO: "Info",
};
export function worstStatus(findings: { status: FindingStatus }[]): FindingStatus {
if (findings.some((f) => f.status === "ERROR")) return "ERROR";
if (findings.some((f) => f.status === "WARNING")) return "WARNING";
return "INFO";
}
export type DesignatorGroup = {
designator: string;
findings: Finding[];
};
export type StatusGroup = {
status: FindingStatus;
label: string;
findings: Finding[];
designators: DesignatorGroup[];
};
/** Sidebar rows: ICs, connectors (J*), and any other ref. Never U-only. */
export function groupByDesignator(findings: Finding[]): DesignatorGroup[] {
const byDes = new Map<string, Finding[]>();
for (const f of findings) {
const d = (f.designator || "").trim() || "(no ref)";
const list = byDes.get(d) ?? [];
list.push(f);
byDes.set(d, list);
}
return [...byDes.entries()]
.sort(([a], [b]) => a.localeCompare(b))
.map(([designator, items]) => ({ designator, findings: items }));
}
/**
* Error / Warning / Info folders. A ref lives in the folder of its worst child.
* U18 with PE-PLC-002 ERROR + five WARNING → Error, badge ERROR, count 6.
*/
export function groupByWorstStatus(findings: Finding[]): StatusGroup[] {
const buckets: Record<FindingStatus, DesignatorGroup[]> = {
ERROR: [],
WARNING: [],
INFO: [],
};
for (const row of groupByDesignator(findings)) {
buckets[worstStatus(row.findings)].push(row);
}
const order: FindingStatus[] = ["ERROR", "WARNING", "INFO"];
return order
.filter((status) => buckets[status].length > 0)
.map((status) => {
const designators = buckets[status];
return {
status,
label: STATUS_FOLDER[status],
findings: designators.flatMap((d) => d.findings),
designators,
};
});
}
@@ -54,38 +54,11 @@ export function isLayoutFinding(f: {
} }
export function isPcbExamFinding(f: { export function isPcbExamFinding(f: {
finding_id?: string | null;
source?: string | null; source?: string | null;
rule_id?: string | null; rule_id?: string | null;
}): boolean { }): boolean {
const rid = f.rule_id || ""; return isLayoutFinding(f) && !isAfAiFinding(f);
return (
f.source === "pcb_review" ||
f.source === "pcb_power_thermal" ||
f.source === "hierarchy_check" ||
f.source === "timing_check" ||
f.source === "pi_check" ||
f.source === "esd_return_check" ||
f.source === "bom_pcb_check" ||
f.source === "spof_check" ||
f.source === "emi_check" ||
rid.startsWith("PE-PWR") ||
rid.startsWith("PE-THM") ||
rid.startsWith("PE-VIA") ||
rid.startsWith("PE-KEL") ||
rid.startsWith("PE-STCH") ||
rid.startsWith("PE-HIER") ||
rid.startsWith("PE-TIM") ||
rid.startsWith("PE-PI") ||
rid.startsWith("PE-ESD") ||
rid.startsWith("PE-RET") ||
rid.startsWith("PE-SPOF") ||
rid.startsWith("PE-EMI") ||
rid.startsWith("PE-STK") ||
rid.startsWith("PE-PD-") ||
rid.startsWith("PE-ANT") ||
rid.startsWith("PE-PDN") ||
/^PE-BOM-01[0-4]$/.test(rid)
);
} }
export function isAfAiFinding(f: { export function isAfAiFinding(f: {
+2 -2
View File
@@ -1,3 +1,3 @@
/** Stamped from content/changelog.md by scripts/sync-version.mjs. */ /** Stamped from content/changelog.md by scripts/sync-version.mjs. */
export const APP_VERSION = "2.63.1"; export const APP_VERSION = "2.63.4";
export const APP_VERSION_DATE = "2026-09-21"; export const APP_VERSION_DATE = "2026-09-22";