Skip to content

Commit 5f6f2cd

Browse files
committed
Tighten publishable report validation
1 parent f8ccb0f commit 5f6f2cd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/contextbench-build-publishable-report.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ function validate(summary, protocol, taskManifest, qualityRows, reliabilityRows)
229229
},
230230
{
231231
id: 'token_metrics_present',
232-
pass: summary.rows.every((row) => row.tokenMetrics?.prediction?.estimatedTokens && row.tokenMetrics?.candidatePack?.estimatedTokens && row.tokenMetrics?.selectorUsage?.totalTokens),
232+
pass: summary.rows.every((row) => hasMetricOrReason(row.tokenMetrics?.prediction?.estimatedTokens)
233+
&& hasMetricOrReason(row.tokenMetrics?.candidatePack?.estimatedTokens)
234+
&& hasMetricOrReason(row.tokenMetrics?.selectorUsage?.totalTokens)),
233235
detail: 'Each row needs prediction, candidate-pack, and selector token fields; unavailable provider usage must be explicit.',
234236
},
235237
{
@@ -251,8 +253,10 @@ function validate(summary, protocol, taskManifest, qualityRows, reliabilityRows)
251253

252254
function formatNumber(value) {
253255
if (value === null || value === undefined) return 'n/a';
256+
if (typeof value === 'string') return value;
254257
if (Number.isInteger(value)) return String(value);
255-
return Number(value).toFixed(3);
258+
const numeric = Number(value);
259+
return Number.isFinite(numeric) ? numeric.toFixed(3) : String(value);
256260
}
257261

258262
function markdownTable(rows, columns) {

0 commit comments

Comments
 (0)