diff --git a/app/scaling/page.test.tsx b/app/scaling/page.test.tsx index 771fefa..77dc3b1 100644 --- a/app/scaling/page.test.tsx +++ b/app/scaling/page.test.tsx @@ -22,7 +22,7 @@ const area = async (id: string) => renderToStaticMarkup(await ScalingAreaPage({ it('ends the first screen with the DA link, and no guardrails or benchmark links', async () => { const html = renderToStaticMarkup(await ScalingPage()); expect(html).toContain('DA by workload'); - expect(html).toContain('Block Gas Limit: 40 Mgas'); + expect(html, 'configured rate and per-block budget use the requested units').toContain('200 Mgas / s (40 Mgas / block)'); // The guardrails page stays, unlinked, while the first screen leaves guardrails out. expect(html).not.toMatch(/href="\/scaling\/guardrails"|Guardrails<\/h2>|SLOs/); expect(html).not.toMatch(/href="\/benchmark|href="\/scaling\/networking"/); @@ -34,11 +34,26 @@ it('ends the first screen with the DA link, and no guardrails or benchmark links it('orders the first screen: freshness, headline, ladder, ranked limits, subsystems by workload, work, links', async () => { const html = renderToStaticMarkup(await ScalingPage()); - const order = ['Block Gas Limit: 40 Mgas', 'Usage to 2026-01-02', 'Proven capacity', 'How close are we, and to what?', 'What breaks first', 'Subsystems by workload', 'Glamsterdam', 'Work log', 'DA by workload'].map((h) => html.indexOf(h)); + const order = ['200 Mgas / s (40 Mgas / block)', 'Usage to 2026-01-02', 'Proven capacity', 'How close are we, and to what?', 'What breaks first', 'Subsystems by workload', 'Glamsterdam', 'Work log', 'DA by workload'].map((h) => html.indexOf(h)); expect(order.every((i, k) => i > (order[k - 1] ?? -1))).toBe(true); expect(html).not.toMatch(/Subsystem detail|>Progress<|Ceilings by bottleneck|Usage data as of/); }); +/** Verifies the dual-unit header uses configured data and preserves unknown values. */ +it.each([ + [1234.5, '1,234.5 Mgas / s (246.9 Mgas / block)'], + [0, '0 Mgas / s (0 Mgas / block)'], + [null, '— Mgas / s (— Mgas / block)'], +])('renders configured gas rate %s in both units', async (value, expected) => { + const path = join(tmpdir(), `scaling-header-${value}.json`); + writeFileSync(path, JSON.stringify({ ...fixture, ladder: { ...fixture.ladder, configuredLimit: { ...fixture.ladder.configuredLimit, value, tag: value === null ? 'not-established' : fixture.ladder.configuredLimit.tag } } })); + vi.stubEnv('SCALING_SNAPSHOT_PATH', path); + const html = renderToStaticMarkup(await ScalingPage()); + expect(html, 'both units reflect the configured limit without substituting sample data').toContain(expected); + expect(html, 'the editorial explanation labels this as a block gas limit').toContain('Block gas limit'); + if (value === null) expect(html, 'missing configuration is explicitly unavailable').toContain('Configured gas limit unavailable.'); +}); + it('dates snapshot data without a stale banner', async () => { // The fixture is far older than any staleness window. expect(renderToStaticMarkup(await ScalingGuardrailsPage())).toContain('Usage data as of 2026-01-02'); diff --git a/app/scaling/page.tsx b/app/scaling/page.tsx index 4bfa4ea..95e9044 100644 --- a/app/scaling/page.tsx +++ b/app/scaling/page.tsx @@ -18,13 +18,22 @@ export default async function ScalingPage() { const snapshot = withArchiveSize(loaded.snapshot, await loadArchiveSize()); const dashboardUrl = process.env.SCALING_DATADOG_DASHBOARD_URL; + const gasRate = snapshot.ladder.configuredLimit.value; return (