| 132 | |
| 133 | /** Read and lightly validate one benchmark JSON file. */ |
| 134 | export async function loadBenchmarkRun(filePath: string): Promise<BenchmarkRunResult> { |
| 135 | const result = JSON.parse(await Bun.file(filePath).text()) as BenchmarkRunResult; |
| 136 | if (result.version !== 1 || !Array.isArray(result.results)) { |
| 137 | throw new Error(`Invalid benchmark result file: ${filePath}`); |
| 138 | } |
| 139 | return result; |
| 140 | } |
| 141 | |
| 142 | /** Determine whether a comparable metric exceeded its material-regression threshold. */ |
| 143 | export function isMaterialRegression( |