mirror of
https://github.com/hanzoai/site.git
synced 2026-11-21 01:07:08 +00:00
* Type page props, hook state and helper parameters from their call sites First pass of the strict typing of components/pages (About to cloudfam): destructured props get an interface built from the JSX that renders them, refs and state get their element and value types, plain parameters get the type their callers or body fix. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type pages (careers, calculator, blog, brand, cli) from their data and call sites Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the cloud pages from their scenes and hooks Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * wip * Type the remaining pages under strict Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
32 lines
2.0 KiB
TypeScript
32 lines
2.0 KiB
TypeScript
// The benchmark template must read Hanzo's cells as Hanzo wrote them. Usage: node components/pages/bench/benchData.test.mjs
|
|
import assert from 'node:assert/strict';
|
|
import { registerHooks } from 'node:module';
|
|
// the site's modules import without extensions (Next resolves them); plain node needs the .js
|
|
registerHooks({ resolve: (s, c, next) => { try { return next(s, c); } catch (e) { if (s.startsWith('.')) return next(s + '.js', c); throw e; } } });
|
|
const { measure, benchDoc, figureOf } = await import('./benchData.ts');
|
|
|
|
assert.deepEqual(measure('92.9%'), { v: 92.9, dim: '%' });
|
|
assert.deepEqual(measure('$5.58'), { v: 5.58, dim: '$' });
|
|
const ms = measure('0.13 ms');
|
|
assert.ok(ms);
|
|
assert.equal(ms.dim, 't'); assert.ok(Math.abs(ms.v - 0.00013) < 1e-12); // time in seconds
|
|
assert.deepEqual(measure('~977 GB at that assumption'), { v: 977e9, dim: 'b' });
|
|
assert.deepEqual(measure('184 of 198'), { v: 184, dim: '' });
|
|
assert.equal(measure('Jev 86.0%'), null); // words first: not a figure, unless loose
|
|
assert.deepEqual(measure('Jev 86.0%', true), { v: 86, dim: '%' });
|
|
assert.equal(measure('frontier · 2026-07-19'), null); // a date is not a measurement
|
|
assert.equal(measure('—'), null);
|
|
|
|
const kai = benchDoc('kai-ag-news').chart;
|
|
assert.ok(kai && kai.kind === 'trend');
|
|
assert.deepEqual(kai.ticks, ['85%', '91%', '96%']); // hanzo.ai's own axis labels
|
|
assert.equal(kai.base?.s, 'Jev 86.0%');
|
|
assert.equal(benchDoc('fleet').chart?.kind, 'versus'); // Hanzo, measured against the published figure
|
|
const gpqa = benchDoc('gpqa').chart;
|
|
assert.ok(gpqa && gpqa.kind === 'bars');
|
|
assert.equal(gpqa.rows.find((r) => r.label === 'deepseek-v4-pro')?.cells[2].s, '$0.203'); // the live re-priced run cost
|
|
assert.equal(benchDoc('sandbox').chart?.kind, 'one');
|
|
assert.equal(figureOf(benchDoc('gpqa')), '92.9%'); // a sibling card's figure: Hanzo's own row
|
|
assert.equal(figureOf(benchDoc('fleet')), '477 bytes');
|
|
console.log('bench data: OK');
|