Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: severity group-sort tallies all visible comments, not open-only counts (#1600)
[._.]/ Adam Eivy4e45ea2e841b
diff --git a/client/src/lib/editorialChecks.js b/client/src/lib/editorialChecks.jsindex 0bf31198f2..a4ba37446e 100644--- a/client/src/lib/editorialChecks.js+++ b/client/src/lib/editorialChecks.js@@ -226,15 +226,21 @@ function sortComments(comments, sort) {// from its already-sorted comments (e.g. its lowest issue number / best status).function sortGroups(groups, sort) {if (sort === 'severity') {- // Surface the checks with the most severe open findings first. Compare tiers- // lexicographically (high, then medium, then low) so a single high finding- // always outranks any volume of lower-severity ones — a weighted sum would- // let 101 lows bury a high.- return [...groups].sort((a, b) =>- (b.counts.high - a.counts.high)- || (b.counts.medium - a.counts.medium)- || (b.counts.low - a.counts.low)- || (b.open - a.open));+ // Surface the checks with the most severe findings first. Tally severity over+ // ALL visible comments (group.counts is open-only, so a resolved-only filtered+ // view would tie at zero) and compare tiers lexicographically (high, then+ // medium, then low) so a single high always outranks any volume of lower ones.+ const sevCounts = new Map(groups.map((g) => {+ const c = emptyCounts();+ for (const x of g.comments) c[normSeverity(x)] += 1;+ return [g, c];+ }));+ return [...groups].sort((a, b) => {+ const ca = sevCounts.get(a);+ const cb = sevCounts.get(b);+ return (cb.high - ca.high) || (cb.medium - ca.medium) || (cb.low - ca.low)+ || (b.comments.length - a.comments.length);+ });}if (sort === 'issue') {const leadIssue = (g) => {diff --git a/client/src/lib/editorialChecks.test.js b/client/src/lib/editorialChecks.test.jsindex d39653cabc..4d73fcdbc8 100644--- a/client/src/lib/editorialChecks.test.js+++ b/client/src/lib/editorialChecks.test.js@@ -203,6 +203,18 @@ describe('applyFindingsView', () => {expect(view.map((g) => g.checkId)).toEqual(['pacing', 'naming']);});+ it('sorts groups by severity even in a resolved-only filtered view (counts are open-only)', () => {+ const comments = [+ { id: 'z1', checkId: 'zebra', status: 'dismissed', severity: 'high', problem: 'High resolved' },+ { id: 'a1', checkId: 'alpha', status: 'dismissed', severity: 'low', problem: 'Low resolved' },+ ];+ const rows = { zebra: { label: 'Zebra', scope: 'series' }, alpha: { label: 'Alpha', scope: 'series' } };+ const groups = groupFindingsByCheck(comments, rows);+ // Default scope→label order is Alpha, Zebra; severity sort must flip to Zebra (high) first.+ const view = applyFindingsView(groups, { statuses: new Set(['dismissed']) }, 'severity');+ expect(view.map((g) => g.checkId)).toEqual(['zebra', 'alpha']);+ });+it('ranks a single high-severity group above a noisy many-low group when sort=severity', () => {const comments = [{ id: 'h1', checkId: 'one-high', status: 'open', severity: 'high', problem: 'Critical' },