SPB Git forge
28commits 1branches 0releases
7.7 MBsize
maindefault branch
10 days agolast push
Python 66.3% TypeScript 22.7% JavaScript 8.6% HTML 1.4% CSS 0.7%

web: methodology accepts the API's confidence label objects (prerender fix)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed 12 days ago (Sep 12, 2026) parent 118d5c6

2 changed files +6 −2

modified apps/web/src/app/methodology/page.tsx +5 −1
@@ -10,7 +10,11 @@ export const revalidate = 3600;
10 10 export default async function MethodologyPage() {
11 11 const m = await safe(api.methodology());
12 12 const bands = Array.isArray(m?.significance_bands) ? m.significance_bands : m?.significance_bands ? Object.entries(m.significance_bands).map(([label, [min, max]]) => ({ label, min, max })) : [];
13 − const labels = m?.confidence_labels ? (Array.isArray(m.confidence_labels) ? m.confidence_labels.map((l) => [l, ''] as const) : Object.entries(m.confidence_labels)) : [];
13 + const labels: ReadonlyArray<readonly [string, string]> = m?.confidence_labels
14 + ? Array.isArray(m.confidence_labels)
15 + ? m.confidence_labels.map((l) => (typeof l === 'string' ? ([l, ''] as const) : ([l.label, l.min_confidence != null ? `confidence ≥ ${Math.round(l.min_confidence * 100)} %` : ''] as const)))
16 + : Object.entries(m.confidence_labels).map(([k, v]) => [k, String(v)] as const)
17 + : [];
14 18 return (
15 19 <Container>
16 20 <PageHeader eyebrow="Methodology" title="Reproducible metrics over observed public pages" lede="Every metric value on the site carries a formula version, its inputs and a computation time. Formula versions bump whenever weights or normalisation change, so historical values remain reproducible." />
modified apps/web/src/lib/types.ts +1 −1
@@ -649,7 +649,7 @@ export interface Methodology {
649 649 metrics: { metric: string; formula_version: string; description: string; inputs: string[] }[];
650 650 significance_bands: Record<string, [number, number]> | { label: string; min: number; max: number }[];
651 651 event_types: string[];
652 − confidence_labels: Record<string, string> | string[];
652 + confidence_labels: Record<string, string> | (string | { label: string; min_confidence?: number | null })[];
653 653 }
654 654
655 655 // ---------------------------------------------------------------------------------------------------------- admin
656 656