@remnic/bench 9.3.524 → 9.3.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +16 -33
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4989,15 +4989,13 @@ function buildBenchmarkArtifact(input) {
4989
4989
  const startedMs = Date.parse(input.startedAt);
4990
4990
  const finishedMs = Date.parse(input.finishedAt);
4991
4991
  if (!Number.isFinite(startedMs)) {
4992
- throw new Error(
4993
- `BuildBenchmarkArtifact: startedAt "${input.startedAt}" is not a valid ISO-8601 timestamp.`
4994
- );
4992
+ throw new Error(`BuildBenchmarkArtifact: startedAt "${input.startedAt}" is not a valid ISO-8601 timestamp.`);
4995
4993
  }
4996
4994
  if (!Number.isFinite(finishedMs)) {
4997
- throw new Error(
4998
- `BuildBenchmarkArtifact: finishedAt "${input.finishedAt}" is not a valid ISO-8601 timestamp.`
4999
- );
4995
+ throw new Error(`BuildBenchmarkArtifact: finishedAt "${input.finishedAt}" is not a valid ISO-8601 timestamp.`);
5000
4996
  }
4997
+ const startedAt = new Date(startedMs).toISOString();
4998
+ const finishedAt = new Date(finishedMs).toISOString();
5001
4999
  const durationMs = Math.max(0, finishedMs - startedMs);
5002
5000
  return {
5003
5001
  schemaVersion: BENCHMARK_ARTIFACT_SCHEMA_VERSION,
@@ -5012,8 +5010,8 @@ function buildBenchmarkArtifact(input) {
5012
5010
  seed: input.seed,
5013
5011
  metrics,
5014
5012
  perTaskScores,
5015
- startedAt: input.startedAt,
5016
- finishedAt: input.finishedAt,
5013
+ startedAt,
5014
+ finishedAt,
5017
5015
  durationMs,
5018
5016
  env: {
5019
5017
  node: result.environment.nodeVersion,
@@ -5025,15 +5023,14 @@ function buildBenchmarkArtifact(input) {
5025
5023
  }
5026
5024
  function buildBenchmarkArtifactFilename(artifact) {
5027
5025
  const date = sanitizeSegment(artifact.startedAt.slice(0, 10));
5028
- const sha = sanitizeSegment(
5029
- (artifact.system.gitSha || "unknown").slice(0, 7)
5030
- );
5026
+ const sha = sanitizeSegment((artifact.system.gitSha || "unknown").slice(0, 7));
5031
5027
  const model = sanitizeSegment(artifact.model);
5032
5028
  const benchmark = sanitizeSegment(artifact.benchmarkId);
5033
5029
  return `${date}-${benchmark}-${model}-${sha}.json`;
5034
5030
  }
5035
5031
  function serializeBenchmarkArtifact(artifact) {
5036
- return canonicalJsonStringify(artifact, 2) + "\n";
5032
+ return `${canonicalJsonStringify(artifact, 2)}
5033
+ `;
5037
5034
  }
5038
5035
  function hashBenchmarkArtifact(artifact) {
5039
5036
  return createHash4("sha256").update(serializeBenchmarkArtifact(artifact)).digest("hex");
@@ -5092,9 +5089,7 @@ function parseBenchmarkArtifact(raw) {
5092
5089
  const metrics = requireObject(record, "metrics");
5093
5090
  for (const [key, value] of Object.entries(metrics)) {
5094
5091
  if (typeof value !== "number" || !Number.isFinite(value)) {
5095
- throw new Error(
5096
- `BenchmarkArtifact metrics.${key} must be a finite number; got ${String(value)}.`
5097
- );
5092
+ throw new Error(`BenchmarkArtifact metrics.${key} must be a finite number; got ${String(value)}.`);
5098
5093
  }
5099
5094
  }
5100
5095
  const tasks = record.perTaskScores;
@@ -5110,17 +5105,11 @@ function parseBenchmarkArtifact(raw) {
5110
5105
  requireOptionalString(task, "category", `perTaskScores[${index}].category`);
5111
5106
  const scoreRecord = task.scores;
5112
5107
  if (!scoreRecord || typeof scoreRecord !== "object" || Array.isArray(scoreRecord)) {
5113
- throw new Error(
5114
- `BenchmarkArtifact perTaskScores[${index}].scores must be an object.`
5115
- );
5108
+ throw new Error(`BenchmarkArtifact perTaskScores[${index}].scores must be an object.`);
5116
5109
  }
5117
- for (const [scoreKey, scoreValue] of Object.entries(
5118
- scoreRecord
5119
- )) {
5110
+ for (const [scoreKey, scoreValue] of Object.entries(scoreRecord)) {
5120
5111
  if (typeof scoreValue !== "number" || !Number.isFinite(scoreValue)) {
5121
- throw new Error(
5122
- `BenchmarkArtifact perTaskScores[${index}].scores.${scoreKey} must be a finite number.`
5123
- );
5112
+ throw new Error(`BenchmarkArtifact perTaskScores[${index}].scores.${scoreKey} must be a finite number.`);
5124
5113
  }
5125
5114
  }
5126
5115
  }
@@ -5189,9 +5178,7 @@ function requireOptionalString(record, field, label) {
5189
5178
  function requireNumber(record, field) {
5190
5179
  const value = record[field];
5191
5180
  if (typeof value !== "number" || !Number.isFinite(value)) {
5192
- throw new Error(
5193
- `BenchmarkArtifact field "${field}" must be a finite number.`
5194
- );
5181
+ throw new Error(`BenchmarkArtifact field "${field}" must be a finite number.`);
5195
5182
  }
5196
5183
  }
5197
5184
  function requireObject(record, field) {
@@ -5204,14 +5191,10 @@ function requireObject(record, field) {
5204
5191
  function requireIsoTimestamp(record, field) {
5205
5192
  const value = record[field];
5206
5193
  if (typeof value !== "string") {
5207
- throw new Error(
5208
- `BenchmarkArtifact field "${field}" must be an ISO-8601 timestamp string.`
5209
- );
5194
+ throw new Error(`BenchmarkArtifact field "${field}" must be an ISO-8601 timestamp string.`);
5210
5195
  }
5211
5196
  if (!Number.isFinite(Date.parse(value))) {
5212
- throw new Error(
5213
- `BenchmarkArtifact field "${field}" "${value}" is not a parseable ISO-8601 timestamp.`
5214
- );
5197
+ throw new Error(`BenchmarkArtifact field "${field}" "${value}" is not a parseable ISO-8601 timestamp.`);
5215
5198
  }
5216
5199
  }
5217
5200
  function isPublishedBenchmarkArtifactId(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.3.524",
3
+ "version": "9.3.526",
4
4
  "description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "hyparquet": "^1.25.7",
36
36
  "yaml": "^2.4.2",
37
- "@remnic/core": "^9.3.524"
37
+ "@remnic/core": "^9.3.526"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.5.1",