fix(webui): router fixture consistency and panel screenshots

Router escalation fixtures now scale tiers, reasons and outcomes with requests, and the shadow classifier differs from live. The harness captures each panel's full scroll height, runs checks on the expanded panel, and samples smartrouter/uni. RoutersPage no longer refetches on range change. The breaker State column sorts by severity.
This commit is contained in:
2026-11-25 11:52:37 +00:00
parent b9ca05be66
commit ec9df6a92d
8 changed files with 124 additions and 12 deletions
+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from 'vitest'
import { statusRank } from './breaker-severity'
import { sortThenSlice } from './table-sort'
describe('statusRank', () => {
it('ranks open > half-open > degraded > closed', () => {
expect(statusRank('open')).toBeGreaterThan(statusRank('half-open'))
expect(statusRank('half-open')).toBeGreaterThan(statusRank('degraded'))
expect(statusRank('degraded')).toBeGreaterThan(statusRank('closed'))
})
it('ranks an unknown state below closed so it never reads as severe', () => {
expect(statusRank('mystery')).toBeLessThan(statusRank('closed'))
})
it('sorts severity-first, not alphabetically', () => {
const rows = ['closed', 'open', 'degraded', 'half-open'].map((s) => ({ s, rank: statusRank(s) }))
expect(sortThenSlice(rows, { key: 'rank', direction: 'desc' }, 10, 0).map((r) => r.s)).toEqual(['open', 'half-open', 'degraded', 'closed'])
})
})
+6
View File
@@ -0,0 +1,6 @@
const SEVERITY: Record<string, number> = { open: 3, 'half-open': 2, degraded: 1, closed: 0 }
/** Sort rank of a breaker status, most severe highest; unknown states rank below closed. */
export function statusRank(status: string): number {
return SEVERITY[status] ?? -1
}