fix(Benchmark): use node:crypto IFO uuid package

This commit is contained in:
Jake Turner 2026-01-22 21:27:57 -08:00 committed by Jake Turner
parent 525eecbbde
commit a42b6b85f6
4 changed files with 6 additions and 30 deletions

View File

@ -3,8 +3,8 @@ import type { HttpContext } from '@adonisjs/core/http'
import { BenchmarkService } from '#services/benchmark_service'
import { runBenchmarkValidator, submitBenchmarkValidator } from '#validators/benchmark'
import { RunBenchmarkJob } from '#jobs/run_benchmark_job'
import { v4 as uuidv4 } from 'uuid'
import type { BenchmarkType } from '../../types/benchmark.js'
import { randomUUID } from 'node:crypto'
@inject()
export default class BenchmarkController {
@ -60,7 +60,7 @@ export default class BenchmarkController {
}
// Generate benchmark ID and dispatch job (async)
const benchmarkId = uuidv4()
const benchmarkId = randomUUID()
const { job, created } = await RunBenchmarkJob.dispatch({
benchmark_id: benchmarkId,
benchmark_type: benchmarkType,
@ -89,7 +89,7 @@ export default class BenchmarkController {
})
}
const benchmarkId = uuidv4()
const benchmarkId = randomUUID()
await RunBenchmarkJob.dispatch({
benchmark_id: benchmarkId,
benchmark_type: 'system',
@ -115,7 +115,7 @@ export default class BenchmarkController {
})
}
const benchmarkId = uuidv4()
const benchmarkId = randomUUID()
await RunBenchmarkJob.dispatch({
benchmark_id: benchmarkId,
benchmark_type: 'ai',

View File

@ -3,7 +3,6 @@ import logger from '@adonisjs/core/services/logger'
import transmit from '@adonisjs/transmit/services/main'
import Docker from 'dockerode'
import si from 'systeminformation'
import { v4 as uuidv4 } from 'uuid'
import axios from 'axios'
import { DateTime } from 'luxon'
import BenchmarkResult from '#models/benchmark_result'
@ -24,6 +23,7 @@ import type {
RepositorySubmitResponse,
RepositoryStats,
} from '../../types/benchmark.js'
import { randomUUID } from 'node:crypto'
// Re-export default weights for use in service
const SCORE_WEIGHTS = {
@ -255,7 +255,7 @@ export class BenchmarkService {
throw new Error('A benchmark is already running')
}
this.currentBenchmarkId = uuidv4()
this.currentBenchmarkId = randomUUID()
this._updateStatus('starting', 'Starting benchmark...')
try {

View File

@ -55,7 +55,6 @@
"tar": "^7.5.6",
"url-join": "^5.0.0",
"usehooks-ts": "^3.1.1",
"uuid": "^13.0.0",
"yaml": "^2.8.0"
},
"devDependencies": {
@ -73,7 +72,6 @@
"@types/node": "^22.15.18",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/uuid": "^10.0.0",
"eslint": "^9.26.0",
"hot-hook": "^0.4.0",
"prettier": "^3.5.3",
@ -4306,13 +4304,6 @@
"@types/geojson": "*"
}
},
"node_modules/@types/uuid": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/validator": {
"version": "13.15.2",
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.15.2.tgz",
@ -12003,19 +11994,6 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
},
"node_modules/uuid": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
"integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist-node/bin/uuid"
}
},
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",

View File

@ -50,7 +50,6 @@
"@types/node": "^22.15.18",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/uuid": "^10.0.0",
"eslint": "^9.26.0",
"hot-hook": "^0.4.0",
"prettier": "^3.5.3",
@ -105,7 +104,6 @@
"tar": "^7.5.6",
"url-join": "^5.0.0",
"usehooks-ts": "^3.1.1",
"uuid": "^13.0.0",
"yaml": "^2.8.0"
},
"hotHook": {