SPB Git

spb/airiskindex Public

The most methodologically rigorous, fully transparent AI job-exposure index.

TypeScript 88% Python 6.1% SQL 2.7% CSS 1.2% JavaScript 0.9% Shell 0.8%
852 B · 24 lines typescript
Raw Blame History
1//  File:    job-id.ts2//  Path:    apps/worker/src/raters/job-id.ts3//  Project: AI Risk Index — airiskindex.io4//  Author:  Simon-Pierre Boucher5//  Contact: contact@spboucher.ai6//  Copyright © 2026 Simon-Pierre Boucher. All rights reserved.7//8//  Description: Deterministic rating job/custom IDs (idempotent batches).910import { createHash } from "node:crypto";1112/**13 * Deterministic ID used both as the BullMQ job ID and the Message Batches14 * `custom_id`, so retries and batch reconciliation are idempotent15 * (CLAUDE.md §6; docs/research/03-llm-rater-api.md). One request rates all16 * dimensions of one task with one model.17 */18export function ratingJobId(taskId: string, model: string, promptVersion: string): string {19  return createHash("sha256")20    .update(`${taskId}:${model}:${promptVersion}`)21    .digest("hex")22    .slice(0, 32);23}24